Switching workspaces in xmonad using the programmer's dvorak keyboard linker (shifted numbers)

Well, I donโ€™t use Dvorak at all, but Neo2 , but since I use a matrix-type keyboard ( Truly Ergonomic ) I also moved the numbers.

Therefore, this construct in my xmonad.hs does not work ergonomically:

 -- mod-[1..9], Switch to workspace N -- mod-shift-[1..9], Move client to workspace N -- [((m .|. modMask, k), windows $ fi) | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9] , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)] 

I want to change this to access workspaces 1 through 9 using the keys from 2 to 0.

How could I achieve this? I tried changing the third line to

  | (i, k) <- zip (XMonad.workspaces conf) [xK_2 .. xK_0] 

but then I was not able to access the 9th workspace. How can I change this? A short explanation would be nice, therefore, to learn something about this design (I learned Haskell many years ago and forgot most of this).

+8
haskell keyboard ergonomics xmonad
source share
1 answer

Your problem is that xK_2 larger than xK_0 , so the list [xK_2 .. xK_0] empty:

 Prelude XMonad> xK_2 50 Prelude XMonad> xK_0 48 Prelude XMonad> [xK_2 .. xK_0] [] 

You will need to use a longer list. There are at least two reasonable ways to do this; you just need to specify all the keys yourself:

 Prelude XMonad> [xK_2, xK_3, xK_4, xK_5, xK_6, xK_7, xK_8, xK_9, xK_0] [50,51,52,53,54,55,56,57,48] 

What I would use is a little shorter:

 Prelude XMonad> [xK_2 .. xK_9] ++ [xK_0] [50,51,52,53,54,55,56,57,48] 

Remember to add some parentheses if they are part of a larger expression.

+8
source share

All Articles