This commit is contained in:
zerf58 2025-06-13 16:09:14 -07:00
parent a31e08bd5f
commit 388924ed6e
16 changed files with 951 additions and 294 deletions

79
apps/default_commands.sh Normal file
View 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"
}

7
apps/discord.sh Normal file
View file

@ -0,0 +1,7 @@
discord(){
play(){
sleep .2
xdotool key F12
}
}

74
apps/firefox.sh Normal file
View file

@ -0,0 +1,74 @@
firefox(){
debug "no op for ff on this website"
}
firefox_youtube(){
# fullscreen
split_up(){
xdotool key f
}
search(){
helpers
search
}
play(){
xdotool key k
}
# kiosk
split_right(){
xdotool key F11
}
# go to yt.com in shared container
desktop(){
helpers
firefox 'ext+container:name=shared&url=https://youtube.com'
close_last_tab
}
# open hh container
back(){
helpers
firefox 'ext+container:name=hh&url=https://youtube.com'
close_last_tab
}
# open fr container
forward(){
helpers
firefox 'ext+container:name=fr&url=https://youtube.com'
close_last_tab
}
}
firefox_pbs(){
firefox_init
split_up(){
xdotool mousemove 500 300
xdotool click 1 click 1
}
play(){
xdotool mousemove 500 300
xdotool click 1
}
desktop(){
helpers
home "https://www.pbs.org"
}
}
### helpers
helpers(){
close_last_tab(){
sleep .2
xdotool key ctrl+shift+Tab
sleep .1
xdotool key ctrl+w
}
search(){
sleep .2
xdotool key slash
sleep .2
xdotool key ctrl+a
sleep .2
xdotool key BackSpace
}
}

53
apps/kodi.sh Normal file
View file

@ -0,0 +1,53 @@
kodi(){
play(){
kodi-send --action="PlayPause"
}
forward(){
kodi-send --action="SkipNext"
}
back(){
kodi-send --action="SkipPrevious"
}
split_up(){
xdotool_helper "key p"
}
move_up(){
xdotool_helper "key o"
}
search(){
kodi-send --action="VideoLibrary.Search"
}
desktop(){
kodi-send --action="PreviousMenu"
}
refresh(){
kodi-send --action="UpdateLibrary(video)"
}
notification(){
kodi-send --action="ShowSubtitles"
}
settings(){
kodi-send --action="ActivateWindow(10123)"
for i in {0..3}
do
kodi-send --action="Down"
done
kodi-send --action="Select"
}
fast_forward(){
kodi-send --action="NextPreset"
}
rewind(){
kodi-send --action="PreviousPreset"
}
split_right(){
kodi-send --action="LockPreset"
}
file_explorer(){
kodi-send --action="ActivateWindow(12901)"
}
}

14
apps/spotify.sh Normal file
View file

@ -0,0 +1,14 @@
spotify(){
play(){
sleep .2
xdotool key space
}
forward(){
sleep .2
xdotool key XF86AudioNext
}
back(){
sleep .2
xdotool key XF86AudioPrev
}
}

17
apps/steam.sh Normal file
View file

@ -0,0 +1,17 @@
steam_bp(){
desktop(){
sleep .2
xdotool key alt+Enter
}
}
steam_lp(){
desktop(){
sleep .2
xdotool mousemove 1872 13
sleep .2
xdotool click 1
}
}

8
apps/vncviewer.sh Normal file
View file

@ -0,0 +1,8 @@
vncviewer() {
split_up(){
sleep .5
xdotool key F8
sleep .2
xdotool key F
}
}

9
apps/xfdesktop.sh Normal file
View file

@ -0,0 +1,9 @@
xfdesktop(){
search(){
rofi -modi drun,run -show drun
}
forward(){
xfdesktop -N
}
}