3

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.

1
  • if you examine the key names in those grp:*_switch options, you'll only see 4 mentioned: ISO_First_Group, ISO_Last_Group, ISO_Next_Group, and ISO_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 and ISO_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.
    – quixotic
    Commented Apr 18, 2018 at 13:53

1 Answer 1

1

You can toggle US to Dansish to Greek by adding :

-layout "us,dk,gr"

Likt this: setxkbmap -model logicordless -layout "us,dk,gr" -option "grp:alt_shift_toggle"

Or edit /etc/X11/xorg.conf.d/90-custom-kbd.conf

Section "InputClass"
    Identifier "Logitech Cordless"
    MatchIsKeyboard   "on"

    Option "XkbModel" "logicordless"
    Option "XkbLayout" "us,dk,gr"
    Option "XKbOptions" "grp:alt_shift_toggle"
EndSection

Ref. https://www.x.org/releases/X11R7.6/doc/xorg-docs/input/XKB-Config.html

1
  • I know that, but I want to be able to temporarily switch layout only while holding a modifier key, like I can currently use caps to temporarily switch to Danish with the command I mentioned in my question.
    – danmou
    Commented Apr 5, 2018 at 23:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .