views:

82

answers:

1

Does anybody know a way to set/get the fn-lock from an application so you don't have to press the 'fn' key to get F1, F2, etc. on a macbook or apple keyboard? I want to have it always on for my application but keep the standard behavior in the rest of the system.

A: 

This answer is pure speculation, but bear with me.

A possible scenario: the keyboard itself generates different low-level scan codes depending on whether the fn key is pressed. For the sake of argument, let's assume the following:

   F1: 0x01
fn-F1: 0x02

These low-level scan codes are sent over the bus to the keyboard driver. The keyboard driver checks to see whether the "Use F keys as standard function keys" preference is set and, if so, swaps scan codes before forwarding them on to the application. So, the keyboard driver would do this mapping:

                  F1: 0x01
               fn-F1: 0x02
"Use F keys" &    F1: 0x02
"Use F keys" & fn-F1: 0x01

If that's the case, you might just want to see if the "use all F keys as standard function keys" preference is set and, if it is, re-swap the scan codes before you process them. In other words, you would undo the work that the keyboard driver did. Perhaps this is your original question.

Look into it, though; I could be wrong.

Daniel Yankowsky
Yes, the keyboard generates different scan-codes. However you can set its 'state' in the System Preferences of the Keyboard. So there must be a way for the OS to set the fn-lock.
krow
I tried to make my speculation more concrete. I hope it helps.
Daniel Yankowsky