You are not logged in.

#1 2018-03-15 21:10:27

maddingl
Member
Registered: 2018-02-18
Posts: 11

[SOLVED] can't combine XkbOptions caps:swapescape and grp:caps_toggle

For a while now, I have been using the XkbOption caps:swapescape and find it quite handy.

I have gotten a us-keyboard now and I would like to be able to switch keyboard layouts (us and de) by pressing Esc.

When I disable caps:swapescape, grp:caps_toggle works perfectly fine. However, both together won't produce the result I want, hitting Esc still results in a normal CapsLock.

What is the best workaround for this?

Last edited by maddingl (2018-03-20 09:14:43)

Offline

#2 2018-03-20 09:11:40

maddingl
Member
Registered: 2018-02-18
Posts: 11

Re: [SOLVED] can't combine XkbOptions caps:swapescape and grp:caps_toggle

If anyone is interested: I have found a solution.

I wrote a little script named "toggle-xkbmap" that I put in $HOME/bin/ :

#!/bin/bash

STATE=$(xkblayout-state print %s)
if [ "$STATE" == "de" ]
then
	setxkbmap us
else
	setxkbmap de
fi

and in my i3config, I have:

...

# toggle keyboard layout
bindsym Caps_Lock exec $HOME/bin/toggle-xkbmap 

...

exec --no-startup-id xkbset nullify lock
exec --no-startup-id setxkbmap -option caps:swapescape

...

the nullify lock is necessary, otherwise, I would always turn on capslock whenever I switch to the not default layout (in my case, german).  I found it on this site.
xkbset is in the AUR.

Offline

Board footer

Powered by FluxBB