From 1ef2ad407ec3e415fc055ed1992709d22b3996e8 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Mon, 2 Aug 2021 05:56:09 -0600 Subject: [PATCH] Fix some functions --- dotfiles/lib/functions/dbus_introspect | 2 +- .../lib/functions/environment_variable_exists | 2 +- dotfiles/lib/functions/get_sink_input_by_pid | 2 +- dotfiles/lib/functions/pahelper | 2 +- dotfiles/lib/functions/path_lines | 5 +---- dotfiles/lib/functions/set_volume | 11 ++--------- nixos/flake.lock | 18 +++++++++--------- 7 files changed, 16 insertions(+), 26 deletions(-) diff --git a/dotfiles/lib/functions/dbus_introspect b/dotfiles/lib/functions/dbus_introspect index 1ca6302d..af65da75 100755 --- a/dotfiles/lib/functions/dbus_introspect +++ b/dotfiles/lib/functions/dbus_introspect @@ -9,4 +9,4 @@ function dbus-introspect { org.freedesktop.DBus.Introspectable.Introspect | tail -n +2 | sed -e "s/^ *string//" } -dbus-introspect +dbus-introspect "$@" diff --git a/dotfiles/lib/functions/environment_variable_exists b/dotfiles/lib/functions/environment_variable_exists index c2915651..79cab5b3 100755 --- a/dotfiles/lib/functions/environment_variable_exists +++ b/dotfiles/lib/functions/environment_variable_exists @@ -5,5 +5,5 @@ function environment_variable_exists { [ ! -z $value ] } -environment_variable_exists +environment_variable_exists "$@" diff --git a/dotfiles/lib/functions/get_sink_input_by_pid b/dotfiles/lib/functions/get_sink_input_by_pid index 41e8ff1d..8c14d9de 100755 --- a/dotfiles/lib/functions/get_sink_input_by_pid +++ b/dotfiles/lib/functions/get_sink_input_by_pid @@ -4,5 +4,5 @@ function get_sink_input_by_pid { get_sink_input_info.hs | jq 'select(.application_process_id == "'"$thePID"'")' } -get_sink_input_by_pid +get_sink_input_by_pid "$@" diff --git a/dotfiles/lib/functions/pahelper b/dotfiles/lib/functions/pahelper index b21c8f27..d94be14a 100755 --- a/dotfiles/lib/functions/pahelper +++ b/dotfiles/lib/functions/pahelper @@ -99,4 +99,4 @@ function pahelper { esac } -pahelper +pahelper "$@" diff --git a/dotfiles/lib/functions/path_lines b/dotfiles/lib/functions/path_lines index 8f80e660..03321e1f 100755 --- a/dotfiles/lib/functions/path_lines +++ b/dotfiles/lib/functions/path_lines @@ -1,10 +1,7 @@ #!/usr/bin/env sh function path_lines { - IFS=':' read -A ADDR <<< "$PATH" - for one_path in "${ADDR[@]}"; do - echo $one_path - done + split_by_char ":" "$PATH" } path_lines diff --git a/dotfiles/lib/functions/set_volume b/dotfiles/lib/functions/set_volume index 4784f3b2..7639c16f 100755 --- a/dotfiles/lib/functions/set_volume +++ b/dotfiles/lib/functions/set_volume @@ -1,14 +1,5 @@ #!/usr/bin/env sh -function switch_sink_applications() -{ - echo switching applications - pacmd list-sink-inputs | - awk '/index:/{print $2}' | - xargs -r -I{} pacmd move-sink-input {} $1 || - echo failed -} - function set_volume { current_default=$(pahelper list | grep '*' | all_after_char ":" | xargs) environment_variable_exists USE_ONLY_O_PASINK && pahelper "$current_default" @@ -17,3 +8,5 @@ function set_volume { pulsemixer "$@" pashowvolume } + +set_volume "$@" diff --git a/nixos/flake.lock b/nixos/flake.lock index 384c94bf..88f89718 100644 --- a/nixos/flake.lock +++ b/nixos/flake.lock @@ -294,7 +294,7 @@ "nixpkgs_10": { "locked": { "narHash": "sha256-Iv7J5n9zN4ejsQjnAJLDv+/+/+BH/kgfPAzMXrcqsZ0=", - "path": "./nixpkgs", + "path": "/nix/store/j2f79wqwpx91rrbn3hpajxnhg76bgwsz-source", "type": "path" }, "original": { @@ -305,7 +305,7 @@ "nixpkgs_2": { "locked": { "narHash": "sha256-Iv7J5n9zN4ejsQjnAJLDv+/+/+BH/kgfPAzMXrcqsZ0=", - "path": "./nixpkgs", + "path": "/nix/store/j2f79wqwpx91rrbn3hpajxnhg76bgwsz-source", "type": "path" }, "original": { @@ -316,7 +316,7 @@ "nixpkgs_3": { "locked": { "narHash": "sha256-Iv7J5n9zN4ejsQjnAJLDv+/+/+BH/kgfPAzMXrcqsZ0=", - "path": "./nixpkgs", + "path": "/nix/store/j2f79wqwpx91rrbn3hpajxnhg76bgwsz-source", "type": "path" }, "original": { @@ -327,7 +327,7 @@ "nixpkgs_4": { "locked": { "narHash": "sha256-Iv7J5n9zN4ejsQjnAJLDv+/+/+BH/kgfPAzMXrcqsZ0=", - "path": "./nixpkgs", + "path": "/nix/store/j2f79wqwpx91rrbn3hpajxnhg76bgwsz-source", "type": "path" }, "original": { @@ -338,7 +338,7 @@ "nixpkgs_5": { "locked": { "narHash": "sha256-Iv7J5n9zN4ejsQjnAJLDv+/+/+BH/kgfPAzMXrcqsZ0=", - "path": "./nixpkgs", + "path": "/nix/store/j2f79wqwpx91rrbn3hpajxnhg76bgwsz-source", "type": "path" }, "original": { @@ -349,7 +349,7 @@ "nixpkgs_6": { "locked": { "narHash": "sha256-Iv7J5n9zN4ejsQjnAJLDv+/+/+BH/kgfPAzMXrcqsZ0=", - "path": "./nixpkgs", + "path": "/nix/store/j2f79wqwpx91rrbn3hpajxnhg76bgwsz-source", "type": "path" }, "original": { @@ -360,7 +360,7 @@ "nixpkgs_7": { "locked": { "narHash": "sha256-Iv7J5n9zN4ejsQjnAJLDv+/+/+BH/kgfPAzMXrcqsZ0=", - "path": "./nixpkgs", + "path": "/nix/store/j2f79wqwpx91rrbn3hpajxnhg76bgwsz-source", "type": "path" }, "original": { @@ -371,7 +371,7 @@ "nixpkgs_8": { "locked": { "narHash": "sha256-Iv7J5n9zN4ejsQjnAJLDv+/+/+BH/kgfPAzMXrcqsZ0=", - "path": "./nixpkgs", + "path": "/nix/store/j2f79wqwpx91rrbn3hpajxnhg76bgwsz-source", "type": "path" }, "original": { @@ -382,7 +382,7 @@ "nixpkgs_9": { "locked": { "narHash": "sha256-Iv7J5n9zN4ejsQjnAJLDv+/+/+BH/kgfPAzMXrcqsZ0=", - "path": "./nixpkgs", + "path": "/nix/store/j2f79wqwpx91rrbn3hpajxnhg76bgwsz-source", "type": "path" }, "original": {