0

At first I wanted to set up my Logitech keyboard (g915) to have interactive lightning. For example, changing the color of one key during the cooldown of the spell linked to the key, or 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 (you can only have stuff like rainbow keyboard or set static color for each keys but that's not enough for me).

Then I saw that we could do scripts in LUA in GHUB to interact with Logitech material but the SDK isn't good enough to change the color of the keyboard. It's stupid because I can change the color of one key in Ghub but I can't use this ability in any SDK or API I found.

Does someone have any ideas how I could interact with the led in my keyboard and create script to change them?

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
link1254
  • 1
  • 1

1 Answers1

0

i can change the color of one key in Ghub but i can't 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 IsKeyLockOn"NumLock" then
         PressAndReleaseKey"NumLock"
      end
   end
end
Egor Skriptunoff
  • 23,359
  • 2
  • 34
  • 64