hyprshade -> hyprsunset

This commit is contained in:
Hadi
2024-11-05 10:59:34 +01:00
parent f343ef25d2
commit 8d5eefced0
2 changed files with 42 additions and 32 deletions

View File

@@ -34,7 +34,6 @@
}; };
hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1";
hyprpolkitagent.url = "github:hyprwm/hyprpolkitagent"; hyprpolkitagent.url = "github:hyprwm/hyprpolkitagent";
hyprsunset.url = "github:hyprwm/hyprsunset";
hyprpanel.url = "github:Jas-SinghFSU/HyprPanel"; hyprpanel.url = "github:Jas-SinghFSU/HyprPanel";
stylix.url = "github:danth/stylix"; stylix.url = "github:danth/stylix";
apple-fonts.url = "github:Lyndeno/apple-fonts.nix"; apple-fonts.url = "github:Lyndeno/apple-fonts.nix";

View File

@@ -1,50 +1,61 @@
# - ## Night-Shift # - ## Night-Shift
#- #-
#- Night-Shift is a feature that reduces the amount of blue light emitted by your screen, which can help reduce eye strain and improve sleep quality. This module provides a set of scripts to control Night-Shift on your system. #- Night-Shift is a feature that reduces the amount of blue light emitted by your screen, which can help reduce eye strain and improve sleep quality. This module provides a set of scripts to control Night-Shift on your system.
#- It use hyprsunset to control the screen temperature.
#- #-
#- - `night-shift-on` activates Night-Shift. #- - `night-shift-on` activates Night-Shift.
#- - `night-shift-off` deactivates Night-Shift. #- - `night-shift-off` deactivates Night-Shift.
#- - `night-shift` toggles Night-Shift. #- - `night-shift` toggles Night-Shift.
#- - `night-shift-status` checks if Night-Shift is active. (0/1) #- - `night-shift-status` checks if Night-Shift is active. (0/1)
#- - `night-shift-status-icon` checks if Night-Shift is active. (icon) #- - `night-shift-status-icon` checks if Night-Shift is active. (icon)
{ inputs, pkgs, ... }: { pkgs, ... }:
let let
value = "4500"; # Default value for night-shift temperature
night-shift-on = pkgs.writeShellScriptBin "night-shift-on" '' night-shift-on = pkgs.writeShellScriptBin "night-shift-on"
${pkgs.hyprshade}/bin/hyprshade on blue-light-filter # bash
title="󰖔 Night-Shift Activated" ''
description="Night-Shift is now activated! Your screen will be warmer and easier on the eyes." ${pkgs.hyprsunset}/bin/hyprsunset -t ${value} &
title="󰖔 Night-Shift Activated"
description="Night-Shift is now activated! Your screen will be warmer and easier on the eyes."
notif "night-shift" "$title" "$description" notif "night-shift" "$title" "$description"
''; '';
night-shift-off = pkgs.writeShellScriptBin "night-shift-off" '' night-shift-off = pkgs.writeShellScriptBin "night-shift-off"
${pkgs.hyprshade}/bin/hyprshade off # bash
title="󰖕 Night-Shift Deactivated" ''
description="Night-Shift is now deactivated! Your screen will return to normal." pkill hyprsunset
title="󰖕 Night-Shift Deactivated"
description="Night-Shift is now deactivated! Your screen will return to normal."
notif "night-shift" "$title" "$description" notif "night-shift" "$title" "$description"
''; '';
night-shift = pkgs.writeShellScriptBin "night-shift" '' night-shift = pkgs.writeShellScriptBin "night-shift"
if [[ $(${pkgs.hyprshade}/bin/hyprshade current) ]]; then # bash
night-shift-off ''
else if pidof "hyprsunset"; then
night-shift-on night-shift-off
fi else
''; night-shift-on
fi
'';
night-shift-status = pkgs.writeShellScriptBin "night-shift-status" '' night-shift-status = pkgs.writeShellScriptBin "night-shift-status"
if [[ $(${pkgs.hyprshade}/bin/hyprshade current) ]]; then # bash
echo "1" ''
else if pidof "hyprsunset"; then
echo "0" echo "1"
fi else
''; echo "0"
fi
'';
night-shift-status-icon = night-shift-status-icon = pkgs.writeShellScriptBin "night-shift-status-icon"
pkgs.writeShellScriptBin "night-shift-status-icon" '' # bash
if [[ $(hyprshade current) ]]; then ''
if pidof "hyprsunset"; then
echo "󰖔" echo "󰖔"
else else
echo "󰖕" echo "󰖕"
@@ -52,7 +63,7 @@ let
''; '';
in { in {
home.packages = [ home.packages = [
inputs.hyprsunset.packages."${pkgs.system}".hyprsunset pkgs.hyprsunset
night-shift-on night-shift-on
night-shift-off night-shift-off
night-shift night-shift