2020-04-28 21:21:25 +00:00
|
|
|
#
|
|
|
|
# Chrome / YouTube only accepts keypresses when window is active
|
|
|
|
#
|
2020-10-05 16:48:05 +00:00
|
|
|
# This activates the YouTube window and sends the keypress
|
2020-04-28 21:21:25 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
xdotool search --name 'YouTube Music' >/dev/null 2>&1 || return 1;
|
|
|
|
|
2020-10-05 16:48:05 +00:00
|
|
|
TIMEOUT='0.3';
|
2020-09-15 19:26:28 +00:00
|
|
|
|
2020-04-28 21:21:25 +00:00
|
|
|
case $1 in
|
|
|
|
next) KEY_COMMAND='j';;
|
|
|
|
prev) KEY_COMMAND='k';;
|
|
|
|
*) KEY_COMMAND='space';;
|
|
|
|
esac
|
|
|
|
|
|
|
|
xdotool search --name 'YouTube Music' windowactivate;
|
2020-09-15 19:26:28 +00:00
|
|
|
sleep $TIMEOUT;
|
2020-04-28 21:21:25 +00:00
|
|
|
xdotool key --clearmodifiers "$KEY_COMMAND";
|