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

swaymsg -r -t get_inputs | \
  grep "xkb_active_layout_name" | \
  awk -F '"' '{print $4}' | \
      sed --unbuffered 's/English (US)/🇺🇸 EN/g;s/Spanish/🇲🇽 ES/g;s/Russian/🇷🇺 RU/g'| head -1

swaymsg \
  --type subscribe \
  --monitor \
  --raw \
  '["input"]' | \
  jq \
    --raw-output \
    --unbuffered \ '
      select(.change == "xkb_layout") |
        .input.xkb_active_layout_name' | \
      sed --unbuffered 's/English (US)/🇺🇸 EN/g;s/Spanish/🇲🇽 ES/g;s/Russian/🇷🇺 RU/g'