Trying to figure out how to enable language switching in Sway. Anybody do this? BTW, I can switch languages from a command line, but what I really want is a shortcut for switching and a waybar icon would also be a plus.
Thanks!
Trying to figure out how to enable language switching in Sway. Anybody do this? BTW, I can switch languages from a command line, but what I really want is a shortcut for switching and a waybar icon would also be a plus.
Thanks!
Ok, I realized that the input file has a commented out section for enabling language switching. I uncommented it, but still not working. Any ideas?
System: Kernel: 6.15.3-arch1-2-surface arch: x86_64 bits: 64 compiler: gcc v: 15.1.1 clocksource: tsc avail: acpi_pm parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-surface root=UUID=e0d7c845-945b-46c6-9caf-3e928efdba5a rw rootflags=subvol=@ loglevel=3 quiet Desktop: Sway v: 0.5.3 with: waybar tools: swayidle avail: xfce4-screensaver vt: 8 dm: LightDM v: 1.32.0 Distro: Garuda base: Arch Linux Machine: Type: Laptop System: Microsoft product: Surface Laptop v: 124000000000000000000000D:F B:0C850001 F:Y C:09 P:C1 S:01 serial: Chassis: type: 9 serial: Mobo: Microsoft model: Surface Laptop serial: part-nu: Surface_Laptop uuid: UEFI: Microsoft v: 138.3732.768 date: 04.20.2021 Battery: ID-1: BAT1 charge: 21.8 Wh (59.6%) condition: 36.6/45.2 Wh (81.0%) power: 6.1 W volts: 7.6 min: 7.6 model: DYN M1005926 type: Li-ion serial: status: discharging cycles: 571 CPU: Info: model: Intel Core m3-7Y30 bits: 64 type: MT MCP arch: Amber/Kaby Lake note: check level: v3 note: check built: 2017 process: Intel 14nm family: 6 model-id: 0x8E (142) stepping: 9 microcode: 0xF6 Topology: cpus: 1x dies: 1 clusters: 2 cores: 2 threads: 4 tpc: 2 smt: enabled cache: L1: 128 KiB desc: d-2x32 KiB; i-2x32 KiB L2: 512 KiB desc: 2x256 KiB L3: 4 MiB desc: 1x4 MiB Speed (MHz): avg: 400 min/max: 400/2600 scaling: driver: intel_pstate governor: powersave cores: 1: 400 2: 400 3: 400 4: 400 bogomips: 12805 Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx Vulnerabilities: Graphics: Device-1: Intel HD Graphics 615 vendor: Microsoft driver: i915 v: kernel arch: Gen-9.5 process: Intel 14nm built: 2016-20 ports: active: eDP-1 empty: DP-1, DP-2, HDMI-A-1, HDMI-A-2 bus-ID: 00:02.0 chip-ID: 8086:591e class-ID: 0300 Display: wayland server: X.org v: 1.21.1.18 with: Xwayland v: 24.1.8 compositor: Sway v: 0.5.3 driver: X: loaded: modesetting alternate: fbdev,intel,vesa dri: iris gpu: i915 display-ID: 1 Monitor-1: eDP-1 model: Panasonic VVX14T092N00 serial: built: 2016 res: mode: 2256x1504 hz: 60 scale: 200% (2) to: 1128x752 dpi: 201 gamma: 1.2 size: 285x190mm (11.22x7.48") diag: 343mm (13.5") ratio: 3:2 modes: 2256x1504 API: EGL Message: EGL data requires eglinfo. Check --recommends. Info: Tools: de: xfce4-display-settings wl: kanshi,swaymsg x11: xdpyinfo, xprop, xrandr Audio: Device-1: Intel Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Imaging Unit driver: ipu3-imgu alternate: ipu3_imgu bus-ID: 00:05.0 chip-ID: 8086:1919 class-ID: 0480 Device-2: Intel CSI-2 Host driver: ipu3-cio2 alternate: ipu3_cio2 bus-ID: 00:14.3 chip-ID: 8086:9d32 class-ID: 0480 Device-3: Intel Sunrise Point-LP HD Audio driver: snd_hda_intel v: kernel alternate: snd_soc_avs bus-ID: 00:1f.3 chip-ID: 8086:9d71 class-ID: 0403 API: ALSA v: k6.15.3-arch1-2-surface status: kernel-api tools: N/A Server-1: sndiod v: N/A status: off tools: aucat,midicat,sndioctl Server-2: PipeWire v: 1.4.7 status: active with: 1: pipewire-pulse status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin 4: pw-jack type: plugin tools: pactl,pw-cat,pw-cli,wpctl Network: Device-1: Marvell 88W8897 \[AVASTAR\] 802.11ac Wireless driver: mwifiex_pcie v: 1.0 pcie: gen: 1 speed: 2.5 GT/s lanes: 1 bus-ID: 02:00.0 chip-ID: 11ab:2b38 class-ID: 0200 IF: wlp2s0 state: up mac: Info: services: NetworkManager, smbd, systemd-timesyncd, wpa_supplicant Bluetooth: Device-1: Marvell Bluetooth and Wireless LAN Composite driver: btusb v: 0.8 type: USB rev: 2.0 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-5:2 chip-ID: 1286:204c class-ID: e001 serial: Report: btmgmt ID: hci0 rfk-id: 0 state: up address: N/A Drives: Local Storage: total: 119.24 GiB used: 23.87 GiB (20.0%) SMART Message: Required tool smartctl not installed. Check --recommends ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: SanDisk model: THNSN0128GTYA TOSHIBA size: 119.24 GiB block-size: physical: 512 B logical: 512 B speed: 15.8 Gb/s lanes: 2 tech: SSD serial: fw-rev: 0AMS0102 temp: 32.9 C scheme: GPT Partition: ID-1: / raw-size: 110.71 GiB size: 110.71 GiB (100.00%) used: 23.87 GiB (21.6%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2 ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%) used: 316 KiB (0.1%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1 ID-3: /home raw-size: 110.71 GiB size: 110.71 GiB (100.00%) used: 23.87 GiB (21.6%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2 ID-4: /var/log raw-size: 110.71 GiB size: 110.71 GiB (100.00%) used: 23.87 GiB (21.6%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2 ID-5: /var/tmp raw-size: 110.71 GiB size: 110.71 GiB (100.00%) used: 23.87 GiB (21.6%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2 Swap: Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default) zswap: no ID-1: swap-1 type: zram size: 3.75 GiB used: 295.8 MiB (7.7%) priority: 100 comp: zstd avail: lzo-rle,lzo,lz4,lz4hc,deflate,842 dev: /dev/zram0 ID-2: swap-2 type: partition size: 8.23 GiB used: 0 KiB (0.0%) priority: -2 dev: /dev/nvme0n1p3 maj-min: 259:3 Sensors: System Temperatures: cpu: 35.0 C pch: 28.5 C mobo: N/A Fan Speeds (rpm): N/A Info: Memory: total: 4 GiB available: 3.75 GiB used: 2.21 GiB (58.9%) Processes: 239 Power: uptime: 2h 1m states: freeze,mem,disk suspend: s2idle wakeups: 1 hibernate: platform avail: shutdown, reboot, suspend, test_resume image: 1.47 GiB services: upowerd Init: systemd v: 257 default: graphical tool: systemctl Packages: pm: pacman pkgs: 1324 libs: 374 tools: octopi,paru Compilers: gcc: 15.2.1 Shell: Bash v: 5.3.3 running-in: alacritty inxi: 3.3.38 Garuda (2.8.2-2): System install date: 2025-08-31 Last full system update: 2025-09-01 Is partially upgraded: No Relevant software: snapper NetworkManager dracut Windows dual boot: No/Undetected Failed units: — System Health Check Report — 22/23 checks run in 1.92 seconds ⌛ Powered by garuda-health 🦅 ✅ System health check passed. No issues found.
Missing information requested in the template may result in not receiving assistance
Make sure you have done the following before you post:
Issue still unresolved? Then:
- After rebooting, post the FULL output of
garuda-inxi
in the body of the post (not linked externally, or collapsed with the “hide details” feature)
- Format terminal output (including your
garuda-inxi
) as a code block by clicking the preformatted text button (</>) , or put three tildes (~) above and below the text
- Format terminal output (including your
garuda-inxi
) as a code block by clicking the preformatted text button (</>) , or put three tildes (~) above and below the text
The commented section is an example. etc/skel/.config/sway/config.d/input · master · Garuda Linux 🦅 / Themes and Settings / Settings / Garuda Sway settings · GitLab
# # Uncomment below to toggle between keyboard layouts.
# # The commented example has the "us" and "gb" keyboard layouts, and uses Alt+Shift to toggle between them.
#
# input "type:keyboard" {
# xkb_layout "us,gb"
# xkb_options "grp:alt_shift_toggle"
# }
#
# # Assign the same binding to "pkill -RTMIN+1 waybar" to send signal to the Waybar keyboard module.
# # The signal refreshes the module. The commented example uses Alt + left Shift.
#
# bindsym Alt+Shift_L exec "pkill -RTMIN+1 waybar"
The xkb_layout
values should be updated according to the layouts you want to be able to toggle between.
You will have to update the example code, unless the keyboard layouts you are trying to set up happen to be the “us” and “gb” keyboard layouts. Paste what you have so far into the thread where we can see it.
Don’t forget to also uncomment the keybinding at the bottom if you want the Waybar to show the currently active keyboard layout in the tooltip of the keyboard module.
So here my edit:
input “type:keyboard” {
xkb_layout “us,ru”
xkb_options “grp:alt_shift_toggle”
}
# Assign the same binding to “pkill -RTMIN+1 waybar” to send signal to the Waybar keyboard module.
# The signal refreshes the module. The commented example uses Alt + left Shift.
bindsym Alt+Shift_L exec “pkill -RTMIN+1 waybar”
Now this last line I didn’t uncomment. It seems like it’s referring to just an Alt put the left Shift? Anyhow, I’ll try it uncommented. (Uncommenting didn’t change anything. And I logged out and back in to be sure the configuration reloaded).
If I issue the command lines for the appropriate lang, I can type in the designated language.:
sway input type:keyboard xkb_layout us
sway input type:keyboard xkb_layout ru
Just realized my paste of my edit above came out on one line. So just edited it.
Make sure you comment out the exec_always
lines above that block which attempt to automatically set keyboard layout based on localectl
output:
# Set keyboard layout and variant based on current system settings
exec_always {
'swaymsg input type:keyboard xkb_layout "$(localectl status | grep "X11 Layout" | sed -e "s/^.*X11 Layout://")"'
'swaymsg input type:keyboard xkb_variant "$(localectl status | grep "X11 Variant" | sed -e "s/^.*X11 Variant://")"'
}
Comment out that whole block, in case it is interfering.
The formatting is all messed up in your post for some reason so I can’t really tell what’s going on. You may be using the WYSIWYG editor; try switching to the markdown one instead.
The block should look like this:
input "type:keyboard" {
xkb_layout "us,ru"
xkb_options "grp:alt_shift_toggle"
}
Or if you are putting it all on one line you need to add semicolons to separate the statements.
input "type:keyboard" { xkb_layout "us,ru"; xkb_options "grp:alt_shift_toggle"; }
After you save the file, don’t forget to reload the Sway config (Super+Shift+C). Then try using the keybinding again.
THAT DID IT! Thanks!!!
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.