-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkb
executable file
·71 lines (64 loc) · 1.28 KB
/
kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/sh
# shellcheck disable=1090,2154
. ~/.cache/wal/colors.sh
blockcolor=$color3
txtcolor=$color0
label=
if [ "$WAYLAND_DISPLAY" ]; then
case $BLOCK_BUTTON in
1) # Left Click
xkblayout-state set +1
;;
2) # Middle Click
xkblayout-state set +1
;;
3) # Right Click
xkblayout-state set +1
;;
4) # Scroll Up
xkblayout-state set +1
;;
5) # Scroll Down
xkblayout-state set -1
;;
esac
current_lang=$(swaymsg -t get_inputs | grep "xkb_active_layout_name" | uniq | awk -F'"' '{print $4}')
if [ "$current_lang" = "English (US)" ]; then
icon=" "
# icon=US
else
icon=" "
# icon=ES
fi
else
case $BLOCK_BUTTON in
1) # Left Click
xkblayout-state set +1
;;
2) # Middle Click
xkblayout-state set +1
;;
3) # Right Click
xkblayout-state set +1
;;
4) # Scroll Up
xkblayout-state set +1
;;
5) # Scroll Down
xkblayout-state set -1
;;
esac
current_lang=$(xkblayout-state print %n)
if [ "$current_lang" = "English" ]; then
icon=" "
# icon=US
else
icon=" "
# icon=ES
fi
fi
printf "\
<b><span foreground='$blockcolor' background='$color0'></span>\
<span foreground='$txtcolor' background='$blockcolor'>%s</span>\
<span foreground='$color0' background='$blockcolor'></span></b>\n" \
" $label $icon"