diff --git a/nixos/flake.lock b/nixos/flake.lock index de6ae4c..2124167 100644 --- a/nixos/flake.lock +++ b/nixos/flake.lock @@ -62,11 +62,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1760862643, - "narHash": "sha256-PXwG0TM7Ek87DNx4LbGWuD93PbFeKAJs4FfALtp7Wo0=", + "lastModified": 1763334038, + "narHash": "sha256-LBVOyaH6NFzQ3X/c6vfMZ9k4SV2ofhpxeL9YnhHNJQQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "33c6dca0c0cb31d6addcd34e90a63ad61826b28c", + "rev": "4c8cdd5b1a630e8f72c9dd9bf582b1afb3127d2c", "type": "github" }, "original": { @@ -77,11 +77,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1760878510, - "narHash": "sha256-K5Osef2qexezUfs0alLvZ7nQFTGS9DL2oTVsIXsqLgs=", + "lastModified": 1763283776, + "narHash": "sha256-Y7TDFPK4GlqrKrivOcsHG8xSGqQx3A6c+i7novT85Uk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5e2a59a5b1a82f89f2c7e598302a9cacebb72a67", + "rev": "50a96edd8d0db6cc8db57dab6bb6d6ee1f3dc49a", "type": "github" }, "original": { @@ -174,11 +174,11 @@ ] }, "locked": { - "lastModified": 1760998189, - "narHash": "sha256-ee2e1/AeGL5X8oy/HXsZQvZnae6XfEVdstGopKucYLY=", + "lastModified": 1763417348, + "narHash": "sha256-n5xDOeNN+smocQp3EMIc11IzBlR9wvvTIJZeL0g33Fs=", "owner": "Mic92", "repo": "sops-nix", - "rev": "5a7d18b5c55642df5c432aadb757140edfeb70b3", + "rev": "3f66a7fb9626a9a9c077612ef10a0ce396286c7d", "type": "github" }, "original": { @@ -265,11 +265,11 @@ ] }, "locked": { - "lastModified": 1761105987, - "narHash": "sha256-d01CGcdNlsqIn4ncGCWHM0Velnii/Ggef1iybQvEOfc=", + "lastModified": 1763352549, + "narHash": "sha256-hzLnXm0v1snDENpF3KvUQBO8XOAh45qg+y4D46K3rz8=", "owner": "youwen5", "repo": "zen-browser-flake", - "rev": "e7d9fefd8665be5d4c77466140f21a15f6d29e93", + "rev": "5d002fcacbc5423090f2bba19818adda471fe0c8", "type": "github" }, "original": { diff --git a/nixos/modules/desktop/waybar/default.nix b/nixos/modules/desktop/waybar/default.nix index 273e4ce..d893470 100644 --- a/nixos/modules/desktop/waybar/default.nix +++ b/nixos/modules/desktop/waybar/default.nix @@ -14,5 +14,7 @@ in { ]; programs.waybar.enable = true; + + services.atd.enable = true; # Command scheduler }; } diff --git a/scripts/sunset.sh b/scripts/sunset.sh deleted file mode 100755 index f185115..0000000 --- a/scripts/sunset.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash -# Script to disable for an hour or immediately continue wlsunset. 'Toggle' - -# Check if wlsunset is still running -pid=$(pgrep wlsunset) - -if [[ -z ${pid} ]] ; then - # Start wlsunset right away. - wlsunset -l 50.50 -L 4.00 -t 3000 -T 6500 & -else - # Currently stop wlsunset but restart in an hour. - kill ${pid} - notify-send 'Stopping sunset' 'Restarting in an hour' - at now +1 hours -f "${0}" -fi diff --git a/scripts/toggle-nightlight.sh b/scripts/toggle-nightlight.sh new file mode 100755 index 0000000..b4902b0 --- /dev/null +++ b/scripts/toggle-nightlight.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash +# Script to disable for an hour or immediately continue wlsunset. 'Toggle' + +# Queue for at, check man page for options +ATQUEUE='T' + +# Get current state +pid=$(pgrep wlsunset) + +while getopts ":g" option; do + case "${option}" in + g) + if [[ -z "${pid}" ]]; then + state='active' + tooltip='Turn off nightlight' + class='activated' + else + state='inactive' + tooltip='Turn on nightlight' + class='none' + fi +printf '{"alt": "%s", "tooltip": "%s", "class": "%s" }' \ + "${state}" "${tooltip}" "${class}" + exit 0 + ;; + *) + echo 'Invalid option' + exit 1 + ;; + esac +done + +# Toggle +if [[ -z ${pid} ]] ; then + # Clear queue + for job in $(at -l -q "${ATQUEUE}" | cut -f1); do + at -r "${job}" + done + + if [ "$( command -v wlsunset )" ]; then + notify-send 'Starting nightlight' + wlsunset -l 50.50 -L 4.00 -t 3000 -T 6500 & + else + notify-send 'Nightlight is not available' + exit 1 + fi +else + # Currently stop wlsunset but restart in an hour. + kill ${pid} + notify-send 'Stopping nightlight' 'Restarting in an hour' + at now +1 hours -f "${0}" -q "${ATQUEUE}" +fi diff --git a/stow/waybar/.config/waybar/config.jsonc b/stow/waybar/.config/waybar/config.jsonc index ff861e3..a83d47c 100644 --- a/stow/waybar/.config/waybar/config.jsonc +++ b/stow/waybar/.config/waybar/config.jsonc @@ -51,6 +51,7 @@ "privacy", "tray", "group/control-center", + "group/display", "group/network", "pulseaudio", "group/power", diff --git a/stow/waybar/.config/waybar/modules.json b/stow/waybar/.config/waybar/modules.json index 6cec15d..683d70b 100644 --- a/stow/waybar/.config/waybar/modules.json +++ b/stow/waybar/.config/waybar/modules.json @@ -1,4 +1,15 @@ { + "backlight": { + "device": "intel_backlight", + "format": "{percent}% {icon}", + "format-icons": [ + "\uf111", /*  */ + "\uf185" /*  */ + ], + "on-click": "brightnessctl -sq set 0", + "on-click-right": "wl-mirror $(hyprctl monitors -j | jq --raw-output '.[] | select(.focused) | .name')" + }, + "battery": { "format": "{capacity}% {icon}", "format-alt": "{time} {icon}", @@ -71,6 +82,12 @@ "tooltip": false }, + "custom/display": { + "format": "\ue163", /*  */ + "tooltip": false, + "on-click": "wdisplays" + }, + "custom/meta": { "format": "\uf17c", /*  */ "tooltip": false, @@ -134,6 +151,19 @@ "tooltip": true }, + "custom/toggle-nightlight": { + "exec": "bash ${SCRIPT_DIR}/toggle-nightlight.sh -g", + "interval": 60, + "return-type": "json", + "on-click": "bash ${SCRIPT_DIR}/toggle-nightlight.sh", + "format": "{icon}", + "format-icons": { + "active": "\uf186", /*  */ + "inactive": "\uf0eb" /*  */ + }, + "tooltip": true + }, + "custom/toggle-notifications": { "exec": "bash ${SCRIPT_DIR}/toggle-notifications.sh -g", "interval": 60, @@ -163,12 +193,31 @@ "group/control-center": { "orientation": "inherit", "modules": [ + /* Preview */ "custom/control-center", + /* Left-most */ "group/language", - /* "hyprland/language", "sway/language", */ - "custom/toggle-notifications", + "custom/toggle-notifications" + /* Right-most */ + ], + "drawer": { + "transition-duration": 500, + "transition-left-to-right": false, + "children-class": "drawer-child" + } + }, + + "group/display": { + "orientation": "inherit", + "modules": [ + /* Preview */ + "custom/display", + /* Most-left */ + "idle_inhibitor", + "custom/toggle-nightlight", "custom/toggle-light-dark", - "bluetooth" + "backlight" + /* Most-right */ ], "drawer": { "transition-duration": 500, @@ -199,6 +248,7 @@ /* Preview */ "network", /* Most-left */ + "bluetooth", "custom/toggle-tailscale" /* Most-right */ ], @@ -220,8 +270,7 @@ "custom/system-hibernate", "custom/system-sleep", "custom/system-lock", - "power-profiles-daemon", - "idle_inhibitor" + "power-profiles-daemon" /* Most-right */ ], "drawer": { diff --git a/stow/waybar/.config/waybar/style.css b/stow/waybar/.config/waybar/style.css index ecc08fc..39880dd 100644 --- a/stow/waybar/.config/waybar/style.css +++ b/stow/waybar/.config/waybar/style.css @@ -82,12 +82,13 @@ window#waybar { #privacy, #privacy-item, #privacy-item.screenshare, -#privacy-item.audio-in { +#privacy-item.audio-in, +#privacy-item.audio-out { background-color: @safety; } -#privacy-item.screenshare { - background-color: #000000; +#privacy-item { + padding: 0; } #pulseaudio.muted {