Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 730
bitmask Avatar asked Jan 02 '15 12:01

bitmask


People also ask

How to change mod key in xmonad?

xmonad uses 'alt', actually mod1, as the default modifier. You may bind to other mod keys by editing your xmonad. hs modMask value, or by using xmodmap to rebind a key to mod1. The apple command key can be rebound to mod1 in this way.

How do I close apps on Xmonad?

To fully quit xmonad, use mod-shift-q to exit X (don't do that now!).

How do I start Xmonad?

Press Alt+Shift+Enter to launch a terminal. To launch additional terminals, press the Alt+Shift+Enter shortcut again. Xmonad automatically resizes and arranges the windows on screen, tiling them. This is what a “tiling window manager” does.


2 Answers

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)
like image 130
bitmask Avatar answered Oct 18 '22 20:10

bitmask


-- | 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

like image 32
Don Stewart Avatar answered Oct 18 '22 19:10

Don Stewart