the GREAT CONFIG MIGRATION; (scwrypts v5 and some neat new config stuffs)

This commit is contained in:
2025-02-19 21:56:37 -07:00
parent 623828461e
commit 1b70e44700
114 changed files with 330 additions and 328 deletions

33
config/bin/media Executable file
View File

@ -0,0 +1,33 @@
#!/bin/zsh
#####################################################################
USAGE="$0 (next|prev|playpause)"
function ERROR() {
local ERROR_CODE=$1
local MESSAGE="$2"
echo -e "$MESSAGE\n\nUSAGE : $USAGE\n" >&2
notify-send "YouTube media controller" "$MESSAGE"
exit $ERROR_CODE
}
#####################################################################
COMMAND="$1"
case $COMMAND in
next ) COMMAND_KEY='j';;
prev ) COMMAND_KEY='k';;
play ) COMMAND_KEY='space';;
* ) ERROR 1 "unsupported command '$COMMAND'" ;;
esac
xdotool search --name 'YouTube Music' windowactivate \
|| ERROR 2 "YouTube Music is not running"
# Chrome / YouTube only accepts keypresses when window is active
xdotool search --name 'YouTube Music' windowactivate
sleep 0.3
xdotool key --clearmodifiers "$COMMAND_KEY"