The EventQueue

A very important part in NotifierLight is the EventQueue. It controls the priority of the light events. There are 3 default events (Default, DoNotDisturb and Lighttest). Besides this every plugin will add it´s own events to the EventQueue.

For example: If you lock your screen the color for this event should overwrite your default color. But if a phone call comes in while the screen is locked, this event should have the priority and overwrite the session-locked color.

After a new installation the EventQueue will be generated automaticly (depending on the user added plugins). You can change the EventQueue in the general properties of the GUI or in the settings.json (TNA context menu -> Open Settings Path). If you open the file with an editor the EventQueue looks like this:

    "EventQueue": [
      "NLCore.Lighttest",
      "NLCore.DoNotDisturb",
      "NLCore.Default",
      "IncomingCall.0cdef12f-cb9e-4678-836c-dfec9aa2a40a",
      "ConnectedCall.0cdef12f-cb9e-4678-836c-dfec9aa2a40a",
      "SessionLocked.5f738650-b6c4-4e24-83f6-22cb9a6454ba",
      "ODBC.838eceb1-0c93-44da-96b9-ec38ec02a15e",
      "GotMail.b9d9a772-bfd5-496f-afba-0f39775db47d",
      "CPUUsage.f44e4c97-7c8c-4328-902d-1fb1ac2f25e6",
      "DriveSpace.f44e4c97-7c8c-4328-902d-1fb1ac2f25e6"
    ],

As you can see the NLCore plugins have the highest priorities by default. It means: If Do-Not-Disturb is activated and a phone call comes in or your CPUUsage plugin reports an overrun, nothing happens to the light state. Let's see how we can change the priorities a bit:

    "EventQueue": [
      "IncomingCall.0cdef12f-cb9e-4678-836c-dfec9aa2a40a",
      "ConnectedCall.0cdef12f-cb9e-4678-836c-dfec9aa2a40a",
      "CPUUsage.f44e4c97-7c8c-4328-902d-1fb1ac2f25e6",
      "DriveSpace.f44e4c97-7c8c-4328-902d-1fb1ac2f25e6",
      "GotMail.b9d9a772-bfd5-496f-afba-0f39775db47d"
      "SessionLocked.5f738650-b6c4-4e24-83f6-22cb9a6454ba",
      "ODBC.838eceb1-0c93-44da-96b9-ec38ec02a15e",
      "NLCore.Lighttest",
      "NLCore.DoNotDisturb",
      "NLCore.Default"
    ],

Now the events like incoming calls or the SystemParameter plugin events will have a higher priority than the default or Do-Not-Disturb light.

If there are more than one event at the same time, the EventQueue will hold the events with lower priority and trigger it after the event with higher priority turned Off. If there's no event alive, there is always a fall back to Default, which is always On internally.

All in all it is a temporary solution. Maybe the EventQueue will get obsolete with further NL redesigns.

No comments:

Post a Comment