I am currently able to temporarily switch my keyboard layout from US to Danish while holding caps, and toggle permanently using alt+space, with the following command:
setxkbmap -option "grp:caps_switch,grp:alt_space_toggle" -layout "us,dk"
However, I would like to also be able to switch to Greek layout by holding another modifier, preferably AltGR (my physical keyboard layout is Danish, so it has AltGr), but I can't find a way to do it using setxkbmap
. It seems like the grp:*_switch
options always switch between the first two layouts. Is this even possible with setxkbmap
? Or is there some other tool that will allow me to do it?
Edit: Since what I want doesn't seem to be possible with existing tools, I instead created a custom keyboard layout that has both the Greek letters and the Danish special letters on the 3rd and 4th layers (normally accessed with AltGr and AltGr+shift). I then assigned both caps lock and AltGr as 3rd layer modifiers. This solution was only possible because there happened to be no overlap between the Danish and Greek keys that I needed so I could fit them on the same layer. If anyone is reading this and wants to be able to switch between three different full layouts, I think that would also be possible by adding a 5th keyboard layer.
grp:*_switch
options, you'll only see 4 mentioned:ISO_First_Group
,ISO_Last_Group
,ISO_Next_Group
, andISO_Prev_Group
. looking at keysym names in/usr/include/xkbcommon/xkbcommon-keysyms.h
, that's all we get to work with. you want additional keys (ISO_Group_2
andISO_Group_3
), but equivalent keysyms aren't available. you might be able to repurpose other keysyms to perform the functions you want -- see/usr/share/X11/xkb/compat/iso9995
to see how the existing keys function.