Last active
October 9, 2024 21:26
-
-
Save ewauq/2702c6b2342517a0ec9206fa101d3d7c to your computer and use it in GitHub Desktop.
How to: Bind F13 to F24 keys on the G-keys (Logitech Gaming Keyboards)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- How to use this script: | |
-- 1. Install the Logitech Gaming Software: http://support.logitech.com/en_us/software/lgs | |
-- 2. Launch it, and right click on your profile (the gear icon) and then click on "Scripts". | |
-- 3. Add the following code into the Script window, save it, and close it. Enjoy. | |
-- Now G1 is bound to F13, G2 to G14, ... G12 to F24. | |
function OnEvent(event, arg) | |
-- OutputLogMessage("event = %s, arg = %s\n", event, arg) | |
fKey = { | |
[1] = 0x64, -- F13 | |
[2] = 0x65, -- F14 | |
[3] = 0x66, -- F15 | |
[4] = 0x67, -- F16 | |
[5] = 0x68, -- F17 | |
[6] = 0x69, -- F18 | |
[7] = 0x6A, -- F19 | |
[8] = 0x6B, -- F20 | |
[9] = 0x6C, -- F21 | |
[10] = 0x6D, -- F22 | |
[11] = 0x6E, -- F23 | |
[12] = 0x76 -- F24 | |
} | |
if (event == "G_PRESSED") then | |
PressKey(fKey[arg]) | |
end | |
if (event == "G_RELEASED") then | |
ReleaseKey(fKey[arg]) | |
end | |
end |
does LGHUB support the g710+?
No I just got one and hub doesn't see it
…On Sat, Aug 10, 2024, 05:45 Thespikedballofdoom ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
does LGHUB support the g710+?
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/ewauq/2702c6b2342517a0ec9206fa101d3d7c#gistcomment-5149815>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAW2V6GCXY3VYDPHIAVTNODZQXOKLBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVA4DEMRTGMZTEM5HORZGSZ3HMVZKMY3SMVQXIZI>
.
You are receiving this email because you are subscribed to this thread.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
I guess then the effort I put in yesterday was worth it. See this gist for anyone who wants a demonstration on targeting a specific M-profile and only one G-key.
https://gist.github.com/Thespikedballofdoom/569c3516ad83b008d4204ba7140b9751
This code won't work for mouse such as the G600. For those who want to implement this on a mouse, use the following new and greatly improved code:
-- How to use this script:
-- 1. Install the Logitech Gaming Software: http://support.logitech.com/en_us/software/lgs
-- 2. Launch it, and right click on your profile (the gear icon) and then click on "Scripts".
-- 3. Add the following code into the Script window, save it, and close it. Enjoy.
-- Now G9 on your G600 mouse is bound to F13, G10 to G14, ... G12 to F24.
function OnEvent(event, arg)
-- Enable logging
EnablePrimaryMouseButtonEvents(true)
-- Table mapping mouse button numbers to F-key hex codes
local fKeys = {
[9] = 0x64, -- F13
[10] = 0x65, -- F14
[11] = 0x66, -- F15
[12] = 0x67, -- F16
[13] = 0x68, -- F17
[14] = 0x69, -- F18
[15] = 0x6A, -- F19
[16] = 0x6B, -- F20
[17] = 0x6C, -- F21
[18] = 0x6D, -- F22
[19] = 0x6E, -- F23
[20] = 0x76, -- F24
}
-- Debug function to get F-key name from hex code
local function getFKeyName(hexCode)
for i, code in pairs(fKeys) do
if code == hexCode then
return "F" .. (i + 4) -- Adjusted to start from F13
end
end
return "Unknown"
end
-- Function to handle key press and release
local function handleKey(keyAction)
if fKeys[arg] then
local fKeyHex = fKeys[arg]
local fKeyName = getFKeyName(fKeyHex)
local actionName = keyAction == PressKey and "Pressing" or "Releasing"
OutputLogMessage("Mouse button %d: %s %s (Hex: 0x%02X)\n", arg, actionName, fKeyName, fKeyHex)
keyAction(fKeyHex)
else
OutputLogMessage("Unhandled mouse button: %d\n", arg)
end
end
OutputLogMessage("Event: %s, Arg: %d\n", event, arg)
if event == "MOUSE_BUTTON_PRESSED" then
handleKey(PressKey)
elseif event == "MOUSE_BUTTON_RELEASED" then
handleKey(ReleaseKey)
end
end
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It has improved a lot since my comment. Logitech Gaming Software (LGS) profiles are stored at
C:\Users\<name>\Appdata\Local\Logitech\Logitech Gaming Software\Profiles
.Logitech
folder fromAppData
to temporary location (Desktop for example).Logitech
folder back toAppData
.Note: Some devices are not supported in LGHUB and those device specific settings in profiles will not carry over.