I'm having trouble getting this function to work as I expect.
setScreenAndWorkspace i =
windows (viewOnScreen screenId workspaceId)
where
screenId = ((i-1) `mod` numberOfScreens)
-- workspaceId = show i -- doesn't work for some reason
workspaceId =
case i of
1 -> "1"
2 -> "2"
3 -> "3"
4 -> "4"
5 -> "5"
6 -> "6"
7 -> "7"
8 -> "8"
9 -> "9"
I'm calling the function like so:
myKeys =
[
("M-1" , setScreenAndWorkspace 1),
("M-2" , setScreenAndWorkspace 2),
("M-3" , setScreenAndWorkspace 3),
("M-4" , setScreenAndWorkspace 4),
("M-5" , setScreenAndWorkspace 5),
("M-6" , setScreenAndWorkspace 6),
("M-7" , setScreenAndWorkspace 7),
("M-8" , setScreenAndWorkspace 8),
("M-9" , setScreenAndWorkspace 9)
]
Firstly, show i doesn't seem to do the same as the case i of. I must be misunderstanding some basic Haskell thing; if I use the show i it seems that xmonad can't find any workspace.
The second problem is that the function works, but doesn't always transfer focus. I have to hit the key sequence twice to set the screen, set the workspace, AND set the focus on that workspace.