Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #VERSION2! Adds in a while loop which requires valid input and only
- #spawns processes if valid input is given.
- #This emulates the play/pause media button after the specified time.
- #This REQUIRES xdotool as well as a player/shell that supports media keys.
- param1=$1
- re='^[0-9]+$'
- while ! [[ $param1 =~ $re ]]
- do
- read -p "Specify time in minutes: " param1
- echo $param1
- done
- if [[ $param1 =~ $re ]]
- then
- (sleep $param1"m" && xdotool key XF86AudioPlay) &
- echo "Pausing playback in $param1 minutes... sleep well!"
- fi
- #the parens run in subshell to suppress output as well as sleep in bg
- #code by Noah B. Rawr.
Advertisement
Add Comment
Please, Sign In to add comment