Skip to content

Commit 547afe0

Browse files
zeerayneMetalhearfprime-runkRHYME7actions-user
authored
fixup: manage hyprsunset through hyprctl to avoid color flickering (#613)
* feat: add @Metalhearf to the Collaborators list (#564) * updated CONTRIBUTORS (#568) * Update CONTRIBUTORS.md * feat: trigger new release refresh * fixup: manage `hyprsunset` through `hyprctl` to avoid color flickering * fixup: fetch current running temp only when required * fixup: use `--quiet` flag for hyprctl instead of `> /dev/null` --------- Co-authored-by: Metalhearf <[email protected]> Co-authored-by: prime-run <[email protected]> Co-authored-by: Khing <[email protected]> Co-authored-by: GitHub Actions Bot <[email protected]>
1 parent c319958 commit 547afe0

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

Configs/.local/lib/hyde/hyprsunset.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,20 +97,24 @@ esac
9797
# Send notification if enabled
9898
[ "$notify" = true ] && send_notification
9999

100-
# Fetch current running temperature
101-
current_running_temp=$(pgrep -a hyprsunset | grep -- '--temperature' | awk '{for(i=1;i<=NF;i++) if ($i ~ /--temperature/) print $(i+1)}')
100+
# Ensure that hyprsunset process is running
101+
if ! pgrep -x "hyprsunset" > /dev/null; then
102+
hyprsunset > /dev/null &
103+
fi
102104

103105
if [ "$action" = "read" ]; then
104-
if [ "$toggle_mode" -eq 1 ] && [ "$current_running_temp" != "$currentTemp" ]; then
105-
pkill -x hyprsunset
106-
hyprsunset --temperature "$currentTemp" >/dev/null &
106+
if [ "$toggle_mode" -eq 1 ]; then
107+
# Fetch current running temperature
108+
current_running_temp=$(hyprctl hyprsunset temperature)
109+
if [ "$current_running_temp" != "$currentTemp" ]; then
110+
hyprctl --quiet hyprsunset temperature "$currentTemp"
111+
fi
107112
fi
108113
else
109-
pkill -x hyprsunset
110114
if [ "$toggle_mode" -eq 0 ]; then
111-
hyprsunset -i >/dev/null &
115+
hyprctl --quiet hyprsunset identity
112116
else
113-
hyprsunset --temperature "$newTemp" >/dev/null &
117+
hyprctl --quiet hyprsunset temperature "$newTemp"
114118
fi
115119
fi
116120

0 commit comments

Comments
 (0)