mirror of
https://github.com/anotherhadi/nixy.git
synced 2026-04-02 11:12:09 +02:00
Up
This commit is contained in:
@@ -34,51 +34,4 @@ let
|
||||
nmcli connection import type wireguard file "$0"
|
||||
'';
|
||||
|
||||
choose-output = pkgs.writeShellScriptBin "choose-output" ''
|
||||
function parse_sinks(){
|
||||
output=$(wpctl status)
|
||||
sinks=($(echo "$output" | sed 's/ │ //' | awk '/Sinks:/ {flag=1; next} /^$/ {flag=0} flag' | sed 's/ /-/g'))
|
||||
|
||||
for sink in "''${sinks[@]}"; do
|
||||
|
||||
id=""
|
||||
default=false
|
||||
sink=$(echo "$sink" | sed 's/-/ /g')
|
||||
sink_name=$(echo "$sink" | sed 's/\[vol:.*$//')
|
||||
|
||||
if [[ $sink_name == "*"* ]]; then
|
||||
sink_name=$(echo "$sink_name" | sed 's/*//')
|
||||
default=true
|
||||
fi
|
||||
|
||||
id=$(echo "$sink_name" | cut -d'.' -f1)
|
||||
sink_name=$(echo "$sink_name" | sed 's/^[ ]*//;s/[ ]*$//' )
|
||||
sink_name=$(echo "$sink_name" | cut -d'.' -f2 )
|
||||
|
||||
if [[ $default == true ]];then
|
||||
printf "*%s (%d)" "$sink_name" "$id"
|
||||
else
|
||||
printf " %s (%d)" "$sink_name" "$id"
|
||||
fi
|
||||
printf "\n"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
choosed_sink=$(echo "$(parse_sinks)" | fzf \
|
||||
--border-label "Choose sound output" ) || exit 1
|
||||
|
||||
choosed_sink_id=$(echo "$choosed_sink" | sed 's/.*(\(.*\))/\1/')
|
||||
|
||||
wpctl set-default $choosed_sink_id
|
||||
'';
|
||||
|
||||
in {
|
||||
home.packages = with pkgs; [
|
||||
wallpaper
|
||||
menu
|
||||
wireguard-import
|
||||
choose-output
|
||||
powermenu
|
||||
];
|
||||
}
|
||||
in { home.packages = with pkgs; [ wallpaper menu wireguard-import powermenu ]; }
|
||||
|
||||
Reference in New Issue
Block a user