[Bug] Duplicate Gammastep processes when night mode enabled and bar restarted
Description
When bar is killed while Night Mode is enabled, the Gammastep process remains running. Restarting the bar will create a new Gammastep process.
Expected Behavior
Only one Gammastep process running.
Some things to consider relating to night mode:
-
The user may already have Gammastep configured with their latitude/longitude in order to have gradual tinting/brightening occur automatically in a smooth gradual manner. They likely only need the ability to toggle on/off while avoiding overrides to their existing config.
-
A "nice to have" feature would be UI for auto night mode. You would need either a way to manually enter latitude/longitude or require geoclue2 on the system and start gammestep with
gammastep -l geoclue2to automate this. Geoclue use could be optional of course with a checkbox or simply checking the system in some way to see if it's available.
Just my opinion of course, but currently night mode is a bit awkward requiring manual toggling. When I'm focused, I simply don't think to enable it or forget to disable it. Gammastep has a great auto-tint mode which is how most users likely configure it. With this ability, night mode could be "set and forget" automatically providing tint as needed.
Screenshots/Recordings
It does not happen when the shell is killed normally, if you kill it with SIGKILL (kill -9) there's probably nothing we can do about that. SIGTERM works
Best would be to just kill any pre-existing gammastep process before starting a new one in the shell. but best not to use SIGKILL signals unless you absolutely have to
That's odd. I've been using pkill which defaults to SIGTERM. Not a big deal though.. I can pkill gammastep too. 😁
Just to clarify why I'm running into this issue. I have a keybind to toggle the bar as I'd rather hide it when needed rather than use autohide.
pkill quickshell || niri msg action spawn -- qs -c /home/kev/Code/DankMaterialShell
Would it be possible to add an IPC call to toggle visibility without killing the bar? That would be a cleaner way to go about it. If you would prefer I create a new issue just let me know.
(I can’t reproduce it) because mine exits which is quickshell expected behavior. But we have pending work on the night mode thing.
But yea the ipc is a good idea , make a separate issue for it
@kevb1973 @Vantesh Give the New Night Mode Automation a shot and let us know how it goes!
Hey Purian, thanks for working on this! The time based option seems to be working great. I seem to be having issues with the location based setting though.
When I click Location, I get a very brief flash of text which disappears too quickly to screenshot. I think I found it in the code though:
Uses automatic location detection for sunrise/sunset times. If automatic detection fails, enter your coordinates manually below (e.g., NYC: 40.7128, -74.0060).
I still have the start/end times showing and no place to enter coordinates.
Night mode does come on, but I don't know if its location based or still using the start/end times.
Let me know if you need any further info.
Thanks for the feedback, I can confirm that on my end as well. I will get some updates in place. You should be able to spam the location button a couple of times to get the UI to switch over to it.
I'm not a champion speed-clicker by any means, but I spammed as fast as I could and couldn't get it to stick. I can see the gui showing location briefly before it disappears. 😁
I decided to run the bar with -v to see the logs. I'm not seeing any errors when I select location mode unfortunately.
I did find something else though:
WARN: Process failed to start, likely because the binary could not be found. Command: QList("killall", "-w", "gammastep")
killall isn't installed by default on NixOS (not sure about other distros). It would need to be listed as a dependency in readme.md. Alternatvely, maybe something like pkill will be more universal? I wonder if this is the cause of my previous issue with multiple gammastep processes when killing the bar...
@kevb1973 give it a go now and see how it is, no killall -w anymore
The new ui looks great! I'll have to wait until sundown to properly test it though. I'll post an update later once I get a chance to try it out.
Thanks Kev!
It all seems to be working great!
Just one thing I was thinking about.. I wonder if it would be worth updating the label on this 'Night Mode' button to indicate when automatic mode is active. ie Night Mode (auto) or something like that. That way the user doesn't expect something to happen when clicking the button when it's daylight. Just a thought. I'm probably overthinking it. lol
I added automation indicators to the Control Center and now if a user enables automation, the required night mode toggle will turn on with it. e693857c39ae35f9956105bbadb176f7e14ef746
Perfect! Thanks Purian.
Awesome, thanks for the suggestions to get it all started. We'll go ahead and close. Thanks for the testing too!