openSUSE / openSUSEway

dotfiles for Sway on openSUSE
MIT License
82 stars 17 forks source link

localized keyboard maps with gtkgreet #104

Open mcepl opened 1 year ago

mcepl commented 1 year ago

I have this /etc/greetd/sway-config:

# exec "wlgreet --coomand /usr/bin/sway-run.sh ; swaymsg exit"
exec "gtkgreet -l -s /etc/greetd/style.css; swaymsg exit"

bindsym Mod4+shift+e exec swaynag \
    -t warning \
    -m 'What do you want to do?' \
    -b 'Poweroff' 'systemctl poweroff' \
    -b 'Reboot' 'systemctl reboot'

exec /usr/libexec/polkit-gnome-authentication-agent-1

#include /etc/sway/config.d/

My problem is that I need my localized keyboard (cs_CZ.qwerty) to write correctly password. I have correct keyboard when I start in the text mode, and I can switch to the correct keyboard in the final sway session, but greet login prompt is always in the English keyboard.

My system locale are properly set up:

stitny:/etc/greetd # localectl status
System Locale: LANG=cs_CZ.UTF-8
    VC Keymap: cz-qwerty
   X11 Layout: cz
    X11 Model: microsoftpro
  X11 Variant: qwerty
  X11 Options: terminate:ctrl_alt_bksp,grp:shift_toggle,ctrl:nocaps,compose:rctrl
stitny:/etc/greetd # 

This message on the upstream list seems to suggest that the localization is done with configuration file (in our case /etc/sway/config.d/50-openSUSE.conf). That configuration unfortunately includes nothing about the localization of the keyboard maps.

FilippoBonazziSUSE commented 1 year ago

That's an interesting issue.

Correct solution

Ideally the greeter should offer a graphical way to switch keyboard maps, since different users of the system may want to use different keymaps to type their usernames and passwords.

Hack

Since this issue appears before login, it is not correct in principle to fix it by sourcing user configuration. You could of course posit that your system is a single-graphical-user system, and therefore it is acceptable to fix a pre-login graphical environment with a custom user configuration. You could then include /home/mcepl/.config/sway/config.d/10-input.conf (or whatever file contains your xkb_layout definitions) in /etc/greetd/sway-config.

How to do this in a general way for the openSUSEway configuration remains an open question...

Sad remark

In general, using passwords which rely on a non-US keyboard, in settings where you must type the password by hand on a keyboard you don't control, is a headache.

mcepl commented 1 year ago

sway-config.zip

Specifically, my problem is that numbers are on the Czech keyboard in the Shift position. So, yes, I can in fact log in with the US keyboard, but it is mightily inconvenient to use different password for one situation from all others.