Add fetch-channel command

This commit is contained in:
Tobias Reisinger 2023-11-17 17:32:15 +01:00
parent 970c1ee2c2
commit 244a7073fe
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
9 changed files with 183 additions and 54 deletions

View file

@ -1,6 +1,13 @@
#!/usr/bin/env sh
action=$(printf "move\nfetch\naway\nnot away\nback" | $DMENU)
actions="move
fetch-client
fetch-channel
away
not away
back"
action=$(echo "$actions" | $DMENU)
ts_control_move_self() {
channel=$(teamspeak-query-lib channels | $DMENU)
@ -11,16 +18,23 @@ ts_control_move_self() {
return 0
}
ts_control_fetch() {
target=$(teamspeak-query-lib "$1s" | $DMENU)
if [ -z "$target" ]; then
exit 1
fi
teamspeak-query-lib fetch "--strict-$1" "--$1" "$target"
}
case $action in
"move")
ts_control_move_self
;;
"fetch")
client=$(teamspeak-query-lib clients | $DMENU)
if [ -z "$client" ]; then
exit 1
fi
teamspeak-query-lib fetch --strict-client "$client"
"fetch-client")
ts_control_fetch client
;;
"fetch-channel")
ts_control_fetch channel
;;
"not away")
teamspeak-query-lib move "Not Away From Keyboard"