mirror of
https://github.com/XNM1/linux-nixos-hyprland-config-dotfiles.git
synced 2025-09-15 09:45:58 +03:00
feat(night-mode): 🌙 Switch from wlsunset to hyprsunset and add temperature control
- Replace wlsunset with hyprsunset for better Hyprland integration - Add temperature adjustment functions with scroll support in Waybar - Implement persistent temperature storage in `~/.cache/hyprsunset_temp` - Add temperature bounds (2000K-6500K) with 100K increment/decrement steps - Update NixOS configuration to include hyprsunset package Fixes temperature persistence and improves Hyprland compatibility
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
function check_night_mode
|
||||
set target_process wlsunset
|
||||
set target_process hyprsunset
|
||||
|
||||
if pgrep $target_process >/dev/null
|
||||
echo "{ \"text\":\"\", \"tooltip\": \"night-mode <span color='#a6da95'>on</span>\", \"class\": \"on\" }"
|
||||
|
27
home/.config/fish/functions/night_mode_temp_down.fish
Normal file
27
home/.config/fish/functions/night_mode_temp_down.fish
Normal file
@@ -0,0 +1,27 @@
|
||||
function night_mode_temp_down
|
||||
set target_process hyprsunset
|
||||
set temp_file ~/.cache/hyprsunset_temp
|
||||
set decrement 100
|
||||
|
||||
if not pgrep $target_process >/dev/null
|
||||
return
|
||||
end
|
||||
|
||||
if test -f $temp_file
|
||||
set current_temp (cat $temp_file)
|
||||
else
|
||||
set current_temp 4000
|
||||
end
|
||||
|
||||
set new_temp (math $current_temp - $decrement)
|
||||
|
||||
if test $new_temp -lt 2000
|
||||
set new_temp 2000
|
||||
end
|
||||
|
||||
echo $new_temp >$temp_file
|
||||
|
||||
killall -s SIGINT $target_process
|
||||
sleep 0.5
|
||||
$target_process -t $new_temp
|
||||
end
|
27
home/.config/fish/functions/night_mode_temp_up.fish
Normal file
27
home/.config/fish/functions/night_mode_temp_up.fish
Normal file
@@ -0,0 +1,27 @@
|
||||
function night_mode_temp_up
|
||||
set target_process hyprsunset
|
||||
set temp_file ~/.cache/hyprsunset_temp
|
||||
set increment 100
|
||||
|
||||
if not pgrep $target_process >/dev/null
|
||||
return
|
||||
end
|
||||
|
||||
if test -f $temp_file
|
||||
set current_temp (cat $temp_file)
|
||||
else
|
||||
set current_temp 4000
|
||||
end
|
||||
|
||||
set new_temp (math $current_temp + $increment)
|
||||
|
||||
if test $new_temp -gt 6500
|
||||
set new_temp 6500
|
||||
end
|
||||
|
||||
echo $new_temp >$temp_file
|
||||
|
||||
killall -s SIGINT $target_process
|
||||
sleep 0.5
|
||||
$target_process -t $new_temp
|
||||
end
|
@@ -1,9 +1,16 @@
|
||||
function night_mode_toggle
|
||||
set target_process wlsunset
|
||||
set target_process hyprsunset
|
||||
set temp_file ~/.cache/hyprsunset_temp
|
||||
|
||||
if pgrep $target_process >/dev/null
|
||||
killall -s SIGINT wlsunset
|
||||
killall -s SIGINT $target_process
|
||||
else
|
||||
wlsunset
|
||||
if test -f $temp_file
|
||||
set temp (cat $temp_file)
|
||||
else
|
||||
set temp 4000
|
||||
echo $temp >$temp_file
|
||||
end
|
||||
$target_process -t $temp
|
||||
end
|
||||
end
|
||||
|
@@ -223,7 +223,10 @@
|
||||
|
||||
"custom/night_mode": {
|
||||
"return-type": "json",
|
||||
"interval": 1,
|
||||
"restart-interval": 1,
|
||||
"on-scroll-down": "fish -c night_mode_temp_up",
|
||||
"on-scroll-up": "fish -c night_mode_temp_down",
|
||||
"smooth-scrolling-threshold": 2.0,
|
||||
"exec": "fish -c check_night_mode",
|
||||
"on-click": "fish -c night_mode_toggle",
|
||||
},
|
||||
|
Reference in New Issue
Block a user