From 804ab9e72a6fe85b8d9e2f9c86e948096b03c525 Mon Sep 17 00:00:00 2001 From: retrozinndev Date: Sat, 5 Apr 2025 19:47:33 -0300 Subject: [PATCH] :recycle: hypr(scripts/night-light): move script to hypr/scripts --- hypr/autostart.conf | 3 ++- hypr/scripts/night-light-check.sh | 6 +++--- hypr/scripts/night-light.sh | 17 +++++++++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 hypr/scripts/night-light.sh diff --git a/hypr/autostart.conf b/hypr/autostart.conf index f0785a7..ab9992c 100644 --- a/hypr/autostart.conf +++ b/hypr/autostart.conf @@ -7,7 +7,8 @@ # Services/Daemons -exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 +# exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 +exec-once = systemctl enable --user --now hyprpolkitagent exec-once = systemctl enable --user --now hypridle exec-once = systemctl enable --user --now gnome-keyring-daemon exec-once = wl-paste --type text --watch cliphist store diff --git a/hypr/scripts/night-light-check.sh b/hypr/scripts/night-light-check.sh index 31a226c..8b88a05 100644 --- a/hypr/scripts/night-light-check.sh +++ b/hypr/scripts/night-light-check.sh @@ -8,7 +8,7 @@ # From https://github.com/retrozinndev/Hyprland-Dots -if [[ -f "$HOME/.cache/night-light.pid" ]]; then - rm "$HOME/.cache/night-light.pid" - sh $HOME/.config/eww/scripts/night-light.sh +if [[ -f "$XDG_CACHE_HOME/night-light.pid" ]]; then + rm "$XDG_CACHE_HOME/night-light.pid" + sh $XDG_CONFIG_HOME/hypr/scripts/night-light.sh fi diff --git a/hypr/scripts/night-light.sh b/hypr/scripts/night-light.sh new file mode 100644 index 0000000..e4e546f --- /dev/null +++ b/hypr/scripts/night-light.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +set -e + +pidfile="$HOME/.cache/night-light.pid" +temperature=4500 # in K + +# run only if pid file does not exist +if ! [[ -f $pidfile ]]; then + touch $pidfile + hyprsunset -t $temperature & + _pid=$! + echo -e $_pid > $pidfile + wait $_pid && rm -f $pidfile +else + echo "There's already an instance running! Mistake? Delete \"~/.cache/night-light.pid\"." + exit 1 +fi