diff --git a/home/.config/fish/functions/check_night_mode.fish b/home/.config/fish/functions/check_night_mode.fish index 840c108..dbff9ba 100644 --- a/home/.config/fish/functions/check_night_mode.fish +++ b/home/.config/fish/functions/check_night_mode.fish @@ -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 on\", \"class\": \"on\" }" diff --git a/home/.config/fish/functions/night_mode_temp_down.fish b/home/.config/fish/functions/night_mode_temp_down.fish new file mode 100644 index 0000000..f3b6155 --- /dev/null +++ b/home/.config/fish/functions/night_mode_temp_down.fish @@ -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 diff --git a/home/.config/fish/functions/night_mode_temp_up.fish b/home/.config/fish/functions/night_mode_temp_up.fish new file mode 100644 index 0000000..49ca0cf --- /dev/null +++ b/home/.config/fish/functions/night_mode_temp_up.fish @@ -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 diff --git a/home/.config/fish/functions/night_mode_toggle.fish b/home/.config/fish/functions/night_mode_toggle.fish index 2eb3167..7965b01 100644 --- a/home/.config/fish/functions/night_mode_toggle.fish +++ b/home/.config/fish/functions/night_mode_toggle.fish @@ -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 diff --git a/home/.config/waybar/config b/home/.config/waybar/config index b432f27..ad9c741 100644 --- a/home/.config/waybar/config +++ b/home/.config/waybar/config @@ -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", }, diff --git a/nixos/hyprland.nix b/nixos/hyprland.nix index e55b141..1c5e997 100644 --- a/nixos/hyprland.nix +++ b/nixos/hyprland.nix @@ -19,6 +19,7 @@ hyprlock hypridle hyprpaper + hyprsunset hyprpolkitagent inputs.wezterm.packages.${pkgs.system}.default diff --git a/nixos/screen.nix b/nixos/screen.nix index 3d5dd06..429521c 100644 --- a/nixos/screen.nix +++ b/nixos/screen.nix @@ -4,7 +4,6 @@ programs.light.enable = true; environment.systemPackages = with pkgs; [ - wlsunset brightnessctl ]; }