From 9df5b03b034e6bff9bc671d8ad399adb082f18f2 Mon Sep 17 00:00:00 2001 From: ranomier Date: Sun, 15 Dec 2024 17:23:10 +0100 Subject: [PATCH 1/7] make it look nicer --- remote-audio | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/remote-audio b/remote-audio index d50540e..bf0718d 100755 --- a/remote-audio +++ b/remote-audio @@ -7,9 +7,18 @@ set -E -o pipefail shopt -s failglob export LC_ALL=C.UTF8 + + start() { - roc-recv -s rtp+rs8m://0.0.0.0:10001 -r rs8m://0.0.0.0:10002 -o alsa://default & - roc-send -s rtp+rs8m://192.168.178.40:10001 -r rs8m://192.168.178.40:10002 -i alsa://default & + roc-recv \ + --source=rtp+rs8m://0.0.0.0:10001 \ + --repair=rs8m://0.0.0.0:10002 \ + -o alsa://default & + + roc-send \ + -s rtp+rs8m://192.168.178.40:10001 \ + -r rs8m://192.168.178.40:10002 \ + -i alsa://default & } stop() { From f117b819b494b3ff484b2aea1fbffef7225c816e Mon Sep 17 00:00:00 2001 From: ranomier Date: Wed, 18 Dec 2024 09:49:46 +0100 Subject: [PATCH 2/7] removed unneeded line --- remote-audio | 1 - 1 file changed, 1 deletion(-) diff --git a/remote-audio b/remote-audio index bf0718d..30cbb2f 100755 --- a/remote-audio +++ b/remote-audio @@ -32,7 +32,6 @@ stop9() { } if [[ -z "$1" ]]; then - #start() start else $1 From e4163324517001a92a4f6fa490193d02c3e7a5d6 Mon Sep 17 00:00:00 2001 From: ranomier Date: Wed, 18 Dec 2024 09:51:05 +0100 Subject: [PATCH 3/7] added list function --- remote-audio | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/remote-audio b/remote-audio index 30cbb2f..83bb1ef 100755 --- a/remote-audio +++ b/remote-audio @@ -31,6 +31,10 @@ stop9() { killall -9 roc-recv } +list() { + pgrep -a 'roc-' +} + if [[ -z "$1" ]]; then start else From b9d8c165c654f671aa08402aee4655b5e993ae36 Mon Sep 17 00:00:00 2001 From: ranomier Date: Sat, 21 Dec 2024 10:33:09 +0100 Subject: [PATCH 4/7] use the full option not the flag --- remote-audio | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/remote-audio b/remote-audio index 83bb1ef..6f7187b 100755 --- a/remote-audio +++ b/remote-audio @@ -13,12 +13,12 @@ start() { roc-recv \ --source=rtp+rs8m://0.0.0.0:10001 \ --repair=rs8m://0.0.0.0:10002 \ - -o alsa://default & + --output=alsa://default & roc-send \ - -s rtp+rs8m://192.168.178.40:10001 \ - -r rs8m://192.168.178.40:10002 \ - -i alsa://default & + --source=rtp+rs8m://192.168.178.40:10001 \ + --repair=rs8m://192.168.178.40:10002 \ + --input=alsa://default & } stop() { From 5fa380223bc8351e36b8ae66c68dd9f2a133c22c Mon Sep 17 00:00:00 2001 From: ranomier Date: Sat, 28 Dec 2024 20:19:01 +0100 Subject: [PATCH 5/7] don't unnecessary create new shell for folder --- nswitch | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nswitch b/nswitch index 4696966..bebad7e 100755 --- a/nswitch +++ b/nswitch @@ -5,11 +5,15 @@ set -E -o pipefail shopt -s failglob export LC_ALL=C.UTF8 -PROJECT="$HOME/Projects/NixOS/" +INITIAL_PWD="$(pwd)" +PROJECT="$HOME/Projects/NixOS" GIT_PATTERN="." # "*.nix" exit_with_new_shell() { + # check if already in directory + [[ "$INITIAL_PWD" = "$PROJECT" ]] && printf '>>> already in directory\n' && exit 0 + printf '\n' printf '>>> opening a new \"%s\" shell\n' "$(basename "$SHELL")" printf '>>> cwd: %s\n' "$(pwd)" @@ -24,7 +28,7 @@ printf ">>> auto formating ..." nix fmt . &> /dev/null printf " DONE!\n" -[ -z "$(git diff -U0 "$GIT_PATTERN")" ] && echo ">>> no changes, exiting ..." && exit_with_new_shell +[[ -z "$(git diff -U0 "$GIT_PATTERN")" ]] && echo ">>> no changes, exiting ..." && exit_with_new_shell git diff -U0 "$GIT_PATTERN" # as a seperate command so we get nice colors and pager printf ">>> Do you want to rebuild NixOS? [y/N]\n" From e70b8beb7c33c395aa156530c8d555e4245df5d7 Mon Sep 17 00:00:00 2001 From: ranomier Date: Wed, 1 Jan 2025 15:15:11 +0100 Subject: [PATCH 6/7] no need to auto format if there is no change --- nswitch | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nswitch b/nswitch index bebad7e..d90d804 100755 --- a/nswitch +++ b/nswitch @@ -24,11 +24,15 @@ exit_with_new_shell() { cd "$PROJECT" || exit 1 nvim +# check if there are changes at all +[[ -z "$(git diff -U0 "$GIT_PATTERN")" ]] && echo ">>> no changes, exiting ..." && exit_with_new_shell + +# only then do auto formating printf ">>> auto formating ..." nix fmt . &> /dev/null printf " DONE!\n" -[[ -z "$(git diff -U0 "$GIT_PATTERN")" ]] && echo ">>> no changes, exiting ..." && exit_with_new_shell +# and then show the user a diff git diff -U0 "$GIT_PATTERN" # as a seperate command so we get nice colors and pager printf ">>> Do you want to rebuild NixOS? [y/N]\n" From 7884fbdbcdd791d33c75a264ef0eecc136abfce5 Mon Sep 17 00:00:00 2001 From: ranomier Date: Wed, 1 Jan 2025 15:19:15 +0100 Subject: [PATCH 7/7] pretty --- nswitch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nswitch b/nswitch index d90d804..e90d6a5 100755 --- a/nswitch +++ b/nswitch @@ -16,7 +16,7 @@ exit_with_new_shell() { printf '\n' printf '>>> opening a new \"%s\" shell\n' "$(basename "$SHELL")" - printf '>>> cwd: %s\n' "$(pwd)" + printf ' cwd: %s\n' "$(pwd)" "$SHELL" exit 0 }