-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdiscord_voice.spell
More file actions
executable file
·44 lines (40 loc) · 963 Bytes
/
Copy pathdiscord_voice.spell
File metadata and controls
executable file
·44 lines (40 loc) · 963 Bytes
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
#!/bin/sh
# Change discord voice channel with dmenu
die() {
notify-send -u critical "$1"
printf "\033[1;31m%s\033[0m\n" "$1"
exit 1
}
list="
🍵 O meu chá
💦 ~~ 𝒜𝑔𝓊𝒾𝓃𝒽𝒶 ~~
✔ General ~
📽Movie Tiiiim
Taberna
Disconnect
"
list="$(echo "$list" | grep -v '^$')"
if [ "$DISPLAY" ]; then
ch=$(echo "$list" | picker -p channel -i -l "$(echo "$list" | wc -l)")
else
export DISPLAY=:0
printf "%s\nOther" "$list" | nl
printf "channel number? "
read -r REPLY
ch=$(echo "$list" | sed -n "${REPLY}p")
if [ -z "$ch" ]; then
printf "channel name: "
read -r ch
fi
fi
[ "$ch" ] || exit
current=$(xdotool getwindowfocus)
WID=$(xdotool search --class discord | tail -n 1)
[ "$WID" ] || die 'Discord not running'
xdotool windowfocus --sync "$WID"
xdotool key --window "$WID" "ctrl+k"
sleep 0.5
xdotool type --window "$WID" "!$ch"
sleep 0.5
xdotool key Return
xdotool windowfocus "$current"