You are not logged in.

#1 2019-03-05 01:34:44

chra
Member
Registered: 2019-01-04
Posts: 46

[SOLVED] Mapped caps to escape but can only exit win switcher with ESC

In my .xinitrc I have mapped my caps key to escape with this command: setxkbmap -option caps:escape.
This works everywhere except the window switcher (Super + Tab). If I want to exit out of that I need to press the ESC key - the caps key does not escape it.

Does anyone know of a way that I can get my remapped caps key to escape from the window switcher in XFCE? It is quite annoying having to reach up to ESC instead of caps for this one thing.

Last edited by chra (2019-03-06 12:38:00)

Offline

#2 2019-03-05 07:44:09

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,600

Re: [SOLVED] Mapped caps to escape but can only exit win switcher with ESC

Please post the ~/.xinitrc
(The cause is most likely that xfwm4 is started before setxkbmap applies - the usual d'oooh for this kind of stuff is that you fork setxkbmap)

Offline

#3 2019-03-05 07:49:46

chra
Member
Registered: 2019-01-04
Posts: 46

Re: [SOLVED] Mapped caps to escape but can only exit win switcher with ESC

seth wrote:

Please post the ~/.xinitrc
(The cause is most likely that xfwm4 is started before setxkbmap applies - the usual d'oooh for this kind of stuff is that you fork setxkbmap)

Thanks for the reply. Here it is:

setxkbmap -option caps:escape
xbindkeys
xrdb -merge ~/.Xresources
feh --bg-scale ~/images/Yosemite-Color-Block.png
export _JAVA_AWT_WM_NONREPARENTING=1
polybar gauss &
exec startxfce4

Last edited by chra (2019-03-05 07:49:58)

Offline

#4 2019-03-05 07:59:15

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,600

Re: [SOLVED] Mapped caps to escape but can only exit win switcher with ESC

Nope.
Does "caps:swapescape"  work? (Be aware that you might loose the escape feature altogether, because esc is now caps)

Offline

#5 2019-03-05 11:54:02

chra
Member
Registered: 2019-01-04
Posts: 46

Re: [SOLVED] Mapped caps to escape but can only exit win switcher with ESC

seth wrote:

Nope.
Does "caps:swapescape"  work? (Be aware that you might loose the escape feature altogether, because esc is now caps)

It does indeed. Thanks. Now I'll need to disable the ESC key though. Unless there's a better way to make this work? There doesn't seem to be a way to disable a key with setxkbmap though?

Last edited by chra (2019-03-05 11:55:44)

Offline

#6 2019-03-05 12:10:17

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,600

Re: [SOLVED] Mapped caps to escape but can only exit win switcher with ESC

The cause is most likely that xfwm only registers one keycode for the escape symbol and that's not the caps code.
You could edit /usr/share/X11/xkb/symbols/capslock and add

key <ESC> { [ VoidSymbol ] };

to the xkb_symbols "escape", but actually this sounds more like a flaw in the xfwm4 implementation.

Another workaround might be to first "caps:swapescape" and "caps:escape" after xfwm4 has started (eg. from an autostart script in xfce or by doing something fragile like

(sleep 10; setxkbmap -option caps:escape) &

in your xinitrc.

Offline

#7 2019-03-05 12:54:19

chra
Member
Registered: 2019-01-04
Posts: 46

Re: [SOLVED] Mapped caps to escape but can only exit win switcher with ESC

First, I was trying to disable the Esc key which now does caps lock. I tried setxkbmap -option caps:none and setxkbmap -option escape:none after running caps:swapescape. Neither did anything. Trying (sleep 10; setxkbmap -option caps:escape) & didn't work either.

Adding key <ESC> { [ VoidSymbol ] }; to swapescape worked. Now I have mapped VoidSymbol, which is now the ESC key, to playerctl play-pause.

Thanks for your help!

Last edited by chra (2019-03-05 20:49:20)

Offline

#8 2019-03-05 20:50:52

chra
Member
Registered: 2019-01-04
Posts: 46

Re: [SOLVED] Mapped caps to escape but can only exit win switcher with ESC

It seems that vim is now not picking up caps as escape. Neither is xbindkeys... xbindkeys doesn't seem to recognize a key, it's just numbers. Any ideas on how to troubleshoot this?

EDIT: xev isn't picking up the caps as escape at all either.

Offline

#9 2019-03-05 21:28:20

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,600

Re: [SOLVED] Mapped caps to escape but can only exit win switcher with ESC

What's the output of "xev -event keyboard" (after pressing caps & esc) and what's the actual current setup? Original xinitrc and altered /usr/share/X11/xkb/symbols/capslock? Paste the latter.
Also try to undo the change and establish the behavior of xev (and vim - do you have fancy remaps for the scape key there?) in the original context.

Offline

#10 2019-03-06 00:18:40

chra
Member
Registered: 2019-01-04
Posts: 46

Re: [SOLVED] Mapped caps to escape but can only exit win switcher with ESC

xev -event keyboard

KeymapNotify event, serial 26, synthetic NO, window 0x0,
    keys:  106 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

KeymapNotify event, serial 26, synthetic NO, window 0x0,
    keys:  106 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

New xinitrc

setxkbmap -option caps:swapescape
xbindkeys
xrdb -merge ~/.Xresources
feh --bg-scale ~/images/Yosemite-Color-Block.png
export _JAVA_AWT_WM_NONREPARENTING=1
polybar gauss &
exec startxfce4

/usr/share/X11/xkb/symbols/capslock

default hidden partial modifier_keys
xkb_symbols "capslock" {
    replace key <CAPS> { [ Caps_Lock ] };
    modifier_map Lock { Caps_Lock };
};

hidden partial modifier_keys
xkb_symbols "shiftlock" {
    replace key <CAPS> { [ Shift_Lock ] };
    modifier_map Shift { Shift_Lock };
};

hidden partial modifier_keys
xkb_symbols "grouplock" {
    replace key <CAPS> { [ ISO_Next_Group, Caps_Lock ] };
};

hidden partial modifier_keys
xkb_symbols "groupshift" {
    key <CAPS> {
        type[Group1] = "PC_ALT_LEVEL2",
        [ Mode_switch, Caps_Lock ]
    };
};

hidden partial modifier_keys
xkb_symbols "swapescape" {
    key <CAPS> { [ Escape ] };
    // Default: key <ESC>  { [ Caps_Lock ] };
    key <ESC> { [ VoidSymbol ] };
};

hidden partial modifier_keys
xkb_symbols "escape" {
    key <CAPS> { [ Escape ] };
};

hidden partial modifier_keys
xkb_symbols "backspace" {
    key <CAPS> { [ BackSpace ] };
};

hidden partial modifier_keys
xkb_symbols "super" {
    key <CAPS> { [ Super_L ] };
    modifier_map Mod4 { <CAPS> };
};

hidden partial modifier_keys
xkb_symbols "hyper" {
    key <CAPS> { [ Hyper_L ] };
    modifier_map Mod4 { <CAPS> };
};

hidden partial modifier_keys
xkb_symbols "menu" {
    key <CAPS> { [ Menu ] };
};

hidden partial modifier_keys
xkb_symbols "numlock" {
    key <CAPS> { [ Num_Lock ] };
};

// This changes the <CAPS> key to become a Control modifier,
// but it will still produce the Caps_Lock keysym.
hidden partial modifier_keys
xkb_symbols "ctrl_modifier" {
    replace key <CAPS> {
        type[Group1] = "ONE_LEVEL",
        symbols[Group1] = [ Caps_Lock ],
        actions[Group1] = [ SetMods(modifiers=Control) ]
    };
    modifier_map Control { <CAPS> };
};

hidden partial modifier_keys
xkb_symbols "none" {
    key <CAPS> { [ VoidSymbol ] };
};

xev without caps:swapescape

KeyRelease event, serial 36, synthetic NO, window 0x3a00001,
    root 0x16a, subw 0x0, time 117223, (93,89), root:(1284,738),
    state 0x2, keycode 66 (keysym 0xffe5, Caps_Lock), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x3a00001,
    root 0x16a, subw 0x0, time 117478, (93,89), root:(1284,738),
    state 0x2, keycode 9 (keysym 0xff1b, Escape), same_screen YES,
    XLookupString gives 1 bytes: (1b) "
    XmbLookupString gives 1 bytes: (1b) "
    XFilterEvent returns: False

Offline

#11 2019-03-06 09:07:28

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,600

Re: [SOLVED] Mapped caps to escape but can only exit win switcher with ESC

Try

hidden partial modifier_keys
xkb_symbols "escape" {
    key <ESC> { [ VoidSymbol ] };
    key <CAPS> { [ Escape ] };
};

instead.

Offline

#12 2019-03-06 12:36:47

chra
Member
Registered: 2019-01-04
Posts: 46

Re: [SOLVED] Mapped caps to escape but can only exit win switcher with ESC

seth wrote:

Try

hidden partial modifier_keys
xkb_symbols "escape" {
    key <ESC> { [ VoidSymbol ] };
    key <CAPS> { [ Escape ] };
};

instead.

Wow. It actually worked! Thanks for all your help.

Offline

Board footer

Powered by FluxBB