Auto-adjusts monitor brightness based on your location and day time. Uses Flux or Redshift.
F.lux: http://stereopsis.com/flux/
Redshift: http://jonls.dk/redshift/
6 years ago
2011-08-23: Minor changes to the process management.
2011-08-02: Now gets default latitude and longitude values from KDE, and when the applet is destroyed it stops redshift/xflux. Also, the default temperature values now match redshift defaults. Thanks to meegee: https://github.com/meegee
2011-07-09: Now, when status is unknown, clicking on the plasmoid tries to relaunch the program after killing redundant processes.
2011-06-28: More robust error detection and bug reports.
2011-06-27: Fixed bug that happened when more than one instance was running at the same time. Also, configuration dialog is now "standard".
2011-06-26: Now you can put the plasmoid in the system tray.
2011-06-25: Fixed bug with default options.
2011-06-24: Fixed bug with Redshift.
6 years ago
2011-08-23: Minor changes to the process management.
2011-08-02: Now gets default latitude and longitude values from KDE, and when the applet is destroyed it stops redshift/xflux. Also, the default temperature values now match redshift defaults. Thanks to meegee: https://github.com/meegee
2011-07-09: Now, when status is unknown, clicking on the plasmoid tries to relaunch the program after killing redundant processes.
2011-06-28: More robust error detection and bug reports.
2011-06-27: Fixed bug that happened when more than one instance was running at the same time. Also, configuration dialog is now "standard".
2011-06-26: Now you can put the plasmoid in the system tray.
2011-06-25: Fixed bug with default options.
2011-06-24: Fixed bug with Redshift.
openDesktop.org :
simgunz
5 years ago
Report
Mogger
5 years ago
Unfortunately, I ran into two issues that prevent me from using it:
1. The defunct problem mentioned on page 1. An idea may be to look how gtk-redshift does it, it seems to work reliably for me.
2. The settings are not saved between Plasma sessions, at least not when the widget is in the system tray. Don't know if it's related to this bug: https://bugs.kde.org/show_bug.cgi?id=260685
Finally, three suggestions:
a) Put some sensible default values in the options.
b) Detect if user has a config file (e.g. ~/.config/redshift.conf).
c) Activity support! This would be a killer feature - e.g. deactivate f.lux/redshift for your Movie and Presentation activity.
Report
msarahan
6 years ago
Just wanted to let people know about a problem I encountered. I was getting the "Could not create a python ScriptEngine instance" error message on Ubuntu 11.10. I had Enthought Python Distribution installed in my home folder, and was prepending the path to the EPD python executable in my .bash_profile file.
Removing the prepend fixes this issue. This is a bug somewhere upstream in KDE, I think - they should not be using
#!/usr/bin/env python
instead, they should hard-code to the system python to avoid these troubles.
The code for this plasmoid has no such references, so it must be somewhere upstream.
Report
avlas
5 years ago
Report
qwerty12
6 years ago
However, I did have problems with defunct processes and the applet not stopping Redshift properly so I hacked it to use KProcess instead to start and manage its process. KProcess (as it is derived from QProcess) has signals that are emitted when a process is started/stopped, removing the need to keep a timer, for one.
This is a hack, however, and I only link to the patch as a reference of sorts.
I made the following changes:
Remove the Unknown state and use the same light bulb icon when the applet is on. Though it could be useful if self.process.state() == QProcess.Starting...
Remove f.lux support. I'm too lazy to perform the changes for f.lux, too, and I don't use f.lux because it's closed and couldn't maintain a dimmed state on my computer.
Use KProcess to start and manage the process - instead of the timer, use QProcess's signals
Send SIGUSR1 instead of terminating/suspending the process to change Redshift's state
Now I can click on the widget when it's running and have Redshift start/stop depending on the state accordingly. Killing Redshift manually from the terminal will change the applet's icon back to the offline one and I can press the applet's button to have it start up Redshift again.
http://pastebin.com/zxMK5Rvp
Report
diegc
6 years ago
Anyway, thanks again for the coding and the effort you put :)
Report
ateholiz
6 years ago
Report
qwerty12
6 years ago
Report
ateholiz
6 years ago
Report
diegc
6 years ago
I promised myself to work in the issue, but time is not a thing that I have in great quantities right now...
Report
simgunz
6 years ago
When xflux is running I can't turn it of.
This is the result of ps:
0 Z 1000 18989 18955 0 80 0 - 0 exit pts/1 00:00:00 xflux <defunct>
1 S 1000 18990 1 0 80 0 - 1206 hrtime pts/1 00:00:00 xflux
There are two xflux process, so the command "pidof xflux" return two id, and the plasmoid can't get the status of the program. ("Unknow status" is printed)
Report
diegc
6 years ago
Report
simgunz
6 years ago
It's strange that two xflux process are launched and one of it die even with only one instance of the widget.
Report
diegc
6 years ago
[1] Using kill -9 to terminate the program doesn't seem like a good idea. Being programs that affect screen properties, I'd rather wait for them to exit themselves normally.
PS: I'm thinking about using kill -9 in cases like this, when you end up with zombie processes... but first I'd like to confirm if this happens frequently.
Report
simgunz
6 years ago
Another suggestion: do not reimplement the showconfiguration interface. If you comment out this function you'll see a dialog like all the others plasma settings dialog. Then you have just to add a name and an icon to the page that you are adding in createconfigurationinterface.
Report
diegc
6 years ago
About os.waitpid, I'll try to take a look at it tomorrow and see what I can do. Thanks again.
Report
diegc
6 years ago
In the next few days I won't have much time, but next week I intend to do some research about finding zombie or unresponsive processes so I can send the appropiate signal to each one.
Report
simgunz
6 years ago
Report
simgunz
6 years ago
Report
diegc
6 years ago
Report
simgunz
6 years ago
Report
diegc
6 years ago
Report
hcartiaux
6 years ago
I have read your code, you want to use os.waitpid and os.kill, but these methods are directly supported by the class Popen.
If you only use your Popen object, I think it would be simpler, you can use the following methods from Popen :
* send_signal to send a SIGUSR (toggle on and off redshift)
* poll, to get the returncode and know if the process is running or not
* wait
* kill (SIGKILL signal), and terminate (SIGTERM)
I've made some tests using methods from Popen, and your plasmoid do not produce defunct processes. ;)
But it requires to update the code of checkstatus and updatestatus, and I don't have enough time for that.
Report
diegc
6 years ago
I'll take a deeper look into it when I have time, because using SIGUSR instead of SIGTERM/SIGKILL to stop redshift will require to rewrite a great portion of the plasmoid.
Report
simgunz
6 years ago
X-Plasma-NotificationArea=true
it can be possible to put the plasmoid in the system tray (from system tray settings).
I like to put it in the tray.
Report