Redshift Gui Light Alternative (portable)

Moderator: Forum moderators

Post Reply
User avatar
fredx181
Posts: 3159
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 386 times
Been thanked: 1356 times
Contact:

Redshift Gui Light Alternative (portable)

Post by fredx181 »

Update 23-12-2024, version 5, using 'backlight' now for reducing brightness, more info: viewtopic.php?p=138611#p138611
Added attachments for 32 and 64 bit (v5) below.

Update 08-11-2024, v4 with fix from @BarryK , see viewtopic.php?p=135185#p135185
New attachments for 32 and 64 bit below.

Earlier shared Here
Inspired by Mike Walsh's Brightness & colour temperature control for desktop PCs, here's a more extended version that supports redshift's automatic day and night colour transition (if in "Auto mode")
If Auto mode is not selected, then it works just the same as Mike's version (e.g. ScreenControl_redshift-v1.4)

Similar apps already existing, e.g:
https://sourceforge.net/projects/redshiftgui/
Or (more simple, python based):
https://github.com/mlsteele/redshift-gui

This portable version uses yad (notification icon and sliders to adjust the values) and the redshift command line utility.

Both (yad and redshift) I compiled on Debian Wheezy, tested (and works) on Puppy Lucid, Raring, Slacko, Tahr, Stretch (and should work also on later Puppy versions)
Also on Debiandog, Xenialdog, Bionicdog, Busterdog, Fossadog
Also separate "wary" version attached, works on Wary or other older puppies with minimal Xorg version.

From the Help (right-click on the icon):

Quote:
*** Redshift Manual mode and Auto mode ***

  • Manual: First time run, the Manual mode is enabled.
    Left click the icon and adjust color temp. and brightness.

  • Auto: Right-click the icon and select 'Redshift Auto mode'.
    The timezone and time must be correctly set to make this work well.
    First time run, it will get your geo location (the coordinates: latitude, longitude)
    A network connection is required for that.
    The file $HOME/.rshift/geo-info contains this info.
    Remove it if you travel to another country or city.
    (then it will be re-configured again)
    Left click on the icon to adjust day and night color temp.
    To get back to Manual Mode, click 'Redshift Auto mode' again.

Portable: includes yad (v 0.38 ) and redshift (v 1.11) (self-extractable script) so NOT needed to have yad and redshift installed.

Required is "curl" for getting geo location (but should be installed by default in most systems)

Extract 32 or 64 bit attached tar.gz and just click on e.g. rshift-portable-32 and the icon should appear in the system-tray.
To have it loaded at boot/logon, place it in ~/Startup

Fred

Redshift auto-mode
Redshift auto-mode
redshift-auto-mode.png (331.28 KiB) Viewed 2751 times
rshift-portable32-v5.tar.gz
Redshift portable 32-bit v5, extract and run rshift-portable-32-v5
(196.34 KiB) Downloaded 4 times
rshift-portable64-v5.tar.gz
Redshift portable 64-bit v5, extract and run rshift-portable-64-v5
(201.38 KiB) Downloaded 8 times
rshift-portable-32-v4.tar.gz
Redshift portable 32-bit, extract and run rshift-portable-32-v4
(198.13 KiB) Downloaded 21 times
rshift-portable-64-v4.tar.gz
Redshift portable 64-bit, extract and run rshift-portable-64-v4
(201.24 KiB) Downloaded 33 times
rshift-portable-wary-v3.tar.gz
Redshift portable Wary, extract and run rshift-portable-wary
(242.84 KiB) Downloaded 130 times
yuan
Posts: 11
Joined: Fri Nov 27, 2020 5:41 pm

Re: Redshift Gui Light Alternative (portable)

Post by yuan »

Hi,fredx181
How do I change tray of rshift-portable icon and size?

User avatar
BarryK
Posts: 2780
Joined: Tue Dec 24, 2019 1:04 pm
Has thanked: 142 times
Been thanked: 767 times

Re: Redshift Gui Light Alternative (portable)

Post by BarryK »

@fredx181
Fred, I have just tried your v3, and for me the red shift only works one-way.
If I slide left, increasing redness, then the screens gets redder, as expected. However, if I slide back up, the screen does not get less red.
If I slide down again, the screen gets redder than before.

I am running on a PC with 8th gen i3 CPU, inbuilt gpu, so pretty standard. redshift is version 1.12, compiled like so:

# ./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc --build=x86_64-pc-linux-gnu --with-systemduserunitdir=no --disable-apparmor --disable-ubuntu --disable-gui

I pulled out the redshift slider code, made a separate test script:

Code: Select all

#!/bin/bash

  killall redshift 2> /dev/null 
  redshift -l : -O $(cat $HOME/.rshift/clr_temp 2> /dev/null) -b $(awk "BEGIN {print $(cat $HOME/.rshift/BR_value 2> /dev/null)/100}") 1>/dev/null
  TCur=$(cat $HOME/.rshift/clr_temp 2> /dev/null) 
  TMax="6500" 
  TMin="2400" 

#  yad --plug="$fkey" --tabnum=1 --undecorated --on-top --borders 5 --text="        Redshift Color Temp. Setting" --scale --value $TCur --print-partial --min-value $TMin --max-value $TMax | 
  yad  --undecorated --on-top --borders 5 --text="        Redshift Color Temp. Setting" --scale --value $TCur --print-partial --min-value $TMin --max-value $TMax |
  while read TNew; do 
   echo $TNew > $HOME/.rshift/clr_temp 
   echo "RUN: redshift -l : -O $TNew -b $(awk "BEGIN {print $(cat $HOME/.rshift/BR_value 2> /dev/null)/100}") 1>/dev/null"
   redshift -l : -O $TNew -b $(awk "BEGIN {print $(cat $HOME/.rshift/BR_value 2> /dev/null)/100}") 1>/dev/null 
  done #& #run loop in the background.

redshift is being fed values correctly:

Code: Select all

# ./test1
RUN: redshift -l : -O 6483 -b 1 1>/dev/null
RUN: redshift -l : -O 6449 -b 1 1>/dev/null
RUN: redshift -l : -O 6415 -b 1 1>/dev/null
RUN: redshift -l : -O 6380 -b 1 1>/dev/null
RUN: redshift -l : -O 6415 -b 1 1>/dev/null
RUN: redshift -l : -O 6449 -b 1 1>/dev/null
RUN: redshift -l : -O 6466 -b 1 1>/dev/null
RUN: redshift -l : -O 6483 -b 1 1>/dev/null
RUN: redshift -l : -O 6500 -b 1 1>/dev/null
RUN: redshift -l : -O 6466 -b 1 1>/dev/null
RUN: redshift -l : -O 6432 -b 1 1>/dev/null
RUN: redshift -l : -O 6398 -b 1 1>/dev/null
RUN: redshift -l : -O 6329 -b 1 1>/dev/null
RUN: redshift -l : -O 6295 -b 1 1>/dev/null
RUN: redshift -l : -O 6329 -b 1 1>/dev/null
RUN: redshift -l : -O 6346 -b 1 1>/dev/null
RUN: redshift -l : -O 6363 -b 1 1>/dev/null
RUN: redshift -l : -O 6398 -b 1 1>/dev/null
RUN: redshift -l : -O 6432 -b 1 1>/dev/null
RUN: redshift -l : -O 6466 -b 1 1>/dev/null
RUN: redshift -l : -O 6500 -b 1 1>/dev/null

...but it still only works one-way, gets redder only.

So, I replaced the redshift 1.12 that I had compiled, with the binary from your x64 portable, and hey, it works!

User avatar
BarryK
Posts: 2780
Joined: Tue Dec 24, 2019 1:04 pm
Has thanked: 142 times
Been thanked: 767 times

Re: Redshift Gui Light Alternative (portable)

Post by BarryK »

The obvious next thing to do, I downloaded version 1.11 source, configured it exactly as above...

and it works!

I have reported the problem:

https://github.com/jonls/redshift/issues/854

User avatar
fredx181
Posts: 3159
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 386 times
Been thanked: 1356 times
Contact:

Re: Redshift Gui Light Alternative (portable)

Post by fredx181 »

BarryK wrote:

I downloaded version 1.11 source, configured it exactly as above...

and it works!

Thanks Barry, yes, the 1.12 version is behaving weird for me too, looks like the "one shot manual mode (set color temperature)" (-O) option doesn't work properly.

EDIT: I experimented using 1.12 by adding -P option (Reset existing gamma ramps before applying new color effect) (so, replaced "-O" with "-P -O") and it works as it should, perhaps the thing is that it is required for the newer 1.12 version.
E.g:
redshift -P -O 2500
and back to 6500:
redshift -P -O 6500

User avatar
BarryK
Posts: 2780
Joined: Tue Dec 24, 2019 1:04 pm
Has thanked: 142 times
Been thanked: 767 times

Re: Redshift Gui Light Alternative (portable)

Post by BarryK »

@fredx181
EasyOS has your rshift, the guys like it. I also use it on one of my laptops that has a too-bright screen.

I've received a request. In manual mode, it doesn't pre-load the BR_value and clr_temp value; you have to click on the tray icon to activate them. This is in manual mode. The request is, could this be done when rshift starts up.

Yeah, me too. On my too-bright laptop, I have to click the tray icon at every startup.

I have inserted this, near the beginning of the script, just after loading the default values:

Code: Select all

mkdir -p $HOME/.rshift
[ -z "$(cat $HOME/.rshift/BR_value 2> /dev/null)" ] && echo 100 > $HOME/.rshift/BR_value
[ -z "$(cat $HOME/.rshift/clr_temp 2> /dev/null)" ] && echo 6500 >  $HOME/.rshift/clr_temp

#20241108
if [ ! -f $HOME/.rshift/rshift_auto_mode ];then
 killall redshift  2> /dev/null
 redshift -l : -O $(cat $HOME/.rshift/clr_temp 2> /dev/null) -b $(awk "BEGIN {print $(cat $HOME/.rshift/BR_value 2> /dev/null)/100}") 1>/dev/null
fi

Does that look reasonable to you?
I suppose the "killall redshift" is superfluous.

User avatar
mikewalsh
Moderator
Posts: 6250
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 825 times
Been thanked: 2016 times

Re: Redshift Gui Light Alternative (portable)

Post by mikewalsh »

@fredx181 / @BarryK :-

Perhaps the issue now being displayed on current versions in mainstream distros is affecting things here, too......where 'standard' RedShift no longer connects to the geo-location server? Maybe this has fed through to the CLI version, and is screwing things up somehow?

Just a thought, like.... Feel free to ignore this if not relevant.

Mike. ;)

User avatar
fredx181
Posts: 3159
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 386 times
Been thanked: 1356 times
Contact:

Re: Redshift Gui Light Alternative (portable)

Post by fredx181 »

BarryK wrote: Fri Nov 08, 2024 2:00 am

@fredx181
EasyOS has your rshift, the guys like it. I also use it on one of my laptops that has a too-bright screen.

I've received a request. In manual mode, it doesn't pre-load the BR_value and clr_temp value; you have to click on the tray icon to activate them. This is in manual mode. The request is, could this be done when rshift starts up.

Yeah, me too. On my too-bright laptop, I have to click the tray icon at every startup.

I have inserted this, near the beginning of the script, just after loading the default values:

Code: Select all

mkdir -p $HOME/.rshift
[ -z "$(cat $HOME/.rshift/BR_value 2> /dev/null)" ] && echo 100 > $HOME/.rshift/BR_value
[ -z "$(cat $HOME/.rshift/clr_temp 2> /dev/null)" ] && echo 6500 >  $HOME/.rshift/clr_temp

#20241108
if [ ! -f $HOME/.rshift/rshift_auto_mode ];then
 killall redshift  2> /dev/null
 redshift -l : -O $(cat $HOME/.rshift/clr_temp 2> /dev/null) -b $(awk "BEGIN {print $(cat $HOME/.rshift/BR_value 2> /dev/null)/100}") 1>/dev/null
fi

Does that look reasonable to you?
I suppose the "killall redshift" is superfluous.

Yes, tried that and it's a good fix, thanks. (yes, without killall redshift).

Updated First post with new attachments including the fix (v4).

User avatar
fredx181
Posts: 3159
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 386 times
Been thanked: 1356 times
Contact:

Re: Redshift Gui Light Alternative (portable)

Post by fredx181 »

*** Updated redshift-portable ***

Reading the topic "How to lower the screen brightness?" in the EasyOs section about redshift's brightness adjustment setting and specially here: viewtopic.php?p=137753#p137753, inspired me to make some changes for the redshift-portable program. Thanks for the info, @SteveS .

Version 5: for adjusting brightness it is using 'backlight' now (from /sys/class/backlight/*) .
(btw, note: brightness setting is only available in the "manual" mode)

Attachments (v5) at first post

EDIT: @BarryK please test and then perhaps update to this v5 in EasyOs.
EDIT2: Forgot to mention earlier: In case that backlight setting is not available (on your computer), the brightness adjusting will be handled by redshift .

Post Reply

Return to “Desktop”