Page 1 of 1

Redshift Gui Light Alternative (portable)

Posted: Fri Aug 21, 2020 2:20 pm
by fredx181

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 2429 times
rshift-portable-32-v4.tar.gz
Redshift portable 32-bit, extract and run rshift-portable-32-v4
(198.13 KiB) Downloaded 8 times
rshift-portable-64-v4.tar.gz
Redshift portable 64-bit, extract and run rshift-portable-64-v4
(201.24 KiB) Downloaded 14 times
rshift-portable-wary-v3.tar.gz
Redshift portable Wary, extract and run rshift-portable-wary
(242.84 KiB) Downloaded 117 times

Re: Redshift Gui Light Alternative (portable)

Posted: Wed Feb 24, 2021 8:15 am
by yuan

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


Re: Redshift Gui Light Alternative (portable)

Posted: Sun Nov 21, 2021 12:25 pm
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!


Re: Redshift Gui Light Alternative (portable)

Posted: Sun Nov 21, 2021 12:36 pm
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


Re: Redshift Gui Light Alternative (portable)

Posted: Tue Nov 23, 2021 4:59 pm
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


Re: Redshift Gui Light Alternative (portable)

Posted: Fri Nov 08, 2024 2:00 am
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.


Re: Redshift Gui Light Alternative (portable)

Posted: Fri Nov 08, 2024 3:23 am
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. ;)


Re: Redshift Gui Light Alternative (portable)

Posted: Fri Nov 08, 2024 8:41 am
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).