2025-06-13 16:09:14 -07:00
|
|
|
### if no specific commands found run these
|
|
|
|
|
|
|
|
all(){
|
|
|
|
case $1 in
|
|
|
|
### navigation etc.
|
|
|
|
"play")
|
|
|
|
sleep .3
|
|
|
|
xdotool key space
|
|
|
|
;;
|
|
|
|
"fast_forward")
|
|
|
|
sleep .2
|
|
|
|
xdotool key Right
|
|
|
|
;;
|
|
|
|
"rewind")
|
|
|
|
sleep .2
|
|
|
|
xdotool key Left
|
|
|
|
;;
|
|
|
|
"forward" | "back" | "split_up" | "split_down")
|
|
|
|
debug "no op"
|
|
|
|
;;
|
|
|
|
"split_right")
|
|
|
|
bluetoothctl disconnect 4C:B9:9B:11:4B:31
|
|
|
|
;;
|
|
|
|
"split_left")
|
|
|
|
toggle_res
|
|
|
|
;;
|
|
|
|
|
|
|
|
### top buttons
|
|
|
|
"main" | "notification" | "settings" | "task_manager" | "search")
|
2025-06-18 09:27:25 -07:00
|
|
|
echo "button all_$1 is no-op"
|
2025-06-13 16:09:14 -07:00
|
|
|
;;
|
|
|
|
"browser")
|
2025-06-18 09:27:25 -07:00
|
|
|
find_or_open firefox
|
2025-06-13 16:09:14 -07:00
|
|
|
;;
|
|
|
|
"file_explorer")
|
2025-06-18 09:27:25 -07:00
|
|
|
find_or_open kodi
|
2025-06-13 16:09:14 -07:00
|
|
|
;;
|
|
|
|
"action_center")
|
2025-06-18 09:27:25 -07:00
|
|
|
find_or_open steam
|
2025-06-13 16:09:14 -07:00
|
|
|
;;
|
|
|
|
|
|
|
|
### arrow buttons
|
|
|
|
"desktop")
|
|
|
|
debug "no op"
|
|
|
|
;;
|
|
|
|
"tasks")
|
|
|
|
debug "no op"
|
|
|
|
;;
|
|
|
|
|
|
|
|
"sleep")
|
|
|
|
sh ~/scripts/PJ/cec.sh
|
|
|
|
;;
|
|
|
|
### test
|
|
|
|
"test")
|
|
|
|
#test code here, run with buttons.sh test
|
|
|
|
echo "sucessful test"
|
|
|
|
;;
|
|
|
|
*)
|
2025-06-18 09:27:25 -07:00
|
|
|
echo "button $1 not found"
|
2025-06-13 16:09:14 -07:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
toggle_res(){
|
|
|
|
display=$(xrandr --listmonitors | grep -o '\S*$' | tail -n 1)
|
|
|
|
current_res=$(xrandr | grep "$display" | grep -o '[0-9]*x[0-9]*' | head -n 1)
|
|
|
|
res_1080p="1920x1080"
|
|
|
|
res_4k="3840x2160"
|
|
|
|
|
|
|
|
if [ "$current_res" = "$res_1080p" ]; then
|
|
|
|
target_res="$res_4k"
|
|
|
|
elif [ "$current_res" = "$res_4k" ]; then
|
|
|
|
target_res="$res_1080p"
|
|
|
|
fi
|
|
|
|
|
|
|
|
debug "Switching to: $target_res"
|
|
|
|
xrandr --output "$display" --mode "$target_res"
|
|
|
|
}
|