My Nix Infra
nix nixos
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

notify volume and brightness change

ydcjeff 7ac03dd2 d5f100c0

+42 -6
+32
bin/ez-cmd-hwctl
··· 1 + #!/usr/bin/env bash 2 + 3 + usage() { 4 + echo "Usage: $0 <volume|brightness> <up|down|toggle>" 5 + } 6 + 7 + if [[ $# -ne 2 ]]; then 8 + usage 9 + exit 1 10 + fi 11 + 12 + if [[ "$1" == "volume" ]]; then 13 + case "$2" in 14 + "up") wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05+ -l 1.0 ;; 15 + "down") wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05- ;; 16 + "toggle") wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle ;; 17 + esac 18 + vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | cut -d' ' -f2)" 19 + status="$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | cut -d' ' -f3)" 20 + vol="${vol/./}" # remove dot 21 + vol="${vol#0}" # remove leading 0 22 + notify-send -u normal "Volume: $vol% $status" 23 + elif [[ "$1" == "brightness" ]]; then 24 + case "$2" in 25 + "up") brightnessctl set 5%+ ;; 26 + "down") brightnessctl set 5%- ;; 27 + esac 28 + current="$(brightnessctl get)" 29 + max="$(brightnessctl max)" 30 + ratio="$(awk -v c="$current" -v m="$max" 'BEGIN { print(c/m*100) }')" 31 + notify-send -u normal "Brightness: $ratio%" 32 + fi
+5 -5
config/niri/config.kdl
··· 155 155 Mod+B repeat=false hotkey-overlay-title="Open a Browser" { spawn "firefox"; } 156 156 Mod+P repeat=false hotkey-overlay-title="Open Command Palette" { spawn "ez-cmd-palette"; } 157 157 158 - XF86AudioRaiseVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.05+" "-l" "1.0"; } 159 - XF86AudioLowerVolume allow-when-locked=true { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.05-"; } 160 - XF86AudioMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"; } 158 + XF86AudioRaiseVolume allow-when-locked=true { spawn "ez-cmd-hwctl" "volume" "up"; } 159 + XF86AudioLowerVolume allow-when-locked=true { spawn "ez-cmd-hwctl" "volume" "down"; } 160 + XF86AudioMute allow-when-locked=true { spawn "ez-cmd-hwctl" "volume" "toggle"; } 161 161 XF86AudioMicMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle"; } 162 - XF86MonBrightnessUp allow-when-locked=true { spawn "brightnessctl" "set" "5%+"; } 163 - XF86MonBrightnessDown allow-when-locked=true { spawn "brightnessctl" "set" "5%-"; } 162 + XF86MonBrightnessUp allow-when-locked=true { spawn "ez-cmd-hwctl" "brightness" "up"; } 163 + XF86MonBrightnessDown allow-when-locked=true { spawn "ez-cmd-hwctl" "brightness" "down"; } 164 164 165 165 Mod+O repeat=false { toggle-overview; } 166 166 Mod+Q repeat=false { close-window; }
+5 -1
modules/desktop.nix
··· 85 85 name = "ez-cmd-palette"; 86 86 text = builtins.readFile ../bin/ez-cmd-palette; 87 87 }) 88 + (pkgs.writeShellApplication { 89 + name = "ez-cmd-hwctl"; 90 + text = builtins.readFile ../bin/ez-cmd-hwctl; 91 + }) 88 92 adwaita-icon-theme 89 93 kdePackages.breeze-icons 90 94 ]; ··· 116 120 services.mako = { 117 121 enable = true; 118 122 settings = { 119 - padding = 12; 123 + padding = 16; 120 124 border-radius = 4; 121 125 default-timeout = 5000; 122 126 "mode=do-not-disturb" = {