jumper149 / blugon Goto Github PK
View Code? Open in Web Editor NEWsimple and configurable Blue Light Filter for X
License: Apache License 2.0
simple and configurable Blue Light Filter for X
License: Apache License 2.0
$ /usr/bin/blugon -r
Traceback (most recent call last):
File "/usr/bin/blugon", line 327, in read_current
file_current = open(CONFIG_FILE_CURRENT, 'r')
FileNotFoundError: [Errno 2] No such file or directory: '/home/user/.config/blugon/current'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/blugon", line 555, in <module>
main()
File "/usr/bin/blugon", line 486, in main
CURRENT = read_current()
File "/usr/bin/blugon", line 331, in read_current
'To create this file use:\n' + ' blugon --setcurrent=' + str(NORMAL_TEMP))
ValueError: current configuration file not found at:
/home/user/.config/blugon/current
To create this file use:
blugon --setcurrent=6600.0
$ /usr/bin/blugon -p
[main]
readcurrent = False
interval = 120
backend = scg
wait_for_x = False
fade = False
[current]
min_temp = 1.0
max_temp = 20000.0
[wait_for_x]
sleep_after_failed_startup = 0.1
sleep_after_losing_x = 120.0
[fade]
steps = 10
duration = 3.0
[tty]
color0 = 000000
color1 = aa0000
color2 = 00aa00
color3 = aa5500
color4 = 0000aa
color5 = aa00aa
color6 = 00aaaa
color7 = aaaaaa
color8 = 555555
color9 = ff5555
color10 = 55ff55
color11 = ffff55
color12 = 5555ff
color13 = ff55ff
color14 = 55ffff
color15 = ffffff
$ blugon -V
Using gamma configuration file: '/home/user/.config/blugon/gamma'
Using fallback gamma configuration file: '/usr/share/blugon/configs/default/gamma'
Provide current minute 54.35
Calculated RGB Gamma values: 1.0 0.806038888888889 0.5701296296296297
Calling backend scg
Wait for 120 seconds
commit a77a202 (HEAD -> makepkg, origin/master, origin/HEAD, master)
Hello, I would want it to run all the time and not only at night.
When I try to run blugon.py
the error appears
Traceback (most recent call last):
File "C:\Users\astrosander\Desktop\blugon-1.12.1\blugon.py", line 43, in <module>
CONFIG_DIR = getenv('HOME') + '/.config'
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
[Finished in 92ms]
How can I solve it
(Windows 11)
Hello, just to let people know about fixing this issue.
Just after run systemctl --user enable blugon.service, at reboot, the service didn't start, giving (on systemctl --user status...) this error message telling "start request repeated too quickly". To fix it:
edit the service file (~/.config/systemd///blugon.service) and change the line RestartSec=0 to a slower value ; I put mine to 15 sec (RestartSec=15).
Now everything is working fine!
Thanks jumper for this light and efficient little programm !
I'm wondering what bluegon can do better/different from Redshift? Maybe you should also add that to the README.md.
Is is possible to use this tool to filter certain (X) windows with different colors or shades?
Whenever I run the make file in the directory, I am encountering this issue : undefined reference to `XOpenDisplay' for the file scg.c. I tried manually linking lX11, still the issue persists. I am running Ubuntu 20.04.
I noticed that the blugon service wasn't running after reboot. journalctl showed
-- Reboot --
Jan 16 18:02:03 archlinux systemd[1029]: Started Blue Light Filter.
Jan 16 18:02:04 archlinux systemd[1029]: blugon.service: Main process exited, code=exited, status=11/n/a
Jan 16 18:02:04 archlinux systemd[1029]: blugon.service: Failed with result 'exit-code'.
Jan 16 18:02:04 archlinux systemd[1029]: blugon.service: Service RestartSec=100ms expired, scheduling restart.
Jan 16 18:02:04 archlinux systemd[1029]: blugon.service: Scheduled restart job, restart counter is at 1.
Jan 16 18:02:04 archlinux systemd[1029]: Stopped Blue Light Filter.
The following 4 tries failed the same way.
I installed blugon using the AUR, and I'm using X, lightdm and awesomeWM.
Starting the service manually works fine.
I'm trying to make a script that turns on and off blugon, and for that I need to check whether the light-filter is applied or not. Problem is, blugon's process is already dead milisecond later is executed, so there's no process to check. There is other method to tell the filter is up? I'm using the svg backend, and started blugon with an autostart.sh script
Hello!
I am on Manjaro 18.1 and I have installed blugon from the Arch AUR.
When I try to enable the blugon service only for the user, I get the following:
$ sudo systemctl --user enable blugon.service
Failed to connect to bus: No such file or directory
When I try to enable blugon system-wide, I get the following:
$ sudo systemctl enable blugon.service
Failed to enable unit: Unit file blugon.service does not exist.
Please let me know what else do you need to investigate this issue.
Thanks!
Unless I'm missing something, the call for XRRGetCrtcInfo
does nothing and can be removed (tested):
Line 32 in 44b908e
from man 3 XCloseDisplay
The XCloseDisplay function closes the connection to the X server for
the display specified in the Display structure ...
...
Before exiting, you should call XCloseDisplay explicitly so that any pending
errors are reported as XCloseDisplay performs a final XSync operation.
an XRRFreeScreenResources
might be nice too, so something like the following:
diff --git a/backends/scg/scg.c b/backends/scg/scg.c
index 57951dc..f152a80 100644
--- a/backends/scg/scg.c
+++ b/backends/scg/scg.c
@@ -41,14 +41,16 @@ int main(int argc, char **argv) {
crtc_gamma->green[i] = g * gamma_g;
crtc_gamma->blue[i] = g * gamma_b;
}
XRRSetCrtcGamma(dpy, crtcxid, crtc_gamma);
XFree(crtc_gamma);
}
+ XRRFreeScreenResources(res);
+ XCloseDisplay(dpy);
return 0;
}
/*
* This program is based on 'sct'.
* Source: https://https.www.google.com.tedunangst.com/flak/post/sct-set-color-temperature
* https://https.www.google.com.tedunangst.com/flak/files/sct.c
I installed blugon using yay on Arch with Xorg and i3-gaps. I can't stop it.
~ $ blugon
^C (ctrl+c)
~ $ killall blugon
blugon: no process found
~ $ kill blugon
kill: illegal pid: blugon
ps -x
, ps aux
, gotop
can't find the blugon. Blue filter is still enabled.
At present and with default config, xscreensaver disables blugon when a screensaver is activated. Is there a way to have blugon run on top of screensavers?
I use sxhkd and use key binding for blugon
blugon --setcurrent="+100"
and
blugon --setcurrent="-100"
The command works initially but after a short moment it reverts back and I have to use the command again via bindings.
Any help on how to make the command work permanently would be appreciated.
I wanted to inquire whether Blugon can be used without X in the Linux console? As far as I understand, Blugon is similar to Redshift and adjusts the color temperature of the screen based on the time of day. However, I am currently using Linux without X and was wondering if Blugon could still function properly.
Thank you for your response in advance!
Because dpy
here[1] will be null when running eg. blugon -b scg -r -o
:
[1]
Line 10 in 44b908e
and there's no check & graceful exit.
The exit code for the above command is 11
, but when running scg
backend directly, on tty(rather than inside X), the segfault can be seen, eg.:
/lib/blugon/scg 1.0 0.6949030005552019 0.4310480202110507
$ /lib/blugon/scg 1.0 0.6949030005552019 0.4310480202110507
[ 1627.389262] scg[93373]: segfault at e0 ip 000055e14ea4d0dd sp 00007ffca8ec6e00 error 4 in scg[55e14ea4d000+1000]
[ 1627.390830] Code: 00 00 00 00 00 00 00 00 00 00 00 00 00 41 57 41 56 41 55 49 89 f5 41 54 55 89 fd 31 ff 53 48 83 ec 28 e8 a6 ff ff ff 48 89 c3 <48> 63 80 e0 00 00 00 48 89 df 48 c1 e0 07 48 03 83 e8 00 00 00 48
[ 1627.392435] potentially unexpected fatal signal 11.
[ 1627.394046] CPU: 1 PID: 93373 Comm: scg Kdump: loaded Tainted: G I 5.4.10-g7a02c193298e #46
[ 1627.397178] RIP: 0033:0x55e14ea4d0dd
[ 1627.398696] Code: 00 00 00 00 00 00 00 00 00 00 00 00 00 41 57 41 56 41 55 49 89 f5 41 54 55 89 fd 31 ff 53 48 83 ec 28 e8 a6 ff ff ff 48 89 c3 <48> 63 80 e0 00 00 00 48 89 df 48 c1 e0 07 48 03 83 e8 00 00 00 48
[ 1627.400266] RSP: 002b:00007ffca8ec6e00 EFLAGS: 00010202
[ 1627.401848] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000090
[ 1627.403418] RDX: 0000000000000080 RSI: 00007ffca8ec6f48 RDI: 00007ff2eb6f5090
[ 1627.404968] RBP: 0000000000000004 R08: 0000000000000000 R09: 0000000000000000
[ 1627.406527] R10: 000055e14ea4c52c R11: 00007ff2eb680840 R12: 000055e14ea4d280
[ 1627.408031] R13: 00007ffca8ec6f48 R14: 0000000000000000 R15: 0000000000000000
[ 1627.409483] FS: 00007ff2eb414d80 GS: 0000000000000000
[ 1627.423791] systemd[1]: Started Process Core Dump (PID 93385/UID 0).
Segmentation fault (core dumped)
[ 1627.938066] systemd-coredump[93393]: Process 93373 (scg) of user 1000 dumped core.
[ 1627.938066]
[ 1627.938066] Stack trace of thread 93373:
[ 1627.938066] #0 0x000055e14ea4d0dd main (scg + 0x10dd)
[ 1627.938066] #1 0x00007ff2eb49e1b6 __libc_start_main (libc.so.6 + 0x271b6)
[ 1627.938066] #2 0x000055e14ea4d2ae _start (scg + 0x12ae)
[ 1627.938066]
[ 1627.948951] systemd[1]: [email protected]: Succeeded.
or this can also reproduce it:
$ DISPLAY= /lib/blugon/scg 1.0 0.6949030005552019 0.4310480202110507
Segmentation fault (core dumped)
$ DISPLAY= blugon -b scg -r -o; echo "exit code:$?"
exit code:11
I didn't want to make a PR for this because i don't know how you want this handled (if ever), but the idea is something like this:
///...
#include <stdio.h> /* fprintf */
///...
Display *dpy = XOpenDisplay(NULL);
//If XOpenDisplay does not succeed, it returns NULL.
if (NULL == dpy) {
fprintf(stderr, "X is not running? or cannot open a connection to it. Is DISPLAY env var set?\n");
return 1; // exit code 1
}
Hi,
I had blugon intalled and working fine on linux mint but after re-installing my linux mint I don't seem to be able to install blugon again.
Here is the error I get:
~/blugon$ make
sed "s|MAKE_INSTALL_PREFIX = '.*'|MAKE_INSTALL_PREFIX = '/usr'|g" blugon.py > blugon
sed "s|MAKE_INSTALL_PREFIX|/usr|g" systemd/user/blugon.service > blugon.service
gzip --best --force --keep blugon.1
cd backends/scg && make build
make[1]: Entering directory '/home/flo/blugon/backends/scg'
gcc -O2 -std=c11 -D_POSIX_C_SOURCE=200809L -Wall -Wextra -Wpedantic -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXrandr -o scg scg.c
scg.c:1:10: fatal error: errno.h: No such file or directory
#include <errno.h>
^~~~~~~~~
compilation terminated.
Makefile:7: recipe for target 'build' failed
make[1]: *** [build] Error 1
make[1]: Leaving directory '/home/flo/blugon/backends/scg'
Makefile:5: recipe for target 'build' failed
make: *** [build] Error 2
I have tried with a older release (1.11.4) but I get the same mistake... I'm quite puzzled because it was working just fine before...
Any idea what I could try?
Thank you!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.