DreymaR / BigBagKbdTrixXKB

"DreymaR's Big Bag of Keyboard Tricks" for *nix with XKB
MIT License
200 stars 39 forks source link

Extend and backspace issues with Linux in most applications #36

Closed maluhia closed 11 months ago

maluhia commented 1 year ago

I am having trouble getting extend to work with curl angle dh. I run ./setkb.sh 4ca and get:

¤ ShortStr model/layout: pc104angle / us(cmk_ed_us)
¤ ShortStr lay. options: Curl(DH) - 'y'; Sym - 'n'.

¤ Changing dir to '/usr/share/X11/xkb'
¤ Looking for and removing any old .xkm server files
¤ Running setxkbmap command using the system XKB dir:

> setxkbmap -model pc104angle -layout us(cmk_ed_us) -option misc:extend,lv5:caps_switch_lock,grp:shifts_toggle,compose:menu,misc:cmk_curl_dh -v 9

Setting verbose level to 9
locale is C
Warning! Multiple definitions of keyboard model
         Using command line, ignoring X server
Warning! Multiple definitions of keyboard layout
         Using command line, ignoring X server
Trying to load rules file ./rules/evdev...
Success.
Applied rules from evdev:
rules:      evdev
model:      pc104angle
layout:     us(cmk_ed_us)
options:    misc:extend,lv5:caps_switch_lock,grp:shifts_toggle,compose:menu,misc:cmk_curl_dh
Trying to build keymap using the following components:
keycodes:   evdev(pc104angle)+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+us(cmk_ed_us)+inet(evdev)+group(shifts_toggle)+compose(menu)+level5(caps_switch_lock)+extend(basic)+colemak(cmk_ed_dh)
geometry:   pc(pc104angle)

¤ Changing dir to '/home/user/git/BigBagKbdTrixXKB'

@@@ setkb.sh finished! @@@

which looks fine but extend backspace doesn't work in kde applications or konsole, but works fine in chrome. The arrow extend keys work everywhere though. I also tried to add the colemak layout via kde GUI keyboard settings but activating extend in the advanced tab completely disables ALL backspace features.

Having this be more compatible with KDE Keyboard gui would help greatly when swapping layouts and changing settings for casual users!

Sidenote but this k to m swap is milling ke haha! Need to retrain my muscle memory!

DreymaR commented 1 year ago

I'm really not sure as to why KDE doesn't quite respect the XKB settings. Could it be that KDE has its own setting for Backspace behavior?

maluhia commented 1 year ago

It my Keyboard Settings advanced tab, I have two options selected:

Compatibility options->Enable level5 Extend mappings (home position arrows etc) Key to choose 5th level->Caps Lock chooses 5th level

I see what is going on now. When I hold Caps and press the extend backspace key, it interprets it as "Pause" when setting a custom shortcut... but in the Keyboard preview pane, it correctly show as triggering the backspace key. I suppose the KDE apps all think I am hitting Pause! Not sure what to do now.

DreymaR commented 12 months ago

Why not just disable the Backspace mapping in the symbols/extend file?

maluhia commented 12 months ago

I like the way backspace is in Extend though, with holding caps and pressing the key to the right of the Extend arrow keys. That is doesn't work in non-chrome apps means it is a KDE issue, right?

DreymaR commented 12 months ago

What I mean is, the Extend mapping for the physical Backspace key should be Pause. Try disabling that. I could seem like KDE is redirecting the generated Backspace press so it gets re-interpreted as a Pause?

Another thing I could do is to check whether the level5 modifier is removed. Ideally it should always be, I guess, but in most cases things work without doing that explicitly.

maluhia commented 12 months ago

I see, I tried to disable those backspace mappings as you suggested and reapplied the keyboard settings but it didnt work. I am not very savvy when it comes to x11 configurations so I think i'll just rely on my Input remapper solution: https://github.com/sezanzeb/input-remapper If anyone comes along with KDE and tries to use Extend backspace, perhaps they'd be better suited to diagnose the issue...

DreymaR commented 12 months ago

It is a conundrum at this point. I checked the file, and clearmods=LevelFive is applied to the key with Backspace on its Extend layer (Colemak O) as it should be. Maybe KDE somehow doesn't respect that clear? If it doesn't, then conceivably it could send Extend+Backspace which is Pause (as that's the level5 mapping for that key) instead of a pure Backspace when pressing Extend+O.

However, removing the Extend definition for the Backspace key itself should solve that issue. Otherwise, there would be no reason for Pause to be sent after pressing Extend+O. Maybe you didn't do it quite right, somehow? I advise using the setkb.sh script, as that has a cache clearing built in.

maluhia commented 12 months ago

Alright, that solved it. Not sure if I did it correctly but I commented out lines 261-271 in the xkb-data_xmod/xkb/symbols/extend file, reinstalled with ./install-dreymar-xmod.sh, and selected the colemak layout angle Z in KDE keyboard settings hardware tab, added the colemak dh layout in the layout tab, and Selected "Enable level5 extend mappings, caps lock is a level 5 modifier" in the Advanced tab. It works now, KDE no longer sees it as Pause. Thanks! Wonder if you can account for this in the script somehow for other KDE users.

DreymaR commented 12 months ago

You're right. I've turned off Extend-mapping for both the Backspace and Return/Enter keys by default.

I did it by putting those two keys over in a new partial group, and not including it by default. Same as I've done with the FK## keys, as many users didn't like how Extend-mapping the F-keys broke their TTY shortcuts.

Could you please test that the latest commit works as it should for you?

maluhia commented 11 months ago

works!