简体   繁体   English

如何在xmonad中拥有超过9个工作区?

[英]How can I have more than 9 workspaces in xmonad?

I can change the names of workspaces, and presumably simply add more by changing this conststant: 我可以更改工作区的名称,并且可能只是通过更改此常量来添加更多:

myWorkspaces = ["1","2","3⌂","4","5","6","7✉","8☺","9♫"]

If I add something to the array, there will be more workspaces, but how do I keybind them? 如果我向数组添加内容,将会有更多工作空间,但我如何键入它们? Mod-1 through Mod-9 are the default but I can't find documentation for how to change that default. Mod-1到Mod-9是默认设置,但我找不到有关如何更改默认值的文档。

I found the answer buried in this example configuration and together with the key names list , it looks like the following: 我找到了这个示例配置中的答案,并与键名列表一起 ,它看起来如下所示:

Defining a tenth workspace: 定义第十个工作区:

myExtraWorkspaces = [(xK_0, "0"),(xK_minus, "tmp"),(xK_equal, "swap")]

myWorkspaces = ["1","2","3⌂","4","5","6","7✉","8☺","9♫"] ++ (map snd myExtraWorkspaces)

Then the key binding looks like this: 然后键绑定看起来像这样:

myKeys = 
      [ -- ... some more keys ...
      ] ++ [
        ((myModMask, key), (windows $ W.greedyView ws))
        | (key,ws) <- myExtraWorkspaces
      ] ++ [
        ((myModMask .|. shiftMask, key), (windows $ W.shift ws))
        | (key,ws) <- myExtraWorkspaces
      ]

In this example the slash key is used, but any other key from the list above can be used instead. 在此示例中,使用斜杠键,但可以使用上面列表中的任何其他键。

And finally: 最后:

main = do
 xmonad $ config {
           workspaces = myWorkspaces
        } `additionalKeys` (myKeys)
-- | 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]

Modify the length of the list in Config.hs 修改Config.hs中列表的长度

Another way is dynamic workspaces . 另一种方式是动态工作空间 Add

import XMonad.Actions.DynamicWorkspaces
import XMonad.Actions.CopyWindow(copy)

to your xmonad.hs file and add 到你的xmonad.hs文件并添加

, ((modm, xK_v), selectWorkspace myXPConfig)

to the keybindings in that file. 到该文件中的键绑定。 Then pressing mod+v lets you switch to a workspace by name or create it if it doesn't exist. 然后按mod + v可以按名称切换到工作区,如果不存在则创建它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM