-
Notifications
You must be signed in to change notification settings - Fork 1
Home
jamessouth edited this page Jun 24, 2023
·
14 revisions
After downloading the script, update the displays
and profiles
arrays:
- to get your displays, run
xrandr --listmonitors | awk '{print $4}' ORS=' '
- each profile is a set of
red:green:blue
gamma output corrections
#!/usr/bin/env bash
displays=(eDP-1)
profiles=(
1:1:1
1:.97:.94
1:.93:.88
1:.90:.81
1:.86:.73
1:.82:.64
1:.77:.54
1:.71:.42
1:.68:.35
1:.64:.28
1:.59:.18
1:.54:.08
1:.32:.03
1:.18:.01
)
config="${XDG_DATA_HOME:-$HOME/.local/share}/$(basename "$0" .sh)"
source "$config"
len=${#profiles[@]}
case "$1" in
"+" ) new_ind=$((ind+1 > len-1 ? len-1 : ind+1));;
"-" ) new_ind=$((ind-1 < 0 ? 0 : ind-1));;
esac
new_prof="${profiles[$new_ind]}"
for display in "${displays[@]}"; do
xrandr --output "$display" --gamma "${new_prof}"
done
echo "ind=${new_ind}" > "$config"
echo "${new_prof}"
modules-left/center/right = ... nightlight ...
enable-ipc = true
[module/nightlight]
include-file = /home/username/.config/polybar/nightlight
In your nightlight
module file/section:
type = custom/ipc
#your formatting
initial = 1
hook-0 = bash ~/.config/polybar/nightlight.sh -
hook-1 = bash ~/.config/polybar/nightlight.sh +
scroll-up = "#nightlight.hook.0"
scroll-down = "#nightlight.hook.1"
#also available: click-left/middle/right, double-click-left/right
If you have set the $XDG_DATA_HOME
environment variable, the script will maintain state there in a file called nightlight
. If not, ~/.local/share/nightlight
is used as a fallback per the XDG specification. To initialize the state file simply restart your window manager or desktop environment to restart polybar. This will silently error the first time since the file is source
d before it exists but then it will be ok. Click/scroll to move among your various r:g:b
profiles in nightlight.sh
.