Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ext + Q not registering as Escape #14

Open
zkf opened this issue Jan 21, 2021 · 6 comments
Open

Ext + Q not registering as Escape #14

zkf opened this issue Jan 21, 2021 · 6 comments
Labels
bug Entomology, please! help wanted Anyone?

Comments

@zkf
Copy link

zkf commented Jan 21, 2021

Hi Øystein

I’ve used your angle-wide layout for years and I am totally addicted to it!. Colemak is so great and your modifications make it even greater.

It’s great that you added the TTYs on Ext+AltGr; I don’t think Ctrl+Alt+Fx ever worked for me for some reason.

I’ve been using the version from around 2014 I think, where the Ext+Q combination works as Escape. As a frequent Vim user this has been very useful to me. But I couldn’t get this to work in newer versions. I was excited to see in the commit log that you tried to fix this issue lately, but it is still not working for me. If there’s anything I can do to help troubleshoot this issue, please let me know.

Just so you know, I’m loading the keyboard layout in a particular way, like this (I’ve copied the xkb directory to /usr/local/share/X11, but I don’t think the way you load it should have any effect on the outcome):

cd /usr/local/share/X11/xkb
setxkbmap \
  -rules evdev \
  -model pc105aw-sl \
  -layout no \
  -variant cmk_ed_us \
  -option '' \
  -option misc:extend \
  -option lv5:caps_switch_lock \
  -print \
  | xkbcomp -I -I/usr/local/share/X11/xkb -I/usr/share/X11/xkb - $DISPLAY

Thanks again for your great work!

@DreymaR
Copy link
Owner

DreymaR commented Jan 22, 2021

Hei Bjørnar! ( のvの) c[_]

Thanks for the praise! And for useful info. I'm sorry the Ext+Q mapping still doesn't work. I'll look into this. I think the 2015 code at least had the same mapping as up until now, so the problem may stem from changes to the XKB interpreter.

Out of curiosity, why do you set the layout in this particular way? It looks to me as if you copy the X11/xkb directory to somewhere else and use the xkbcomp command to use it? This should be a safer way of using my files, but I never got it to work before. Looks like you can use the -I for xkbcomp twice, that's useful!

Would this work, then?

  • Copy the xkb-data_mod/xkb dir to, say, /usr/local/share/bigbag/xkb // [are there any rules for where to use?]
  • setenv MYXKB "/usr/local/share/bigbag/xkb" // [Not necessary, only if you want to keep track of it]
  • setxkbmap -print | xkbcomp -I -I$MYXKB -I/usr/share/X11/xkb - $DISPLAY

[edit:] Okay, I think I may have found the culprit. I updated the Ext+LeftBracket mapping which is also Esc, but not the Ext+Q one. Will push a new commit shortly, please test it for me?

@zkf
Copy link
Author

zkf commented Jan 26, 2021

Yes that is exactly what I did, I don’t want to modify the system files because they are overwritten whenever XKB receives updates. After a long time I found this solution. I think this is how it works: setxkbmap searches for the rules file in the current directory first, so it is picked up instead of the one in /usr/share/X11/xkb (it even tells you so, if you pass it -verbose 9), Then with the -print option it does not apply the configuration, it just prints it. Otherwise setxkbmap would try to use the other files in the system directory anyway. I pipe this to xkb, clearing the default include path with the empty -I argument, then I include the current path, with fallback to the system default.

Oh, -I/usr/local/share/X11/xkb can be written more succinctly as -I., because you already cd’ed into this directory.

One problem I’m having with this is that the layout can be reset by replugging USB devices, or switching to a different TTY and back. It may be my desktop environment, KDE, is a bit too eager with applying configurations. I’m not sure yet.

I think you can keep the XKB files wherever you choose.

I just tested the latest commit. Unfortunately, Ext+Q is still not doing anything. Well, it looks like it’s registering as Escape in xev, but nothing happens when I test it in the terminal emulator or vim.

@DreymaR
Copy link
Owner

DreymaR commented Jan 31, 2021

I have removed the level5 modifier from Ext+Q so it should no longer register as both Esc and Caps but only as Esc. So for some people it did two things, which was one too many. If the combo does nothing for you, I'm really not sure why that could be...? Sorry. ᏊᵕꈊᵕᏊ

@zkf
Copy link
Author

zkf commented Feb 2, 2021

Okay, so I just tested nvim in two different terminal emulators. And to my surprise, in xterm the Ext+Q combo works as Escape! However, it does not work in kitty, nor in Konsole/Yakuake which I use normally.

Separately, I looked at the output from xev and noticed that pressing and releasing the caps lock key registers as KeyPress … ISO_Level5_Shift and KeyRelease … ISO_Level5_Lock, respectively:

KeyPress event, serial 38, synthetic NO, window 0x8400001,
    root 0x1a3, subw 0x0, time 38468792, (2713,1136), root:(2713,1446),
    state 0x0, keycode 66 (keysym 0xfe11, ISO_Level5_Shift), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 41, synthetic NO, window 0x8400001,
    root 0x1a3, subw 0x0, time 38468856, (2713,1136), root:(2713,1446),
    state 0x20, keycode 66 (keysym 0xfe13, ISO_Level5_Lock), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

This seemed suspicious so I replaced some occurences of ISO_Level5_Lock in order to make this output consistent, but this made no difference to the Ext+Q situation.

One final thing which may be related: Pressing the Caps lock key performs a paste from the clipboard in certain KDE applications (maybe all?), but not in GTK based ones like Firefox.

I can upload the XKB file generated by xkbcomp, if that helps in any way?

@zkf
Copy link
Author

zkf commented Feb 2, 2021

stdin.xkb

@DreymaR
Copy link
Owner

DreymaR commented Feb 2, 2021

Whether the Lock or Shift is released shouldn't matter. I believe the Lock overrides and includes the Shift anyway. And the Level5 shift state should be removed with the key press action for this to work (which is what the bug I fixed was about, you know).

The Caps-Paste thing has been mentioned before I think. It's a bit of a mess if I understand it right.

I'm no further to an answer to your problem, unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Entomology, please! help wanted Anyone?
Projects
None yet
Development

No branches or pull requests

2 participants