Skip to content

Instantly share code, notes, and snippets.

@lemming
Created October 11, 2013 04:19
Show Gist options
  • Save lemming/6929544 to your computer and use it in GitHub Desktop.
Save lemming/6929544 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
KEYS_BY_ACTION = { next: :Right, prev: :Left, toggle: :space }
action = (ARGV.first || 'toggle').to_sym
action = :toggle unless KEYS_BY_ACTION.has_key? action
unless (window = `xdotool search "Google Play"`[0..-2]).empty?
`xdotool keydown --window #{window} #{KEYS_BY_ACTION[action]}`
else
`mpc #{action}`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment