diff --git a/nswitch b/nswitch index 4696966..e90d6a5 100755 --- a/nswitch +++ b/nswitch @@ -5,14 +5,18 @@ 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)" + printf ' cwd: %s\n' "$(pwd)" "$SHELL" exit 0 } @@ -20,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" diff --git a/remote-audio b/remote-audio index d50540e..6f7187b 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 \ + --output=alsa://default & + + roc-send \ + --source=rtp+rs8m://192.168.178.40:10001 \ + --repair=rs8m://192.168.178.40:10002 \ + --input=alsa://default & } stop() { @@ -22,8 +31,11 @@ stop9() { killall -9 roc-recv } +list() { + pgrep -a 'roc-' +} + if [[ -z "$1" ]]; then - #start() start else $1