From c4a76219c9f99dc5f4dd746ce76672597dd01633 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 14 Jun 2024 22:00:56 +0100 Subject: [PATCH] call nix packages in script --- .../scripts/dunstify-volume-notification.nix | 8 ++++---- .../desktop/dwm/scripts/sb-mem-pct.nix | 2 +- .../optional/desktop/dwm/scripts/sb-volume.nix | 18 +++--------------- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/home/common/optional/desktop/common/x11/scripts/dunstify-volume-notification.nix b/home/common/optional/desktop/common/x11/scripts/dunstify-volume-notification.nix index 612e26d..92b0905 100644 --- a/home/common/optional/desktop/common/x11/scripts/dunstify-volume-notification.nix +++ b/home/common/optional/desktop/common/x11/scripts/dunstify-volume-notification.nix @@ -2,8 +2,8 @@ { home.packages = with pkgs; [ (writeShellScriptBin "dunstify-volume-notification" '' - mute_test=$(pamixer --get-mute) - mic_mute_test=$(pamixer --default-source --get-mute) + mute_test=$(${pamixer}/bin/pamixer --get-mute) + mic_mute_test=$(${pamixer}/bin/pamixer --default-source --get-mute) mute="" if [ "$mute_test" == true ]; @@ -21,10 +21,10 @@ mute="(Speakers Muted & Mic Muted)" fi - volume=$(pamixer --get-volume) + volume=$(${pamixer}/bin/pamixer --get-volume) msgTag="volume-notify" - dunstify -a "changeVolume" -u low -i audio-volume-high -h string:x-dunst-stack-tag:$msgTag "Volume" "''${volume} ''${mute}" -t 2000 + ${dunst}/bin/dunstify -a "changeVolume" -u low -i audio-volume-high -h string:x-dunst-stack-tag:$msgTag "Volume" "''${volume} ''${mute}" -t 2000 '') ]; } diff --git a/home/common/optional/desktop/dwm/scripts/sb-mem-pct.nix b/home/common/optional/desktop/dwm/scripts/sb-mem-pct.nix index 780afe1..453e807 100644 --- a/home/common/optional/desktop/dwm/scripts/sb-mem-pct.nix +++ b/home/common/optional/desktop/dwm/scripts/sb-mem-pct.nix @@ -3,7 +3,7 @@ home.packages = with pkgs; [ (writeShellScriptBin "sb-mem-pct" '' # Gets current ram percent utilisation - echo $(free | awk '/^Mem/ {print "100*" $3 " / " $2 }' | bc | awk '{print $1"%"}') + echo $(free | awk '/^Mem/ {print "100*" $3 " / " $2 }' | ${bc}/bin/bc | awk '{print $1"%"}') '') ]; } diff --git a/home/common/optional/desktop/dwm/scripts/sb-volume.nix b/home/common/optional/desktop/dwm/scripts/sb-volume.nix index 6d69509..99e2e45 100644 --- a/home/common/optional/desktop/dwm/scripts/sb-volume.nix +++ b/home/common/optional/desktop/dwm/scripts/sb-volume.nix @@ -3,20 +3,8 @@ home.packages = with pkgs; [ (writeShellScriptBin "sb-volume" '' # Prints the current volume or 婢 if muted. - - case $BLOCK_BUTTON in - 1) setsid -f "$TERMINAL" -e pulsemixer ;; - 2) pamixer -t && pkill -RTMIN+10 dwmblocks && exit 1 ;; - 4) pamixer --set-limit 150 --allow-boost -i 1 && pkill -RTMIN+10 dwmblocks && exit 1 ;; - 5) pamixer --set-limit 150 --allow-boost -d 1 && pkill -RTMIN+10 dwmblocks && exit 1 ;; - 3) notify-send "Volume module" "\- Shows volume , 婢 if muted. - - Middle click to mute. - - Scroll to change." ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; - esac - - get_mic_status=$(pamixer --default-source --get-mute) - vol="$(pamixer --get-volume)" + get_mic_status=$(${pamixer}/bin/pamixer --default-source --get-mute) + vol="$(${pamixer}/bin/pamixer --get-volume)" if [ $get_mic_status == false ]; then mic_status="" @@ -36,7 +24,7 @@ icon="󰝟" fi - if [ $(pamixer --get-mute) = true ]; then + if [ $(${pamixer}/bin/pamixer --get-mute) = true ]; then icon="󰸈" vol="0" fi