Skip to content

Instantly share code, notes, and snippets.

@slikts
Last active December 23, 2015 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slikts/6663742 to your computer and use it in GitHub Desktop.
Save slikts/6663742 to your computer and use it in GitHub Desktop.
Toggle play/pause with window selection
; Bind Ctrl+Win+Space to select the video window for toggling.
; If it's a browser window and the video player is Flash (it most commonly is),
; then the player itself needs to be focused by clicking on the player.
; If the player is not focused the page will likely just get
; scrolled down without play/pause being toggled.
; I've made a Chrome extension to focus the YouTube player automatically: http://bit.ly/1gPHwI8
^#space:: WinGet, winid ,, A
; Bind Win+Space to send the Space keystroke to the selected window.
; This will only work if the player supports a Space hotkey for toggling play/pause.
; You can replace {Space} with {Right} to turn a page, for example.
; A list of all possible keystrokes can be found here: http://autohotkey.com/docs/commands/Send.htm
#space:: ControlSend,, {Space}, ahk_id %winid%
; This document explains how the Ctrl+Win+Space and Win+Space
; hotkeys can be customized: http://autohotkey.com/docs/Hotkeys.htm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment