elros34 / sailfish_linux_chroot

GNU General Public License v3.0
20 stars 4 forks source link

How to set ralt_switch as level 3 chooser for xkb? #5

Open Kabouik opened 4 years ago

Kabouik commented 4 years ago

On the F(x)tec Pro¹ running SFOS and current layouts, the level 3 characters in xkb can be selected using the yellow arrow modifier keys, which are set as ralt_switch in kernel. This works great in SFOS, but Ubu chroot interprets that as a regular Alt. Pressing Alt + E for instance will unfold the Edit menu of any menu bar in windows, instead or printing the level 3 character of E on an us-intl layout, é.

On a computer, however, this would be what lalt would do, but ralt would not conflict with global shortcuts and it would therefore select the level characters. Can we do that in XFCE4 and Ubu chroot?

Applications > Settings > Keyboard does not allow selecting a level 3 chooser. I also tried to edit /etc/default/keyboard to add XKBOPTIONS="lv3:ralt_switch", but no success. I tried also to change the key with xmodmap -e "keycode 108 = ISO_Level3_Switch", didn't see any difference.

For reference, here is the left and right yellow arrow keys read in xev:

KeyPress event, serial 37, synthetic NO, window 0x1400001,
    root 0x29c, subw 0x0, time 11953973, (81,106), root:(1072,566),
    state 0x0, keycode 108 (keysym 0xff20, Multi_key), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: True

KeyRelease event, serial 37, synthetic NO, window 0x1400001,
    root 0x29c, subw 0x0, time 11954162, (81,106), root:(1072,566),
    state 0x8, keycode 108 (keysym 0xff20, Multi_key), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False
KeyPress event, serial 37, synthetic NO, window 0x1400001,
    root 0x29c, subw 0x0, time 11953973, (81,106), root:(1072,566),
    state 0x0, keycode 108 (keysym 0xff20, Multi_key), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: True

KeyRelease event, serial 37, synthetic NO, window 0x1400001,
    root 0x29c, subw 0x0, time 11954162, (81,106), root:(1072,566),
    state 0x8, keycode 108 (keysym 0xff20, Multi_key), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False
elros34 commented 4 years ago

So regular xkb nightmare... Remember this is just chroot without anything fancy, so with some effort you can use lxde, kwin or other desktop environment which works best for you. I created it and use mostly for fun as my photon q have too low spec to constantly run chromium in background.

First make sure your x11/xkb dir in chroot is in sync with sfos one. Close and unmount image then remove .xkeyboard_synced file. Next chroot will sync your xkb dir and create ~/.config/autostart/setxkbmap.desktop in chroot (based on your sfos dconf options) which sets xkb options every time xfce is started. This probably could be set in better place so it's executed also when pure chromium is used.

https://github.com/elros34/sailfish_ubu_chroot/blob/master/ubu-common.sh#L72

Kabouik commented 4 years ago

I resynchronized the layout following your instructions, thanks. I can confirm the level 3 is assigned to ralt_switch in the xkb file, but I still have the same issue. Perhaps xfce4 just does the same for lalt and ralt. I could try other DEs now if one allows selecting the level 3 chooser, but I assume this should be possible in xfce4 too, maybe in a config file?

elros34 commented 4 years ago

I really don't know as I don't even use xfce in desktop. I choose it here because it allows to change scaling easly. This is my xkb layout: https://github.com/elros34/sfos-moto_msm8960_jbbl-adaptation/blob/master/sparse/usr/share/X11/xkb/symbols/pl#L72 With this settings "left alt" switch to level 3 in sfos and xfce, "right alt" + key works as F1-F12 in sfos but not in xfce.

I suggest you to try kwin + libhybris acceleration. It doesn't renders correctly since few releases in my ancient device but I guess it may works correctly in fxtec pro1. Beware it will work in portrait mode unless you use it together with qxcompositor similar to how it's done for xfce.

Kabouik commented 4 years ago

xfce4 is a nice choice I think, it's both lightweight and configurable. I tried installing kwin and libhybris using ubu-install.sh but afterwards Ubu chroot failed to open any XWayland window, and I could not start Ubu with Kwin either, so I deleted my Ubu chroot folder and restarted from scratch.

I am trying to understand how your left_alt is recognized as level 3 chooser and not global hotkey for application menu bars. So far I have not found what makes the difference with the modifier key on the xkb layout I use on my device.

Kabouik commented 4 years ago

Short follow-up on this: I've tried adding -option lv3:ralt_switch through dconf in SFOS, restarted Lipstick, resynchronized Ubu chroot (and checked setxkbmap.desktop, confirmed), and the Right Alt key still acts as AltGr (level 3 chooser) in SFOS but no change in Chroot, it still behaves as regular Alt, and hence calls windows' menu bars.

I don't think it is an issue with chroot iself since it works on your end, probably just something missing in our xkb files on the Pro¹, but haven't managed to pinpoint exactly what part of your layout we need to add to ours to make it work.

enigma9o7 commented 4 years ago

I'd also like to see the level three characters, particularly because that's where I have slash and question mark, which are fairly important :) For me the Fn key seems to behave as left alt, not right alt, even when I choose a keyboard layout in xfce that should support it within xfce, but not sure how that relates back to sfos...