allow running find_or_open as standalone

This commit is contained in:
zerf58 2025-06-18 09:27:25 -07:00
parent 847ecd0214
commit fa119a8d4f
3 changed files with 14 additions and 8 deletions

View file

@ -27,16 +27,16 @@ all(){
### top buttons
"main" | "notification" | "settings" | "task_manager" | "search")
echo "no default action assigned to $1"
echo "button all_$1 is no-op"
;;
"browser")
helper_find_or_open firefox
find_or_open firefox
;;
"file_explorer")
helper_find_or_open kodi
find_or_open kodi
;;
"action_center")
helper_find_or_open steam
find_or_open steam
;;
### arrow buttons
@ -56,7 +56,7 @@ all(){
echo "sucessful test"
;;
*)
echo "unexpected action: ${1-}"
echo "button $1 not found"
;;
esac

View file

@ -10,10 +10,12 @@ kodi(){
kodi-send --action="SkipPrevious"
}
split_up(){
xdotool_helper "key p"
sleep .2
xdotool key p
}
move_up(){
xdotool_helper "key o"
sleep .2
xdotool key o
}
search(){
kodi-send --action="VideoLibrary.Search"

View file

@ -1,5 +1,5 @@
#!/bin/bash
helper_find_or_open(){
find_or_open(){
windows=$(wmctrl -l)
if [[ "${windows,,}" == *"$1"* ]]; then
xdotool windowactivate "$(wmctrl -l | grep -i "$1" | cut -d " " -f 1)"
@ -9,3 +9,7 @@ helper_find_or_open(){
echo "opening $1"
fi
}
if [[ ! -z $1 ]]; then
find_or_open $1
fi