Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process Fn+Esc for switching between hotkey and Fn priority mode #422

Closed
krystean opened this issue May 21, 2023 · 17 comments
Closed

Process Fn+Esc for switching between hotkey and Fn priority mode #422

krystean opened this issue May 21, 2023 · 17 comments
Labels
enhancement New feature or request

Comments

@krystean
Copy link

With v0.65, G-Helper can process hotkeys. On some models, Fn+Esc switches between hotkey and Fn priority mode. On Fn priority mode, an LED on the Fn key turns on and you can use the Fn keys normally. https://www.asus.com/us/support/FAQ/1038312/

Is it possible to add this key combo? Also, is it possible to set custom hotkeys for setting things like F4 for volume down? Thanks!

@seerge
Copy link
Owner

seerge commented May 21, 2023

@krystean hello. What you ask is called FN-Lock :) #112 It's not possible to bind it to FN+Esc (as that combination simply doesn't produce any code at all).

But I might (in future) look into adding this setting under Extra.

Main problem for now - is that not only asus, but windows intercepts some keys (like FN+F1), so app doesn't get notified about them yet.

@seerge seerge added the enhancement New feature or request label May 21, 2023
@krystean
Copy link
Author

Ah, I see. Thanks!

@seerge
Copy link
Owner

seerge commented May 31, 2023

@krystean
Copy link
Author

krystean commented May 31, 2023

@seerge Thanks!

From here on:

  1. I've stopped and disabled Asus Optimization.
  2. No ASUS services running i.e. ran debloat.bat
  3. I've checked the feature Process Fn + F hotkeys without FN in Extra

Here are some notes from my testing on model X515UA_M515UA using v0.74:

T1 GHelper not running i.e. quit and not in Task Manager:

  1. F1-F12 keys work as they should e.g. on the browser, F5 refreshes the page and F11 toggles full screen mode.
  2. Fn + F keys act as hotkeys for the label on the F key e.g. Fn + F1 mutes the sound, Fn + F2 lowers the volume, and Fn + F9 locks the laptop with the exception of F6 (toggle touchpad), F10 (toggle camera), and F12 (open MyASUS app) which I think is controlled by the ASUS Optimization service.

T2 GHelper running i.e. on the System Tray and in Task Manager:

  1. F1-F12 keys do not act as hotkeys for the labels on them e.g. F2 lowers screen brightness instead of lowering the volume , F4 cycles keyboard animation and F5 cycles performance mode with the exception of F1 which correctly mutes the sound.
  2. Fn + F keys however now work the same as T1.2 which is the expected function of the feature. F6 however does not correctly toggle the touchpad and F10 and F12 does not work (see T1.2). Fn + F keys should work the same as T1.1

T3 Asus Optimization service started briefly and then stopped while GHelper is running:

  1. F1-F12 keys now work the same as T2.2.
  2. Fn + F keys now work the same as T2.1.
  3. Waking up from sleep however reverts to T2.
    It seems briefly turning on Asus Optimization service switched the functions and made the feature work correctly?

What's expected while GHelper is running:

  1. If Process Fn + F hotkeys without FN in Extra is not checked, F1-F12 keys should work as T1.1 (OK)
  2. If Process Fn + F hotkeys without FN in Extra is checked, F1-F12 keys should work the same as T2.2.
  3. If Process Fn + F hotkeys without FN in Extra is checked, Fn + F keys should work the same as T1.1.

Is GHelper able to make Fn + ESC a toggle to enable and disable the feature?
Also, a minor nitpick lol, I think the feature should say Process Fn + F hotkeys without Fn (lowercase N instead).

Thanks again!

@seerge
Copy link
Owner

seerge commented May 31, 2023

@krystean currently F1-F12 are binded by g-helper in a way they are laid out on asus rog laptops (that don't support any fn+lock in general at all).

Given amount of differences that you have on your vivobook, i don't think the way it's done currently will fit your needs at all.

Does your laptop in general has some "native" fn+lock ? (i.e. when you run asus software / etc ) ?

@seerge
Copy link
Owner

seerge commented May 31, 2023

@krystean can you try to run in poweshell as admin following command and see if it makes any difference?

Invoke-CimMethod (Get-CimInstance -Namespace root/wmi -ClassName AsusAtkWmi_WMNB) -MethodName DEVS -Arguments @{Device_ID=0x00100023; Control_status=1}

@krystean
Copy link
Author

@seerge Hello.

Does your laptop in general has some "native" fn+lock ? (i.e. when you run asus software / etc ) ?

Yes, it does. When ASUS Optimization is running, in the MyASUS app I can choose either Locked Fn key or Normal Fn key. Locked Fn key prioritizes hotkeys.

can you try to run in poweshell as admin following command and see if it makes any difference?

I ran it and it works! Changing the value of Control_status enables/disables the Fn lock! How'd you even figure that out? lol

@seerge
Copy link
Owner

seerge commented May 31, 2023

@krystean I have found 0x00100023 in linux kernel sources, it was marked as "FNLOCK". It has no effect on ROG/TUF laptops (so i had to literally program whole thing from scratch) but I thought it worth a shot.

Then I can make that some keybinding will trigger this command. I just don't know if FN+F triggers any code. Can you press FN+F with G-helper running and post a log from %appdata%/g-helper here ?

@krystean
Copy link
Author

I have found 0x00100023 in linux kernel sources, it was marked as "FNLOCK". It has no effect on ROG/TUF laptops (so i had to literally program whole thing from scratch) but I thought it worth a shot.

@seerge That's awesome! I was curious about the command and found this from one of the references in a gist: https://codebrowser.dev/linux/linux/include/linux/platform_data/x86/asus-wmi.h.html
Possible values for the Device_ID's are actually there including the FNLOCK! So cool lol

Can you press FN+F with G-helper running and post a log from %appdata%/g-helper here ?

Should I enable the Fn Lock feature while doing this?

@seerge
Copy link
Owner

seerge commented May 31, 2023

@krystean no, i just want to see if FN+F that you want actually generate some key code (it will appear in log), if it doesn't - it's not possible to do a binding, and you need to find another key combination that does it.

@krystean
Copy link
Author

@seerge Here's the log with added comments what F key was pressed. Thanks!
log.txt

@seerge
Copy link
Owner

seerge commented May 31, 2023

@krystean try this build FN+Esc should toggle FN lock (also checkbox under extra should do same)
GHelper.zip

(assuming fn+esc triggers event # 78)

@krystean
Copy link
Author

krystean commented May 31, 2023

@seerge This works! Thank you very much!

A small problem though:
If Control_status=1 or F keys are normal, Process Fn + F hotkeys without FN should be unchecked in Extra.

In Customization.ini on my model, theres a section for FunctionKeyLock. Idk if this section exists in other models. Maybe GHelper can use this too?

GHelper can maybe:

  1. On launch, open the file
  2. Check the value for FunctionKeyLock
  3. If value==0, send the PS command with Control_status=0 and enable Process Fn + F hotkeys without Fn feature, else send command with Control_status=1 and disable the feature so F keys work normally.
  4. Whenever the feature is enabled/disabled in Extra, modify the value for FunctionKeyLock in Customization.ini, then send the corresponding Control_status.

FunctionKeyLock.value == 0 equals Control_status=0 equals feature enabled equals hotkeys working
FunctionKeyLock.value == 1 equals Control_status=1 equals feature disabled equals F keys work normally
Customization.ini.txt

@seerge
Copy link
Owner

seerge commented Jun 1, 2023

I don't want to touch customization.ini :) as it's config for other app.

As for g-helper itself I have swapped 0 with 1 for control_status. Can you check if this build works as you expect?
GHelper.zip

@krystean
Copy link
Author

krystean commented Jun 1, 2023

I don't want to touch customization.ini :) as it's config for other app.

Ah, yeah that makes sense lol I thought GHelper was using the file for tracking the charge limit because it's changing the value there too. I looked and GHelper's config.json has a charge_limit entry. Is GHelper changing the limit in both files? I noticed that BatteryLimit = 50 : OK is logged twice during app launch.

As for g-helper itself I have swapped 0 with 1 for control_status. Can you check if this build works as you expect?

Working great and it automatically switches the feature on and off! Thanks a ton! A nice-to-have but minor UI thing would be updating the check as the switching is done.

On my end, this Issue has been completed. Some hotkeys do not work like the F6 (can't get it to work too using the command I learned from you lol) but I think they're a separate issue.

PS
Can you pls share how to set up Visual Studio to start working on GHelper? I tried but there were just so many options lol Maybe in the README? Thanks!

@seerge
Copy link
Owner

seerge commented Jun 1, 2023

@krystean

Is GHelper changing the limit in both files? I noticed that BatteryLimit = 50 : OK is logged twice during app launch.
It tries to, but mainly to prevent Optimization service from overwriting. Generally optimal situation for g-helper is when no asus services are running at all.

Working great and it automatically switches the feature on and off! Thanks a ton! A nice-to-have but minor UI thing would be updating the check as the switching is done.

It updates every time you open Extra, doing it in real-time is too much hassle atm

Can you pls share how to set up Visual Studio to start working on GHelper? I tried but there were just so many options lol Maybe in the README? Thanks!

Just install VS, and run clone repository , and enter github url. That's enough
Screenshot 2023-06-01 194225

Closing issue as completed then

@seerge seerge closed this as completed Jun 1, 2023
@krystean
Copy link
Author

krystean commented Jun 1, 2023

@seerge Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants