lua – How to change color keys on a Logitech keyboard (g915)?

lua – How to change color keys on a Logitech keyboard (g915)?

i can change the color of one key in Ghub but i cant use this ability in any SDK

There is LED ILLUMINATION SDK which has API for changing key colors.
The SDK is downloadadble from https://www.logitechg.com/en-us/innovation/developer-lab.html
The SDK is usable from any programming language capable of calling external function from a DLL.
You should write your own program (in Java, C#, C, whatever) to control key colors by using this SDK API.
GHUB process must be running for SDK API functions to work, but you would not have to write Lua scripts for GHUB.

changing the color of one key during the cooldown of the spell linked to the keywould

Your program can invoke WinAPI function GetAsyncKeyState (or it can install a keyboard hook) to see the keys which are currently down to implement the logic of illuminated cooldown.

we could do scripts in LUA in GHUB to interact with logitech material

There are two problems with GHUB:

  1. Lua scripts in GHUB are unable to invoke external functions, so SDK API is not accessible.
    This can be workarounded by creating a macro in GHUB to invoke external .exe file (written by you) which will actually control key colors.
    In Lua script you can call PlayMacro with the name of the macro created to control the illumination programmatically.
  2. GHUB can not see usual key (letter, digit) status to determine whether the key is pressed or not.
    Only Logitech mouse buttons and Logitech keyboard G-keys are visible by GHUB.
    But G-keys might be not a good choice for binding spells because of their too-far position on the keyboard.

just turn off the numlock key when the numpad is locked.
but the tools given by logitech ghub do not allow user to do that

It is achievable with the following GHUB Lua script.
It turns NumLock off on profile loading.

function OnEvent(event, arg)
   if event == PROFILE_ACTIVATED then
      -- turn NumLock OFF if it is currently ON
      if IsKeyLockOnNumLock then
         PressAndReleaseKeyNumLock
      end
   end
end

lua – How to change color keys on a Logitech keyboard (g915)?

Leave a Reply

Your email address will not be published. Required fields are marked *