Question and problem re `toggleLedsOnSuspendResume`

(Shriramana Sharma) #1

I would like to know:

  1. Why toggleLedsOnSuspendResume needs to be included as part of the sketch and can’t be included as part of Kaleidoscope?

  2. Why there is another function hostPowerManagementEventHandler that merely redirects to toggleLedsOnSuspendResume?

  3. Why with latest Kaleidoscope and the above functions included as-is in (the end of) my current sketch don’t work for me? Before the move to the unified Kaleidoscope+plugins repo it was working, that’s all I know. I’m using Kubuntu Bionic with latest updates.

(Gergely Nagy) #2

It could be included in Kaleidoscope, now that it’s a monorepo. It was not included with the HostPowerManagement plugin because we didn’t want to depend on LEDControl.

Because toggling LEDs on and off is just one thing you can do in response to the host going to sleep. You aren’t limited to turning off the LEDs. Not to mention that some of the boards Kaleidoscope supports now don’t even have LEDs.

I might have broken something - will try to test sometime in the next couple of days. Feel free to file an issue about this! (I can keep track of issues more easily than forum posts)

(Shriramana Sharma) #3

OK understood.

So how do you want to handle this? From the lines:

I see that there is a weakly linked empty hostPowerManagementEventHandler within the plugin. Do you envisage that the user would like to include other actions to take place on suspend as part of the sketch? In which case only the definition toggleLedsOnSuspendResume can be pushed to the library and the sketch would still need to include the actual hostPowerManagementEventHandler calling toggleLedsOnSuspendResume again. This doesn’t seem all that useful vis-a-vis reducing code clutter in the sketch.

Another (better?) idea is: hostPowerManagementEventHandler within the plugin can be converted to strongly linked, and it should call toggleLedsOnSuspendResume and another new helper function which can then be weakly linked and customized in the sketch, just like macroActions, tapDanceActions etc.

This fact doesn’t seem so relevant here? I mean because Kaleidoscope still includes LEDControl etc as default and they merely don’t do anything on such keyboards?