Skip to content

Fake blue light filter using Hyprland's shader functionality. Useful when a device does not support changing the gamma, like the Raspberry Pi 4B.

License

Notifications You must be signed in to change notification settings

edermats32/hyprsunder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hyprsunder

logo
Logo font: https://velvetyne.fr/fonts/facade/

Background

The Raspberry Pi 4 firmware does not support changing the gamma. See this issue: raspberrypi/firmware#1274
But I really can't live without my blue light filter.

So as a workaround I made this script that utilizes Hyprland's built in shader functionallity.
If you do not have this problem, you probably want to use hyprsunset instead.

I also did not write the shader myself, it's stolen from here: hyprwm/Hyprland#1140 (comment)
hyprsunder is merely a way to change the value of the shaders temperature and temperature strength variables.

Some comments with fake variables are added to the shaderfile. These are used to store the values during toggling:

// Memory values used by hyprsunder"
// temperatureMem = 2600.0;"
// temperatureStrengthMem = 1.0;"
// stateMem = on;"

Installation

Create this directory if you haven't already:

mkdir $HOME/.local/bin

git clone this repo:

git clone https://github.com/edermats32/hyprsunder.git

Copy the files to their default locations:

cp ./hyprsunder/hyprsunder.glsl $HOME/.config/hypr/
cp ./hyprsunder/hyprsunder $HOME/.local/bin/

Make hyprsunder executable

chmod +x $HOME/.local/bin/hyprsunder

Usage

Parameters

Parameter Short Description
--toggle -o Change the on/off state (toggle if empty)
--temperature -t Change the temperature
--strength -s Change the temperature strength
--print -p Print the current configuration
--help -h The help page, basically this

If run without any parameters, it will just load the current configuration.

Practical examples

Set the temperature and temperature strength

$HOME/.local/bin/hyprsunder -t <float> -s <float>

Example:

$HOME/.local/bin/hyprsunder -t 2500.0 -s 1.0

Increase the temperature and temperature strength

$HOME/.local/bin/hyprsunder -t +<float> -s +<float>

Example:

$HOME/.local/bin/hyprsunder -t +500.0 -s +0.1

Decrease the temperature and temperature strength

$HOME/.local/bin/hyprsunder -t -<float> -s -<float>

Example:

$HOME/.local/bin/hyprsunder -t -500.0 -s -0.1

Toggle on/off

$HOME/.local/bin/hyprsunder -o

Hyprland configuration example

# Start hyprsunder and load the configuration at startup
exec-once = $HOME/.local/bin/hyprsunder

# Some keybind examples
# Only mute works here??? Fuck it, don't care (maybe try sh -c <command> i'm to lazy atm)
#bind = $mainMod, XF86AudioRaiseVolume, exec, $HOME/.local/bin/hyprsunder -t +300.0
#bind = $mainMod, XF86AudioLowerVolume, exec, $HOME/.local/bin/hyprsunder -t -300.0
#bind = $mainMod, XF86AudioForward, exec, $HOME/.local/bin/hyprsunder -s +0.1
#bind = $mainMod, XF86AudioBack, exec, $HOME/.local/bin/hyprsunder -s -0.1
bind = $mainMod, XF86AudioMute, exec, $HOME/.local/bin/hyprsunder -o

About

Fake blue light filter using Hyprland's shader functionality. Useful when a device does not support changing the gamma, like the Raspberry Pi 4B.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published