refactor
This commit is contained in:
parent
a31e08bd5f
commit
388924ed6e
16 changed files with 951 additions and 294 deletions
79
apps/default_commands.sh
Normal file
79
apps/default_commands.sh
Normal file
|
@ -0,0 +1,79 @@
|
|||
### 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")
|
||||
echo "no default action assigned to $1"
|
||||
;;
|
||||
"browser")
|
||||
helper_find_or_open firefox
|
||||
;;
|
||||
"file_explorer")
|
||||
helper_find_or_open kodi
|
||||
;;
|
||||
"action_center")
|
||||
helper_find_or_open steam
|
||||
;;
|
||||
|
||||
### 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"
|
||||
;;
|
||||
*)
|
||||
echo "unexpected action: ${1-}"
|
||||
;;
|
||||
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"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue