raphaelquintao / QRedshiftCinnamon

Linux Cinnamon applet to change screen color temperature
https://cinnamon-spices.linuxmint.com/applets/view/313
Apache License 2.0
93 stars 12 forks source link

redshift config file being unreadable causes qredshift to silently fail) #27

Closed dilinger closed 3 years ago

dilinger commented 3 years ago

This is on a debian testing (bullseye) machine, with cinnamon 4.8.6-1 and redshift 1.12-4.

QRedshift is not working for me; when enabled, the screen doesn't change colors. Redshift itself works in the background, but the applet does not. I added some debugging info to doCommand() and redShiftUpdate():

` doCommand(command) { let [success, out] = GLib.spawn_command_line_sync(command); qLOG('success=' + success.toString()); if (!success || out == null) { qLOG('failed'); return; } let resp = out.toString(); qLOG('response: ' + resp.replace(/(?:\r\n|\r|\n)/g, ' '));

    let period = resp.match(/Period:.+/g);
    if (period && period[0]) {
        this.opt.period = period[0].split(':')[1].trim();
        qLOG('period=' + this.opt.period);
    }
}

redShiftUpdate() {
    qLOG('killall redshift');
    Util.killall('redshift');
    if (this.opt.enabled) {

[...] // Util.spawnCommandLine(cmd); this.doCommand(cmd); qLOG('doCommand(' + cmd + ')'); `

Here's what I see in the log when I enable the applet:

Cjs-Message: 21:54:24.070: JS LOG: [LookingGlass/warning] "killall redshift" Cjs-Message: 21:54:24.170: JS LOG: [LookingGlass/warning] "success=true" Cjs-Message: 21:54:24.170: JS LOG: [LookingGlass/warning] "response: " Cjs-Message: 21:54:24.171: JS LOG: [LookingGlass/warning] "doCommand(redshift -c /home/dilinger/.local/share/cinnamon/applets/qredshift@quintao/assets/base.conf -P -r -v -o -m randr -m randr -l 40.7229:-73.8473 -t 5900:1956 -b 0.84:0.84 -g 1 )"

As you can see, there's no error, but at the same time the response is empty (but also not null). When I run that redshift command manually, here's what I see:

dilinger@e7470:~$ redshift -c /home/dilinger/.local/share/cinnamon/applets/qredshift@quintao/assets/base.conf -P -r -v -o -m randr -m randr -l 40.7229:-73.8473 -t 5900:1956 -b 0.84:0.84 -g 1 fopen: Permission denied Unable to load config file. dilinger@e7470:~$ ls -l /home/dilinger/.local/share/cinnamon/applets/qredshift@quintao/assets/base.conf -rwxr-xr-x 1 dilinger dilinger 189 Feb 17 20:21 /home/dilinger/.local/share/cinnamon/applets/qredshift@quintao/assets/base.conf dilinger@e7470:~$ redshift -P -r -v -o -m randr -m randr -l 40.7229:-73.8473 -t 5900:1956 -b 0.84:0.84 -g 1 Solar elevations: day above 3.0, night below -6.0 Temperatures: 5900K at day, 1956K at night Brightness: 0.84:0.84 Gamma (Daytime): 1.000, 1.000, 1.000 Gamma (Night): 1.000, 1.000, 1.000 Waiting for current location to become available... Location: 40.72 N, 73.85 W Solar elevation: -48.688133 Period: Night Color temperature: 1956K Brightness: 0.84 dilinger@e7470:~$ head -n2 /home/dilinger/.local/share/cinnamon/applets/qredshift@quintao/assets/base.conf [redshift] temp-day=6500

I'm not entirely sure why I'm getting that weird permission error from redshift. I realize that base.conf is shipped with the applet, and completely removing qredshift and readding it (using the applets manager from cinnamon-settings) results in the same permissions problem. So there's really two issues here - the first is the permission issue, and the second is that doCommand silently fails if there's an issue with the config file.

dilinger commented 3 years ago

Oh, see that it is apparmor blocking the reading of the config file (#23).

raphaelquintao commented 3 years ago

Can you confirm if is fixed on the version 1.5.4?

dilinger commented 3 years ago

Sorry, I had some problems w/ cinnamon leaking memory and ended up switching to something else, so I can't test it any more.