I recently decided to switch from i3wm to xmonad. I found this configuration and decided to try it out. The config works without any problem straight out of the box.
The problem is, I cannot switch desktop workspaces, because I don't use english keyboard layout. I have accented characters instead of numbers under F-key row.
So I searched for xK_ names for these keys and put them in to config file like this:
[((m .|. modMask, k), windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [xK_plus, xK_ecaron, xK_scaron, xK_ccaron, xK_rcaron, xK_zcaron, xK_yacute, xK_aacute, xK_iacute]
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
However, this didn't work. So I tried to bind at least one key (according to this answer) to see if that will at least work (with that code above commented out):
, ((0 .|. modMask, xK_plus), windows $ W.greedyView "1")
, ((shiftMask .|. modMask, xK_plus), windows $ W.shift "1")
But it didn't. In both cases, the error message was:
xmonad.hs:292:9: parse error on input â\200\230,â\200\231
Which refers to this line: , ((0 .|. modMask, xK_plus), windows $ W.greedyView "1")
, specifically to |
if I am not mistaken.
When I try
[((m .|. modMask, k), windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [xK_1, xK_2, xK_3, xK_4, xK_5, xK_6, xK_7, xK_8, xK_9]
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
It goes without any problems, however, when I try
, ((0 .|. modMask, xK_1), windows $ W.greedyView "1")
, ((shiftMask .|. modMask, xK_1), windows $ W.shift "1")
The same error is thrown.
I am using Czech QWERTY layout and xmonad 0.12.
Could you please tell me what am I doing wrong? Thanks.
Edit:
Here is minimal config file.
I also made some progress when I was trying my luck with another machine. With
[((m .|. modMask, k), windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [xK_plus, xK_ecaron, xK_scaron, xK_ccaron, xK_rcaron, xK_zcaron, xK_yacute, xK_aacute, xK_iacute]
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
I got different error message which said (for all caron keys):
Not in scope: â\200\230xK_ecaronâ\200\231
Perhaps you meant â\200\230xK_macronâ\200\231 (imported from XMonad)
As the suggested solution is totally different key, I simply proceeded to remove all xK_~caron and it surprisingly compiled. Now I am able to switch workspaces, but switching to 2nd workspace with ý
key which is 7th in the row is kinda strange.
Now i don't understand why aren't caron keys accepted as xK_ecaron is totally valid key:
~ $ cat /usr/include/X11/keysymdef.h |grep ecaron
#define XK_ecaron 0x01ec /* U+011B LATIN SMALL LETTER E WITH CARON */
In your minimal config,
import XMonad
import qualified XMonad.StackSet as W
--bind xK_plus to workspace 1
, ((0 .|. modMask, xK_plus), windows $ W.greedyView "1")
, ((shiftMask .|. modMask, xK_plus), windows $ W.shift "1")
main = xmonad def
{ terminal = "gnome-terminal"
}
...you have bare keybindings in the middle of your file. Those have to appear as part of a keybindings list; the commas are list element separators. So:
main = xmonad def
{ terminal = "gnome-terminal"
, keys = \conf@(XConfig { modMask = modMask }) -> keys def conf `mappend` M.fromList
[ ((0 .|. modMask, xK_plus), windows $ W.greedyView "1")
, ((shiftMask .|. modMask, xK_plus), windows $ W.shift "1")
]
}
(Or similar.)
For your other question, xK_ecaron
is available from Graphics.X11.ExtraTypes.XorgDefault
. You can see a list of all available keysyms (and which module to import to get them) here, or you can search for a specific one on Hoogle.