Added youtube media controls (next/previous/play-pause)
This commit is contained in:
parent
3e8ca02fa2
commit
0ee3495c4f
24
bin/youtube-media-controls.sh
Executable file
24
bin/youtube-media-controls.sh
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#
|
||||||
|
# Chrome / YouTube only accepts keypresses when window is active
|
||||||
|
#
|
||||||
|
# This activates the YouTube window, sends the keypress, then reactivates the original window
|
||||||
|
#
|
||||||
|
|
||||||
|
xdotool search --name 'YouTube Music' >/dev/null 2>&1 || return 1;
|
||||||
|
|
||||||
|
ACTIVE_DESKTOP="$(xdotool get_desktop)"
|
||||||
|
ACTIVE_WINDOW_ID="$(xdotool getactivewindow)"
|
||||||
|
ACTIVE_WINDOW_NAME="$(xdotool getwindowname $ACTIVE_WINDOW_ID)"
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
next) KEY_COMMAND='j';;
|
||||||
|
prev) KEY_COMMAND='k';;
|
||||||
|
*) KEY_COMMAND='space';;
|
||||||
|
esac
|
||||||
|
|
||||||
|
xdotool search --name 'YouTube Music' windowactivate;
|
||||||
|
sleep 0.05;
|
||||||
|
xdotool key --clearmodifiers "$KEY_COMMAND";
|
||||||
|
|
||||||
|
xdotool set_desktop "$ACTIVE_DESKTOP";
|
||||||
|
[[ "$ACTIVE_WINDOW_NAME" != "Desktop" ]] && xdotool windowactivate "$ACTIVE_WINDOW_ID";
|
@ -35,6 +35,11 @@ bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ to
|
|||||||
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
|
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
|
||||||
|
|
||||||
|
|
||||||
|
bindsym XF86AudioRewind exec --no-startup-id youtube-media-controls prev
|
||||||
|
bindsym XF86AudioForward exec --no-startup-id youtube-media-controls next
|
||||||
|
bindsym XF86AudioPlay exec --no-startup-id youtube-media-controls playpause
|
||||||
|
|
||||||
|
|
||||||
# Use Mouse+$mod to drag floating windows to their wanted position
|
# Use Mouse+$mod to drag floating windows to their wanted position
|
||||||
floating_modifier $mod
|
floating_modifier $mod
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user