From f96268c6408771743d2593e364d3e2a2fc904158 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 11 Aug 2024 21:15:17 -0400 Subject: [PATCH] thelio76: bash --- config/apps/bash/default.nix | 2 ++ config/apps/bash/nxr.sh | 44 ++++++++++++++++++++++++---------- config/apps/vscode.nix | 1 + config/modules/bspwm/picom.nix | 3 +-- 4 files changed, 36 insertions(+), 14 deletions(-) diff --git a/config/apps/bash/default.nix b/config/apps/bash/default.nix index 0bbe712..c305f06 100644 --- a/config/apps/bash/default.nix +++ b/config/apps/bash/default.nix @@ -8,6 +8,8 @@ eval "$(direnv hook bash)" ''; shellAliases = { + "quick-switch-c" = "cd ~/Git/nixos-config; ./quick-switch.sh -c"; + "quick-switch" = "cd ~/Git/nixos-config; ./quick-switch.sh"; "git-override" = "git add . && git commit --amend --no-edit && git push --force-with-lease"; }; }; diff --git a/config/apps/bash/nxr.sh b/config/apps/bash/nxr.sh index d8b7f63..7d3254d 100644 --- a/config/apps/bash/nxr.sh +++ b/config/apps/bash/nxr.sh @@ -1,25 +1,45 @@ +# shellcheck disable=SC2148 function nxr() { set -u local pkg="" local bin="" + local count=0 + for var in "$@"; do + if [ "$var" == "--" ]; then + count=$((count + 1)) + break + fi - # for var in "$@" - # do - # if [ "$var" == "--" ]; then - # shift "$count" - # fi - # done + if [ "$count" == "0" ]; then + pkg="$var" + fi - local pkg="$1" - local bin="$2" + if [ "$count" == "1" ]; then + bin="$var" + fi - if [ -z "$bin" ]; then - bin="$pkgs" + count=$((count + 1)) + done + + shift $count + + if [ -z "$pkg" ]; then + echo "Error: no pkg name given" + exit 1 fi - shift - nix-shell -p "$pkg" --run "$bin $@" + if [ -z "$bin" ]; then + bin="$pkg" + fi + + echo "Running nxr with:" + printf "\tpkg=%s" "$pkg" + printf "\tbin=%s" "$bin" + printf "\topts=%s" "$@" + printf "\n\n" + + nix-shell -p "$pkg" --run "$bin $*" set +u } diff --git a/config/apps/vscode.nix b/config/apps/vscode.nix index 1079726..0b8d32a 100644 --- a/config/apps/vscode.nix +++ b/config/apps/vscode.nix @@ -1,6 +1,7 @@ { pkgs, ... }: { home.packages = with pkgs; [ + shellcheck shfmt # for shell-format extension ]; programs.vscode = { diff --git a/config/modules/bspwm/picom.nix b/config/modules/bspwm/picom.nix index 53aa80c..ff06c49 100644 --- a/config/modules/bspwm/picom.nix +++ b/config/modules/bspwm/picom.nix @@ -8,8 +8,7 @@ in backend = "glx"; activeOpacity = 1; - inactiveOpacity = 0.75; - # shadow = true; + inactiveOpacity = 1; vSync = true; settings = {