Last active
January 15, 2019 22:08
-
-
Save tberghuis/2453f622e1b05e2fe507afce2b730582 to your computer and use it in GitHub Desktop.
media play pause
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using xbindkeys and xdotool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"mediapause.sh setmediawindow" | |
Control+Alt+Mod2 + m | |
"mediapause.sh playpause" | |
Alt_R | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# this script is ran from ~/.xbindkeysrc | |
# ctrl + alt + m | |
# save the current active window id | |
if [ "$1" = "setmediawindow" ]; then | |
xdotool getactivewindow > ~/.mediawindowid | |
fi | |
# if r_ALT | |
# send a spacebar to the media window | |
if [ "$1" = "playpause" ]; then | |
MEDIAWID=$(head -n 1 ~/.mediawindowid) | |
CURRENTWID=`xdotool getactivewindow | head -1` | |
xdotool keyup Alt_R windowactivate --sync $MEDIAWID key space windowactivate $CURRENTWID | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment