When playing music on iTunes or similar and then locking the screen (accomplished by hitting the ⌃⌘Q
key combination or selecting "Lock Screen" from the menu), how do I prevent the media keys from functioning?
In particular, the play, skip, and pause buttons are still functional at this point. This is problematic because I tend to lock my screen in order to prevent my cat from wreaking havoc on my laptop when she steps on the keys — but she's still able to mess up my music via the above, usually…
Best Answer
Two solutions:
Solution 1: the aforementioned one to toggle the
Use F1, F2, etc. keys as standard function keys
and then lock the screen via an AppleScript invoked by a system-wide hotkey:Then, the next steps are saving this as an Application, and creating a service in Automator to launch this, and setting a keyboard shortcut for that service.
However, this was too slow and also had the irritating side effect of me having to write another script to un-toggle the
Use F1, F2, etc. keys as standard function keys
setting after logging back in.Solution 2: I ended up using KeyboardCleanTool, which solves the problem more directly by locking all the keys on application startup until one clicks the relevant UI button: