blob: af231f06f46712c5f5bbd2bb92cb1db2ceebe86c (
plain)
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
|
#!/usr/bin/env bash
set -euo pipefail
DMENU="${DMENU:-/usr/bin/dmenu}"
SETXKBMAP="${SETXKBMAP:-/usr/bin/setxkbmap}"
LOG_FILE="${XDG_RUNTIME_DIR:-/tmp}/polybar-kb-switch.log"
exec 2>>"$LOG_FILE"
export DISPLAY="${DISPLAY:-:0}"
if [ -z "${XAUTHORITY:-}" ] && [ -r "$HOME/.Xauthority" ]; then
export XAUTHORITY="$HOME/.Xauthority"
fi
choice="$(
printf '%s\n' "us" "us dvorak" "cz" |
"$DMENU" -i -p "Keyboard" \
-b \
-fn "FiraCode Nerd Font-12" \
-nb "#282828" \
-nf "#ebdbb2" \
-sb "#d79921" \
-sf "#282828"
)" || exit 0
case "$choice" in
"us")
"$SETXKBMAP" us
;;
"us dvorak")
"$SETXKBMAP" us -variant dvorak
;;
"cz")
"$SETXKBMAP" cz
;;
esac
|