For instance, 81 will also insert an equal-sign, but 82 enters a zero ( 0) - both of which correspond to the key codes in the link above. And interestingly enough, when I run the script, an equal-sign ( =) is inserted wherever the live cursor is.
#HOW TO SET B VOLUME KEYS ON MAC KEYBOARD CODE#
Tell application "System Events" to key code 72 using Otherwise, a simple AppleScript could have forced the single key press into the 3-key combo: I cannot find the link right now, but it seems that macOS Sierra is not working with the special-function key codes. The weird question-mark-looking symbol is the exact same when viewing the value in XCode. The screenshots above were taken from PlistBuddy in terminal. Note: Key Code 71 and 72 are for Volume Down and Volume Up special function keys, respectively. I went into ~/Library/Preferences/pbs.plist, and tried to change the key manually, from When I go try to use the Volume Up/Down keys to set the shortcut, it just changes the volume, without registering the key pressed. Still cannot bind special-function keys to service Set vol to output volume of (get volume settings)ĭo shell script "afplay /System/Library/Sounds/Pop.aiff"Īnd then you can bind a hotkey to it in System Preferences (refer to original question). The services are a single Run AppleScript within the workflow.
I was able to use Automator to create a couple services, that change the volume in increments of 1%. This means the default volume change is around 6% per level. The volume is set as an integer value, out of 100. The default volume control has 17 levels (with the 17th being zero). Thanks in advance! EDIT #1 - Some Progress I'm fine using this method, but what would I enter for the Menu Title to refer to the fine-adjustment volume control? Also, when I've tried to do this (just tried it now), when I place the cursor in the Keyboard Shortcut box and press the Volume Up/Down buttons, it just changes the volume, instead of populating the input with the key pressed.Ī custom script (Bash, AppleScript, other), modifying a system file hiding somewhere, or whatever you've got - I'll take it! Nothing alluding to setting it as the default behavior.Īs for remapping the keys, I keep coming up with only a couple methods:Ĭreating custom shortcuts in System Preferences I'd link to them - to prove my due-diligence before asking a question - but they're all the same as the one I linked above.
#HOW TO SET B VOLUME KEYS ON MAC KEYBOARD HOW TO#
So far, all I've been able to find are links telling me how to fine-tune the volume (by pressing the 3-key combo). Having to press the fn key to control music playback, or change my screen brightness, is not an acceptable compromise to have the desired volume behavior. I use all of the other special feature keys often. I do not want to override the F11 and F12 keys - I want to override the Volume Up and Volume Down keys. There are many reasons for not wanting TPS, but mostly I like to roll my own (when I can), and don't want an entire app for one single change.Ĭannot have Use all F1, F2, etc. If a TPS can remap the keys on my system, or intercept key presses and perform tasks, then a well-written AppleScript or BashScript can do the same. With the aforementioned end-goal, Imma nitpick a little. I press one key ( Volume Up/Down), but the system sees that I've pressed the three-key combo!
Mimic Option(Alt)+Shift+Volume Up/Down being pressed I'd like to remap / intercept / override the behaviour of the Volume Up/Down keys to either:Īutomatically adjust the volume in 1/4 incrementsĪ setting, file or script that I could write or modify to set this as default behaviour would be ideal! But! The key combo Option(Alt)+Shift+Volume Up/Down will change the volume in 1/4 increments. The current behavior for the Volume Up/Down keys is to adjust the system volume in whole increments.