call nix packages in script

This commit is contained in:
Sam 2024-06-14 22:00:56 +01:00
parent 63874ede17
commit c4a76219c9
3 changed files with 8 additions and 20 deletions

View File

@ -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
'')
];
}

View File

@ -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"%"}')
'')
];
}

View File

@ -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