daipeihust / im-select

📟 Switch your input method through terminal
MIT License
996 stars 75 forks source link

sway input method #54

Open whoizit opened 1 year ago

whoizit commented 1 year ago

https://github.com/swaywm/sway

this configuration works for me on Sway:

  "vim.autoSwitchInputMethod.defaultIM": "0",
  "vim.autoSwitchInputMethod.obtainIMCmd": "/home/user/.config/sway/get-im.sh",
  "vim.autoSwitchInputMethod.switchIMCmd": "/home/user/.config/sway/set-im.sh {im}",
  "vim.autoSwitchInputMethod.enable": true,
 ❯ cat ~/.config/sway/get-im.sh
#!/bin/sh
source $(dirname "$0")/.env
swaymsg -t get_inputs | jq -r "[.[] | select(.identifier == \"$KEYBOARD\")][0] | .xkb_active_layout_index"
 ❯ cat ~/.config/sway/set-im.sh
#!/bin/sh
source $(dirname "$0")/.env
swaymsg input "$KEYBOARD" xkb_switch_layout "$1"
 ❯ cat ~/.config/sway/.env
# swaymsg -t get_inputs  
KEYBOARD='6700:8484:SEM_USB_Keyboard'
daipeihust commented 1 year ago

What is sway?

daipeihust commented 1 year ago

Add it to README?