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
|
function check_night_mode
|
||||||
set target_process wlsunset
|
set target_process hyprsunset
|
||||||
|
|
||||||
if pgrep $target_process >/dev/null
|
if pgrep $target_process >/dev/null
|
||||||
echo "{ \"text\":\"\", \"tooltip\": \"night-mode <span color='#a6da95'>on</span>\", \"class\": \"on\" }"
|
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
|
function night_mode_toggle
|
||||||
set target_process wlsunset
|
set target_process hyprsunset
|
||||||
|
set temp_file ~/.cache/hyprsunset_temp
|
||||||
|
|
||||||
if pgrep $target_process >/dev/null
|
if pgrep $target_process >/dev/null
|
||||||
killall -s SIGINT wlsunset
|
killall -s SIGINT $target_process
|
||||||
else
|
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
|
||||||
end
|
end
|
||||||
|
@@ -223,7 +223,10 @@
|
|||||||
|
|
||||||
"custom/night_mode": {
|
"custom/night_mode": {
|
||||||
"return-type": "json",
|
"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",
|
"exec": "fish -c check_night_mode",
|
||||||
"on-click": "fish -c night_mode_toggle",
|
"on-click": "fish -c night_mode_toggle",
|
||||||
},
|
},
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
hyprlock
|
hyprlock
|
||||||
hypridle
|
hypridle
|
||||||
hyprpaper
|
hyprpaper
|
||||||
|
hyprsunset
|
||||||
hyprpolkitagent
|
hyprpolkitagent
|
||||||
|
|
||||||
inputs.wezterm.packages.${pkgs.system}.default
|
inputs.wezterm.packages.${pkgs.system}.default
|
||||||
|
@@ -4,7 +4,6 @@
|
|||||||
programs.light.enable = true;
|
programs.light.enable = true;
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
wlsunset
|
|
||||||
brightnessctl
|
brightnessctl
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user