我可以更改工作区的名称,并且可以通过更改这个常量来添加更多工作区:
myWorkspaces = ["1","2","3⌂","4","5","6","7✉","8☺","9♫"]
如果我向数组中添加内容,就会有更多的工作区,但是如何为它们绑定键呢?Mod-1到Mod-9是默认设置,但我找不到更改默认设置的文档。
我可以更改工作区的名称,并且可以通过更改这个常量来添加更多工作区:
myWorkspaces = ["1","2","3⌂","4","5","6","7✉","8☺","9♫"]
如果我向数组中添加内容,就会有更多的工作区,但是如何为它们绑定键呢?Mod-1到Mod-9是默认设置,但我找不到更改默认设置的文档。
myExtraWorkspaces = [(xK_0, "0"),(xK_minus, "tmp"),(xK_equal, "swap")]
myWorkspaces = ["1","2","3⌂","4","5","6","7✉","8☺","9♫"] ++ (map snd myExtraWorkspaces)
那么键绑定看起来像这样:
myKeys =
[ -- ... some more keys ...
] ++ [
((myModMask, key), (windows $ W.greedyView ws))
| (key,ws) <- myExtraWorkspaces
] ++ [
((myModMask .|. shiftMask, key), (windows $ W.shift ws))
| (key,ws) <- myExtraWorkspaces
]
在这个例子中使用了斜杠键,但是可以使用上面列表中的任何其他键代替。
最后:
main = do
xmonad $ config {
workspaces = myWorkspaces
} `additionalKeys` (myKeys)
import qualified XMonad.StackSet as W
,并且必须将两个myModMask
替换为modm
。我不确定modm
在哪里定义,但它与其他键绑定中使用的模式匹配。 - Robie Basak-- | The default number of workspaces (virtual screens) and their names.
-- By default we use numeric strings, but any string may be used as a
-- workspace name. The number of workspaces is determined by the length
-- of this list.
--
-- A tagging example:
--
-- > workspaces = ["web", "irc", "code" ] ++ map show [4..9]
--
workspaces :: [WorkspaceId]
workspaces = map show [1 .. 9 :: Int]
修改 Config.hs 中列表的长度
import XMonad.Actions.DynamicWorkspaces
import XMonad.Actions.CopyWindow(copy)
xmonad.hs
文件中:, ((modm, xK_v), selectWorkspace myXPConfig)
在该文件中,您可以设置键绑定。然后按下mod+v,您可以通过名称切换到工作区或创建新的工作区(如果不存在)。