Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Determine current state of Full Keyboard Access

I'm looking for a way to determine the current state of Full Keyboard Access, via a script or application. Any ideas?

Mac mini, Mac OS X (10.6.8)

Posted on Jun 6, 2012 7:14 PM

Reply
Question marked as Best reply

Posted on Jun 6, 2012 8:12 PM

This took a little investigation since I didn't know what "Full Keyboard Access" meant. Googling said control-F1 togged the mode. I could not find any keyboard or universal access that corresponded to control-F1. But I did see that com.apple.universalaccess.plist changed when I toggled control-F1.


Comparing com.apple.universalaccess.plist's with control-F1 toggled both ways showed that there is an array key called UserAssignableHotKeys in the plist. It contains five items for five keys. Each of these five items has a bool enabled key.


After yet more checking I found what those 5 keys correspond to the Keyboard Shortcuts, Keyboard&Text Input. I won't list them here. You can see for yourself by bringing up that preference window and pressing control-F1.


So that means you should be able to inquire the settings via a shell script using defaults read.


Need to do some experimentation to determine the exact syntax.


-------


Update:

Check that. It was what I decribed above. Now the array is not there. Those keybard keys do change as descibe. Stay tuned...

8 replies
Question marked as Best reply

Jun 6, 2012 8:12 PM in response to garyes

This took a little investigation since I didn't know what "Full Keyboard Access" meant. Googling said control-F1 togged the mode. I could not find any keyboard or universal access that corresponded to control-F1. But I did see that com.apple.universalaccess.plist changed when I toggled control-F1.


Comparing com.apple.universalaccess.plist's with control-F1 toggled both ways showed that there is an array key called UserAssignableHotKeys in the plist. It contains five items for five keys. Each of these five items has a bool enabled key.


After yet more checking I found what those 5 keys correspond to the Keyboard Shortcuts, Keyboard&Text Input. I won't list them here. You can see for yourself by bringing up that preference window and pressing control-F1.


So that means you should be able to inquire the settings via a shell script using defaults read.


Need to do some experimentation to determine the exact syntax.


-------


Update:

Check that. It was what I decribed above. Now the array is not there. Those keybard keys do change as descibe. Stay tuned...

Jun 6, 2012 9:51 PM in response to garyes

Well that's confusing. In my first post I mentioned five keyboard controls which were toggled using control-F1. Here's my keyboard shortcuts:


User uploaded file


Control-F1 toggles those 5 unchecked checkboxes. And what I initially said, where I also said the UserAssignableHotKeys wasn't being set seems to now be set. Here's how I tested for it:


/usr/libexec/PlistBuddy /Volumes/main/ira/Library/Preferences/com.apple.universalaccess.plist -c 'Print :UserAssignableHotKeys:0:enabled'


This will print true of false corresponding to the the first element of those 5 keys in the UserAssignableHotKeys array in the plist. Changing the 0 to 1 througj 4 can check for the others. Seems to work reliably in my testing. Not sure why UserAssignableHotKeys disappeared at one point.


Next post about control-F7. Need to break these up due the time I'm taking constructing these posts and worrying about running up against the 15-minute posting limit imposed in these forums.


Update:

I just discovered that the UserAssignableHotKeys disappears when you use control-F1 while the keyboard shortcuts system preferences is launched. So long as the system preferences are not running the above is a valid test.

Jun 6, 2012 10:05 PM in response to garyes

As you can see in my above keyboard shortcuts control-F7 moves tab focus. So there is no sense pursuing what plist field that changes.


FWIW, I am using 10.6.5 but I wouldn't think it's that much different from 10.6.8 for this particular stuff. So without knowing exactly what Full Keyboard Access is in Snow Leopard I don't want to pursue this further. So I'll describe the general scheme I used for what I figured out above.


In general, what I did was hit the key-combo in question to see what plist(s) get changed by monitoring the file system changes using fseventer. Open those plist(s) with the Property List Editor (part of xcode), and save the plist as a xml text so that I can compare which fields change when I toggle the key by (text) comparing a before and after versions of the xml plists.


Once the field is known I used PlistBuddy to display the appropriate data. PlistBuddy was used since defaults read is not amenable to extracting a single value out of a plist array.


If you figure out the appropriate PlistBuddy command then it's easy to add that to a shell script to do whatever you want with the value it returns.


Good luck.

Jun 9, 2012 2:13 PM in response to X423424X

A friend who is a little better than I at google searches found this:


> In "~/Library/Preferences/.GlobalPreferences.plist" look at
> "AppleKeyboardUIMode", bit 1
> toggles Full Keyboard Access. If the user's selected full keyboard access,
> then tab to all links, otherwise only tab to text fields.


at https://bugzilla.mozilla.org/show_bug.cgi?id=187508

So here's the applescript that works:


set the plistfile_path to "~/Library/Preferences/.GlobalPreferences.plist"

tell application "System Events"

set p_list to property list file (plistfile_path)

set v to (value of p_list)

class of v-- record

set uiMode to (value of property list item "AppleKeyboardUIMode" of p_list)

end tell


if uiMode mod 4 > 1 then

set allControls to true

else

set allControls to false

end if


I don't know if higher bits are ever used or will be so the mod 4 strips them out.


(I'll add more to the script to send the result to Keyboard Maestro Engine.)

Jun 9, 2012 10:05 PM in response to X423424X

Full Keyboard Access and Control-F7 are about tab key behavior, which is explained at the bottom of the panel for the Keyboard System Preference.


In general, I want Full Keyboard Access on.


But in iTunes I want the tab key to move between the search box, the playlist, and the list of playlists. That's the behavior when the Full Keyboard Access bit is off. Otherwise, the tab key goes to every interface element.


With this new tool to determine the state, I can make a script that launches when iTunes becomes the front application, and then turns off that bit unless it's already off. Since AppleScript doesn't have bitwise operators (boo hiss) I'll probably just emulate pressing control-F7.


Somewhere in the (de-)evolution of iTunes 10 they took away option-tab, which always tabbed between those three locations regardless of how tab behaved.


A weirdness I discovered is that control-F1 toggles bit 0 of AppleKeyboardUIMode and toggles those five checkboxes. But manually changing those checkboxes does not change bit 0.

Determine current state of Full Keyboard Access

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.