Xmonad:如何重置主窗格中的窗口数量?

发布于 2024-12-11 10:25:15 字数 2749 浏览 1 评论 0原文

有时,当我在 Xmonad 中 mod-Lmod-H 时,我的窗口不会调整大小。我相信这是我不小心更改了主窗格中窗口数量的结果。有时我很幸运能够点击适量的 mod-,mod-. 回到可以调整大小的位置,但并不经常。

如何将窗格重置为其默认值,即 Xmonad 在启动时为其提供的默认值?我的 xmonad.hs:

import XMonad
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import System.Exit
import Graphics.X11.Xlib
import IO (Handle, hPutStrLn)

import XMonad.Hooks.ManageDocks
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.SetWMName

import XMonad.Layout.IM
import XMonad.Layout.Reflect
import XMonad.Layout.NoBorders
import XMonad.Layout.ResizableTile
import XMonad.Layout.PerWorkspace
import XMonad.Layout.LayoutHints
import XMonad.Layout.LayoutCombinators hiding ((|||))
import XMonad.Layout.LayoutHints
import XMonad.Layout.NoBorders
import XMonad.Layout.ComboP
import XMonad.Layout.PerWorkspace
import XMonad.Layout.ResizableTile
import XMonad.Layout.Tabbed
import XMonad.Layout.TwoPane
import XMonad.Util.Run (spawnPipe)
import qualified XMonad.StackSet as W
import XMonad.Hooks.ManageHelpers
import XMonad.Layout.NoBorders

main = do
  h <- spawnPipe "/usr/bin/xmobar"
  xmonad defaultConfig
             { workspaces = workspaces'
             , borderWidth = borderWidth'
             , logHook = logHook' h
             , terminal = terminal'
             , modMask = mod4Mask
             , layoutHook = layoutHook'
             , manageHook = manageHook'
             , startupHook = setWMName "LG3D"
             }

customPP :: PP
customPP = defaultPP { ppCurrent = xmobarColor "#AFAF87" "" . wrap "<" ">"
                     , ppTitle =  shorten 80
                     , ppSep =  "<fc=#AFAF87> | </fc>"
                     , ppHiddenNoWindows = xmobarColor "#AFAF87" ""
                     , ppUrgent = xmobarColor "#FFFFAF" "" . wrap "[" "]"
                     }

logHook' :: Handle ->  X ()
logHook' h = dynamicLogWithPP $ customPP { ppOutput = hPutStrLn h }

manageHook' :: ManageHook
manageHook' = composeAll [
  isFullscreen --> doFullFloat
  ]

layoutHook' = customLayout

borderWidth' :: Dimension
borderWidth' = 1

normalBorderColor', focusedBorderColor' :: String
normalBorderColor'  = "#333333"
focusedBorderColor' = "#AFAF87"

workspaces' :: [WorkspaceId]
workspaces' = ["1", "2", "3", "4", "5", "6"]


customLayout = avoidStruts $ layoutHints $ smartBorders (Full ||| resizableTile ||| Mirror resizableTile)
    where
    resizableTile = ResizableTall nmaster delta ratio []
    nmaster = 1
    ratio = toRational (2/(1+sqrt(5)::Double))
    delta = 3/100

terminal' :: String
terminal' = "urxvt"

我对这个文件的编辑太少了,以至于我几乎忘记了从手册页和 haddock 编译中费力挑选所收集到的有关 Xmonad API 的所有内容。是否有 Xmonad API 的优秀文档资源,但不是严格的参考工作?

It sometimes happens that when I mod-L or mod-H in Xmonad my windows don't resize. I believe this is a result of my having accidentally changed the number of windows in my master pane. Sometimes I'm lucky to hit just the right amount of mod-, or mod-. to get back to where I can resize, but not often.

How can I reset a pane to its default values, the ones which Xmonad gives it when starting? My xmonad.hs:

import XMonad
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import System.Exit
import Graphics.X11.Xlib
import IO (Handle, hPutStrLn)

import XMonad.Hooks.ManageDocks
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.SetWMName

import XMonad.Layout.IM
import XMonad.Layout.Reflect
import XMonad.Layout.NoBorders
import XMonad.Layout.ResizableTile
import XMonad.Layout.PerWorkspace
import XMonad.Layout.LayoutHints
import XMonad.Layout.LayoutCombinators hiding ((|||))
import XMonad.Layout.LayoutHints
import XMonad.Layout.NoBorders
import XMonad.Layout.ComboP
import XMonad.Layout.PerWorkspace
import XMonad.Layout.ResizableTile
import XMonad.Layout.Tabbed
import XMonad.Layout.TwoPane
import XMonad.Util.Run (spawnPipe)
import qualified XMonad.StackSet as W
import XMonad.Hooks.ManageHelpers
import XMonad.Layout.NoBorders

main = do
  h <- spawnPipe "/usr/bin/xmobar"
  xmonad defaultConfig
             { workspaces = workspaces'
             , borderWidth = borderWidth'
             , logHook = logHook' h
             , terminal = terminal'
             , modMask = mod4Mask
             , layoutHook = layoutHook'
             , manageHook = manageHook'
             , startupHook = setWMName "LG3D"
             }

customPP :: PP
customPP = defaultPP { ppCurrent = xmobarColor "#AFAF87" "" . wrap "<" ">"
                     , ppTitle =  shorten 80
                     , ppSep =  "<fc=#AFAF87> | </fc>"
                     , ppHiddenNoWindows = xmobarColor "#AFAF87" ""
                     , ppUrgent = xmobarColor "#FFFFAF" "" . wrap "[" "]"
                     }

logHook' :: Handle ->  X ()
logHook' h = dynamicLogWithPP $ customPP { ppOutput = hPutStrLn h }

manageHook' :: ManageHook
manageHook' = composeAll [
  isFullscreen --> doFullFloat
  ]

layoutHook' = customLayout

borderWidth' :: Dimension
borderWidth' = 1

normalBorderColor', focusedBorderColor' :: String
normalBorderColor'  = "#333333"
focusedBorderColor' = "#AFAF87"

workspaces' :: [WorkspaceId]
workspaces' = ["1", "2", "3", "4", "5", "6"]


customLayout = avoidStruts $ layoutHints $ smartBorders (Full ||| resizableTile ||| Mirror resizableTile)
    where
    resizableTile = ResizableTall nmaster delta ratio []
    nmaster = 1
    ratio = toRational (2/(1+sqrt(5)::Double))
    delta = 3/100

terminal' :: String
terminal' = "urxvt"

I edit this file so little that I forget almost everything about Xmonad's API gleaned from laborious picking through the man-pages and haddock compilations between doing so. Is there a fine documentation resource for the Xmonad API that's not a strict reference work?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

喵星人汪星人 2024-12-18 10:25:15

默认情况下,mod+shift+space 会重置您的布局。如果您不喜欢 mod- 和 mod-. 的行为,您可以使用 removeKeysP 从您的配置中删除它们:

import XMonad.Util.EZConfig -- add this line near the top, to the other imports

main = do
  h <- spawnPipe "/usr/bin/xmobar" -- no change here
  xmonad $ defaultConfig -- note the extra ($) here
             { workspaces = workspaces'
             -- etc.
             } `removeKeysP`
             [ "M-,", "M-." ]

我不知道还有比文档中提供的更好的文档源xmonad.org 上的选项卡。

By default, mod+shift+space resets your layouts. If you don't like the behavior of mod-, and mod-., you can delete them from your config using removeKeysP:

import XMonad.Util.EZConfig -- add this line near the top, to the other imports

main = do
  h <- spawnPipe "/usr/bin/xmobar" -- no change here
  xmonad $ defaultConfig -- note the extra ($) here
             { workspaces = workspaces'
             -- etc.
             } `removeKeysP`
             [ "M-,", "M-." ]

I don't know of a better documentation source than what's available on the documentation tab on xmonad.org.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文