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

时间:2011-10-21 23:49:34

标签: haskell xmonad

有时候,当我在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"

我编辑这个文件的次数很少,以至于我几乎忘记了关于Xmonad的API的所有内容,这些API都是通过人工编辑和编辑之间的编辑来完成的。 Xmonad API是否有一个很好的文档资源,这不是一个严格的参考工作?

1 个答案:

答案 0 :(得分:6)

默认情况下,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上的文档选项卡上提供的更好的文档源。