2023-11-13 16:01:23 +00:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
2023-11-17 16:32:15 +00:00
|
|
|
actions="move
|
|
|
|
fetch-client
|
|
|
|
fetch-channel
|
|
|
|
away
|
|
|
|
not away
|
|
|
|
back"
|
|
|
|
action=$(echo "$actions" | $DMENU)
|
|
|
|
|
2023-11-13 16:01:23 +00:00
|
|
|
|
|
|
|
ts_control_move_self() {
|
2023-11-14 12:31:18 +00:00
|
|
|
channel=$(teamspeak-query-lib channels | $DMENU)
|
|
|
|
if [ -z "$channel" ]; then
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
teamspeak-query-lib move --strict-channel "$channel"
|
|
|
|
return 0
|
2023-11-13 16:01:23 +00:00
|
|
|
}
|
|
|
|
|
2023-11-17 16:32:15 +00:00
|
|
|
ts_control_fetch() {
|
|
|
|
target=$(teamspeak-query-lib "$1s" | $DMENU)
|
|
|
|
if [ -z "$target" ]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
teamspeak-query-lib fetch "--strict-$1" "--$1" "$target"
|
|
|
|
}
|
|
|
|
|
2023-11-13 16:01:23 +00:00
|
|
|
case $action in
|
|
|
|
"move")
|
2023-11-14 12:31:18 +00:00
|
|
|
ts_control_move_self
|
|
|
|
;;
|
2023-11-17 16:32:15 +00:00
|
|
|
"fetch-client")
|
|
|
|
ts_control_fetch client
|
|
|
|
;;
|
|
|
|
"fetch-channel")
|
|
|
|
ts_control_fetch channel
|
2023-11-14 12:31:18 +00:00
|
|
|
;;
|
|
|
|
"not away")
|
|
|
|
teamspeak-query-lib move "Not Away From Keyboard"
|
|
|
|
teamspeak-query-lib update --microphone=false --speakers=false
|
2023-11-13 16:01:23 +00:00
|
|
|
;;
|
|
|
|
"away")
|
2023-11-14 12:31:18 +00:00
|
|
|
message=$(printf "\n" | $DMENU -p "message")
|
|
|
|
if [ -z "$message" ]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
2023-11-13 16:01:23 +00:00
|
|
|
teamspeak-query-lib move "Away From Keyboard"
|
|
|
|
teamspeak-query-lib update --away "$message"
|
|
|
|
teamspeak-query-lib update --microphone=false --speakers=false --away "$message"
|
|
|
|
;;
|
|
|
|
"back")
|
|
|
|
teamspeak-query-lib update --back
|
2023-11-14 12:31:18 +00:00
|
|
|
ts_control_move_self
|
2023-11-13 16:01:23 +00:00
|
|
|
teamspeak-query-lib update --microphone=true --speakers=true
|
|
|
|
;;
|
|
|
|
esac
|