-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
💡 shell script / hook prior the swaylock #503
Comments
So swaylock does have a different layout then the currently selected one? I am a bit confused as to what is going on. |
yes it remains in the last selected layout. In case of Lithuanian - there is national letters at the place of digits, in case of Russian, there is cyrillic letters instead of the latin alphabet |
Do you have a discriminator key configured for switching the keyboard layout, like in our example? That isn't a fix, but could help you. I will take a look later at what is going on there. |
Well, I can't reproduce right now: I have three layouts configured: I switched to |
The thing that I had to replace keyboard switching that you propose to the script based. Due to wayvnc, I wanted to get national languages working, for some reason the wayvnc does not allow to do the keyboard switch (there is issues about this topic in their repository). After the switch I have the only single language in system. What I want is to call a script 'set-us-layout' with before_sleep callback (or to make it usable, to add a option to call any script) ~/.config/sway/config.d/01-keyboard.conf # # Bindings made for wayvnc
# $bindsym $mod+Alt+1 input "type:keyboard" xkb_layout "us(euro)"
# $bindsym $mod+Alt+2 input "type:keyboard" xkb_layout "ru(phonetic_mac)"
$bindsym Ctrl+space exec set-next-layout
$bindsym $mod+Ctrl+space exec set-next-layout set-next-layout: #!/bin/sh
FOCUSED_OUTPUT="$(swaymsg -t get_outputs --raw | jq -r '[.[] | select(.focused == true)][0] | .name')"
CURRENT_LAYOUT="$(swaymsg -t get_inputs --raw | jq -r '[.[] | select(.type == "keyboard")][0] | .xkb_active_layout_name' | awk '{print $1}')"
# KEYBOARD="$(swaymsg -t get_inputs --raw | jq '[.[] | select(.type == "keyboard")][0] | .identifier')"
KEYBOARD="*"
if [ "${FOCUSED_OUTPUT}" = "HEADLESS-1" ]; then
if [ "${CURRENT_LAYOUT}" = "English" ]; then
swaymsg input "${KEYBOARD}" xkb_layout "ru(phonetic_mac)"
else
swaymsg input "${KEYBOARD}" xkb_layout "us(euro)"
fi
else
swaymsg input "${KEYBOARD}" xkb_switch_layout next
fi set-us-layout:
(it is my own specific issue and setup: 2x laptops, iPad, VPS with manjaro-sway), I do working only on VPS |
Couln't you just do both: configure the layouts in sway and use your custom switcher-script? that way layout-switching in swaymsg should just work - on my machine I can switch locales through the discriminator key then. |
Summary
Background:
I use custom keyboard switcher through ~/.config/sway files, mainly because of the wayvnc; to get national languages working with the wayvnc, I had to add some workarounds.
This works fine however if swaylock get triggered while I do use Lithuanian or Russian layout, I can't enter the password.
So I want to call a shell script that switch keyboard to US English prior swaylock
Drawbacks
I do not see any drawbacks for the users: no script, no action
Implementation idea
Update swaylock script to call a shell file in some user directory (i.e. ~/.config/sway/scripts/before_swaylock.sh), if it exists
Will you be able to contribute a PR for this?
The text was updated successfully, but these errors were encountered: