Redshift or other screen temp

New features which should be implemented in Porteus; suggestions are welcome. All questions or problems with testing releases (alpha, beta, or rc) should go in their relevant thread here, rather than the Bug Reports section.
User avatar
Rava
Contributor
Contributor
Posts: 5460
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Redshift or other screen temp

Post#16 by Rava » 25 Apr 2024, 21:10

Rava wrote:
29 Nov 2023, 13:20
But I have other things to concern about more pressing, so I might be able to do the fine tuning much later today, but most likely it will take me a few days.
LOL, a few days turned into a few months.
The issue is, why is there no uniform way addressing colour temperature, so that one setting e.g. 4500k translates into the very same colour temperature, regardless what software you use.

While using a simple xrandr script would free some meagre system resources, for now redshiftgui works as I want it, so I keep it for now.

The only issue that I mentioned somewhere is a bug in its settings file.
I even created an empty file that explains the issue to me:

Code: Select all

/home/guest/.redshiftgrc_map_needs_to_be_comma-separated_instead_of_|-separated
:D Because redshiftgui will write its settings as "|-separated", so you have to exit is, correct its map settings manually to be comma-separated and start redshiftgui anew.
Cheers!
Yours Rava

vinnie
Shogun
Shogun
Posts: 333
Joined: 13 Jun 2024, 08:25
Distribution: gnemesis!

Redshift or other screen temp

Post#17 by vinnie » 23 Mar 2025, 12:32

I would like to add a command to the list:
xcalib -blue 1 0 1 -green 1 0 1 -a

This is perhaps a bit extreme but it's for who want a little vampire experience :)

xcalib -c
to stop the massacre

vinnie
Shogun
Shogun
Posts: 333
Joined: 13 Jun 2024, 08:25
Distribution: gnemesis!

Redshift or other screen temp

Post#18 by vinnie » 03 Mar 2026, 01:25

I used Redshift but I didn't like it so much that it is based on the time zone, I prefer to activate and deactivate the filter when I want.
I tried with xrandr but the result is a bit strange, it doesn't seem that all the colors are changed uniformly.
I then tried with xcalib and the result seemed more homogeneous. Then I made a script and linked it to two buttons on the xfce panel, I'll share the script if anyone is interested.

Code: Select all

#!/bin/bash

#HELP
help="\
Decreases the blue light of the screen and after the brightness.
Proceeds by step (preset to 25%) but does not blacken the screen or exceed 100%.
It uses xcalib and does not consider the screem hardware backlight.
- decrease
+ increase
0 reset
"
for i in "${@}"; do
	if [ "${i}" = "--help" ] || [ "${i}" = "-h" ]; then
		echo "${help}"
		exit #return 0
	fi
done


SCR=$(xrandr | grep Screen | head -1 | cut -d " " -f 2 | head -c -2)
STEP=4              #number of steps
STEP=$((100/STEP))  #with 4 the step is 25%
RMIN=25             #not less than 25$ 

#Ccontrol current gamma
cal_gamma() {
    gammas=$(echo $(xcalib -l -a -v | grep Contrast | cut -d " " -f 7))
    gred=$(printf '%.*f\n' 0 $(printf %s "$gammas" | cut -d " " -f 1)) #| tail -3 | head -1))
    ggrn=$(printf '%.*f\n' 0 $(printf %s "$gammas" | cut -d " " -f 2)) #| tail -2 | head -1))
    gblu=$(printf '%.*f\n' 0 $(printf %s "$gammas" | cut -d " " -f 3)) #| tail -1 | head -1))
    echo $gred $ggrn $gblu
}

#i must declare variables another time because i don't know how to export these outside the functin
gammas=$(cal_gamma)
gred=$(printf %s "$gammas" | cut -d " " -f 1)
ggrn=$(printf %s "$gammas" | cut -d " " -f 2)
gblu=$(printf %s "$gammas" | cut -d " " -f 3)



#if I ask for increase
if [[ "$1" == "Up" || "$1" == "+" ]]; then
    if [[ $gred -lt 100 ]]; then
        #increase the red
        [[ $gred -eq $RMIN ]] && gred=$((100-STEP*((100-RMIN-1)/STEP))) || gred=$((gred+STEP))
        [[ $gred -gt 100 ]] && gred=100
    else if [[ $gblu -lt 100 ]]; then
        #increase green and blue
        [[ $gblu -eq 1 ]] && gblu=$((100-STEP*((100-STEP)/STEP))) || gblu=$((ggrn+STEP))
        ggrn=$gblu
        fi
    fi
fi

#iff I ask for decrease
if [[ "$1" == "Down" || "$1" == "-" ]]; then
    if [[ $gblu -eq 1 ]]; then
        #decrease red
        gred=$((gred-STEP))
        [[ $gred -lt $RMIN ]] && gred=$RMIN
    else
        #decrease green and blue
        [[ $ggrn -lt $((STEP*2)) ]] && ggrn=1 || ggrn=$((ggrn-STEP))
        [[ $gblu -lt $((STEP*2)) ]] && gblu=1 || gblu=$((gblu-STEP))
    fi
fi

#if I ask reset
if [[ "$1" == "Reset" || "$1" == "0" ]]; then
    if [[ $gammas != "100 100 100" ]]; then
        xcalib -a -s ${SCR} -c
        echo "100 100 100"
    else
        echo "${gammas}: no changes"
    fi
    exit
fi

#avoid to change anything if there is no change (avoid flashing)
newgammas=$(echo $gred $ggrn $gblu)
if [[ $gammas == $newgammas ]]; then
    echo "${gammas}: no changes"
    exit
fi

#apply increase or decrease
if [[ "$1" == "Up" || "$1" == "+" || "$1" == "Down" || "$1" == "-" ]]; then
        #apply changes
        xcalib -a -s ${SCR} -c        
        #xcalib -a -s ${SCR} -red 1.0 0 ${gred} -green 1.0 0 ${ggrn} -blue 1.0 0 ${gblu}
        xcalib -a -s ${SCR} -red 1.0 0 ${gred} -green 1.0 0 ${ggrn} -blue 1.0 0 ${gblu} &>/dev/null
fi

#print changes
gammas=$(cal_gamma)
echo ${gammas}

vinnie
Shogun
Shogun
Posts: 333
Joined: 13 Jun 2024, 08:25
Distribution: gnemesis!

Redshift or other screen temp

Post#19 by vinnie » 09 Mar 2026, 11:00

I found this https://github.com/Jahamars/easygamma and I tried it on nemesis. It works but I think it uses xrandr because the effect is the same. I'll point it out if anyone is interested. When you start it, a small interface starts with the three sliders of the primary colors plus the master. Then it goes on the tray (40mb ram occupied), if you close it the settings remain the same. I continue to use xgamma anyway because the effect is different.

nanZor
Warlord
Warlord
Posts: 547
Joined: 09 Apr 2019, 03:27
Distribution: Porteus / PorteuX on f2fs usb

Redshift or other screen temp

Post#20 by nanZor » 18 May 2026, 22:03

I use GAMMASTEP these days. Easy. Defaults to wayland, but I switch it to X11 with the -m option:

Night:

Code: Select all

gammastep -m randr -O 4500 -b 0.7
Day: (just disables it)

Code: Select all

gammastep -m randr -x
I make it an executable shell script and typically drop it to the desktop for one-click action. I don't use the geoclue thing, so just fire it up in this one-shot fashion.
That's a UNIX book - cool. -Garth

vinnie
Shogun
Shogun
Posts: 333
Joined: 13 Jun 2024, 08:25
Distribution: gnemesis!

Redshift or other screen temp

Post#21 by vinnie » 19 May 2026, 04:30

Nice, the result is like xcalib but the interface is more simple.
The only "strange" behaviour is that the option -b everytime subdivide the "brightness" for the value specified, it's not a absolute value

nanZor
Warlord
Warlord
Posts: 547
Joined: 09 Apr 2019, 03:27
Distribution: Porteus / PorteuX on f2fs usb

Redshift or other screen temp

Post#22 by nanZor » 20 May 2026, 06:58

Update for gammastep:

When running under Wayland, the way to stop it differs from the X11 command. Under wayland, just

Code: Select all

pkill -USR1 gammastep
I just incorporated gammastep with PorteuX 2.6 xfce-wayland session to make sure, switched to wayland. This dual capability of gammastep with either X11 or Wayland has made it my standard go to like this.
That's a UNIX book - cool. -Garth

Post Reply