MSzturc / ThinkpadAssistant

An Assistant Application that allows you to use all your Function Keys on a T-Series Thinkpad Laptop
118 stars 13 forks source link

[Feature Request] FnLock HUD #25

Closed tylernguyen closed 4 years ago

tylernguyen commented 4 years ago

Hey @hexart @MSzturc

I spend quite a bit of my time in Excel so I spam FnLock quite often. It would be nice to have a native macOS HUD for this key.

The EC related query is _Q74.

I understand this is completely optional, but again, it would be very nice for me to have this feature. And I think it should be a fairly easy implementation apart from deciding the HUD icon.

MSzturc commented 4 years ago

You're right the hardest thing would be creating an icon for this. I've searched a bit, and couldn't find an icon at all.

Sniki commented 4 years ago

You're right the hardest thing would be creating an icon for this. I've searched a bit, and couldn't find an icon at all.

What about a lock: locked/unlocked with a keyboard button and FN on it ?

hexart commented 4 years ago

OK, I'm in.

hexart commented 4 years ago
Fnlock

Hey guys, how about this one?

hexart commented 4 years ago
fnlock1

I redesigned the two letters to make it look better.

tylernguyen commented 4 years ago

@hexart I like the fn but I would think the dots should a be a bit bigger to make them more distinct from one another.

@MSzturc Maybe the texts below should be Function Keys and Multimedia Keys? or perhaps shorter: Function/Media

hexart commented 4 years ago
9 00 28
tylernguyen commented 4 years ago

@hexart I like the sizing on the right. What would the empty one look like?

hexart commented 4 years ago
9 18 23
tylernguyen commented 4 years ago

@hexart @MSzturc I think those icons are perfect.

As for text, I leave it to you @MSzturc, I'm thinking about some permutations of: Function Keys/ Multimedia Keys Function/ Media Function Keys/ Media Keys

Can't wait for this to be added!

hexart commented 4 years ago

fnlockoff.pdf fnlockon.pdf

MSzturc commented 4 years ago

Looks great, i will implement this feature tomorrow. @tylernguyen May i ask you to write the ACPI Code. I plan to implement the following bindings:

f18+left shift: fkeys (F1-F12) f18+right shift: media keys

tylernguyen commented 4 years ago

@MSzturc Got it and tested in Karabiner-EventViewer. Here it is:

Make sure you patch rename _Q74 to XQ74

        Name (LED3, Zero)
        Method (_Q74, 0, NotSerialized) // FnLock (Fn + Esc)
        {
            If (_OSI ("Darwin"))
            {
                // Toggle FnLock LED
                If ((LED3 == Zero))
                {
                    // Right Shift + F18
                    Notify (\_SB.PCI0.LPCB.KBD, 0x012A)
                    Notify (\_SB.PCI0.LPCB.KBD, 0x0369)
                    Notify (\_SB.PCI0.LPCB.KBD, 0x01aa)

                    // 0x02 = Enable LED
                    \_SB.PCI0.LPCB.EC.HKEY.MHKQ (0x02)
                    LED3 = One
                }
                Else
                {
                    // Left Shift + F18
                    Notify (\_SB.PCI0.LPCB.KBD, 0x0136)
                    Notify (\_SB.PCI0.LPCB.KBD, 0x0369)
                    Notify (\_SB.PCI0.LPCB.KBD, 0x01b6)

                    // 0x00 = Disable LED
                    \_SB.PCI0.LPCB.EC.HKEY.MHKQ (Zero)
                    LED3 = Zero
                }

            }
            Else
            {
                // Call original _Q74 method.
                \_SB.PCI0.LPCB.EC.XQ74()
            }

A few notes here: Calling it LED3 since LED1 is F4 and LED2 is keyboard backlight. _SB.PCI0.LPCB.EC.HKEY.MHKQ is the FnLock LED device. Also my device is LPCB, yours may just be LPC Similar to the Mute key, I suspect there exists a pitfall where LED state will not sync past a reboot/shutdown. In BIOS, my "F1-F12 as Primary Function is set to [Disabled]"

MSzturc commented 4 years ago

Implemented with v1.8.0