You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I like having a particular LED mode on all the time, but I would like other plugins to be able to override the colours when they have something important to show.
In particular at the moment I'm running the "blazing trail" stalker (this is my favourite), but I'm experimenting with a new plugin which wants to keep a particular key lit while a temporary mode is active. In that plugin I set the colour of a particular key, but then stalker changes it to something else right after, or in the next cycle.
Describe the solution you'd like
It seems to me like it'd be useful for plugins to give a priority along with their request to set an LED's colour. A naive approach might be to remember the priority with which each LED's colour was set, and then when a new request comes in to set its colour, ignore it if the incoming priority is lower. When finished, a plugin can release control.
For example, an ambient colour scheme plugin like stalker could always use priority 0. Another plugin could set a status colour on a given key with a higher priority like 1. Then stalker's requests to change the colour of that same key right after would be ignored. Eventually the other plugin switches the LED back off, with priority 1, and gives an extra argument saying the recorded priority for the LED should end up at 0 rather than the 1, so other plugins can take back over.
Maybe some other plugin would use a higher priority number, because it deems its colours urgent.
Maybe there'd be some constants for common priority levels.
So, maybe something like this...
function setRgbAt(addr, colour, int priority = 0, int store_priority = -1) {
// Do nothing if the LED was already set with a higher priority
if (existingPriorityAt(addr) > priority)) return;
// (Run whatever the current logic of setRgbAt is)
// Remember the priority with which this colour was set.
// Default to the priority which was passed, but if something (probably 0)
// was passed for the 4th argument use that instead.
setPriorityAt(addr, store_priority == -1 ? priority : store_priority);
}
Maybe there'd be a further function to release control without setting a colour at the same time, but I imagine in most cases they'd want to turn the LED off when done, so it may not be necessary.
Describe alternatives you've considered
What I'm doing right now is setting the colour again every single cycle. This is working, but it seems brittle. Surely if another plugin's afterEachCycle method runs after mine, it'll overrule the colour I'm setting. I'm not sure if this is a race condition or if it's to do with the order plugins are registered, or what.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I like having a particular LED mode on all the time, but I would like other plugins to be able to override the colours when they have something important to show.
In particular at the moment I'm running the "blazing trail" stalker (this is my favourite), but I'm experimenting with a new plugin which wants to keep a particular key lit while a temporary mode is active. In that plugin I set the colour of a particular key, but then stalker changes it to something else right after, or in the next cycle.
Describe the solution you'd like
It seems to me like it'd be useful for plugins to give a priority along with their request to set an LED's colour. A naive approach might be to remember the priority with which each LED's colour was set, and then when a new request comes in to set its colour, ignore it if the incoming priority is lower. When finished, a plugin can release control.
For example, an ambient colour scheme plugin like stalker could always use priority 0. Another plugin could set a status colour on a given key with a higher priority like 1. Then stalker's requests to change the colour of that same key right after would be ignored. Eventually the other plugin switches the LED back off, with priority 1, and gives an extra argument saying the recorded priority for the LED should end up at 0 rather than the 1, so other plugins can take back over.
Maybe some other plugin would use a higher priority number, because it deems its colours urgent.
Maybe there'd be some constants for common priority levels.
So, maybe something like this...
Maybe there'd be a further function to release control without setting a colour at the same time, but I imagine in most cases they'd want to turn the LED off when done, so it may not be necessary.
Describe alternatives you've considered
What I'm doing right now is setting the colour again every single cycle. This is working, but it seems brittle. Surely if another plugin's afterEachCycle method runs after mine, it'll overrule the colour I'm setting. I'm not sure if this is a race condition or if it's to do with the order plugins are registered, or what.
The text was updated successfully, but these errors were encountered: