aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local/bin/swaykbd
blob: d90f78c089167eb5b7eea5d7fc9f6f9aae3f936d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh

swaymsg -r -t get_inputs | \
  grep "xkb_active_layout_name" | \
  awk -F '"' '{print $4}' | \
  sed 's/English (US)/🇺🇸 English/g;s/Spanish/🇲🇽 Español/g;s/Russian/🇷🇺 Русский/g' | head -1

swaymsg \
  --type subscribe \
  --monitor \
  --raw \
  '["input"]' | \
  jq \
    --raw-output \
    --unbuffered \ '
      select(.change == "xkb_layout") |
        .input.xkb_active_layout_name |
        sub(" \\(US\\)"; "")
    ' | \
      sed --unbuffered 's/English/🇺🇸 English/g;s/Spanish/🇲🇽 Español/g;s/Russian/🇷🇺 Русский/g'