diff options
| -rw-r--r-- | config/zsh/aliases/git.zsh | 4 | ||||
| -rw-r--r-- | config/zsh/aliases/system.zsh | 8 | ||||
| -rwxr-xr-x | scripts/bin/gg | 98 | ||||
| -rwxr-xr-x | scripts/commands/:day | 7 | ||||
| -rwxr-xr-x | scripts/commands/:gamma | 1 | ||||
| -rw-r--r-- | scripts/fontawesome-menu/icons/icons-list | 2 | ||||
| -rwxr-xr-x | scripts/open-project.sh | 8 |
7 files changed, 115 insertions, 13 deletions
diff --git a/config/zsh/aliases/git.zsh b/config/zsh/aliases/git.zsh index 18f988d..c33781d 100644 --- a/config/zsh/aliases/git.zsh +++ b/config/zsh/aliases/git.zsh @@ -93,8 +93,8 @@ gco() { if ! [ "$#" = "0" ]; then git checkout "$@"; else - local b="$(git branch | fzf | xargs)"; - [ -n "$b" ] && git switch "$b"; + local b="$(git branch --format '%(refname:short)' | fzf)"; + [ -n "$b" ] && git checkout "$b"; fi } diff --git a/config/zsh/aliases/system.zsh b/config/zsh/aliases/system.zsh index 85db5ef..047c4bf 100644 --- a/config/zsh/aliases/system.zsh +++ b/config/zsh/aliases/system.zsh @@ -12,6 +12,14 @@ nix-rollback() { sudo nixos-rebuild switch --rollback=$1; } +nixlsversions() { + if [ -z "$1" ]; then + echo "Specify package name"; + return 1; + fi; + curl "https://www.nixhub.io/packages/$1?_data=routes%2F_nixhub.packages.%24pkg._index" | jq '.releases | map([.version, .platforms[0].commit_hash, .platforms[0].attribute_path])' +} + #alias mirrorlist-refresh="sudo reflector --latest 200 --protocol http --protocol https --sort rate --save /etc/pacman.d/mirrorlist-arch" # Sandbox diff --git a/scripts/bin/gg b/scripts/bin/gg new file mode 100755 index 0000000..5fb7c67 --- /dev/null +++ b/scripts/bin/gg @@ -0,0 +1,98 @@ +#!/usr/bin/env sh + +set -eu -o pipefail; + +gg_file="$(git rev-parse --git-path _hooked_branch_list)"; + +current_branch() { git branch --show-current; } + +confirm() { + echo -n "You sure? (y/n) "; + read response; + [ "$response" = "y" ]; +} + +branchlist() { cat "$gg_file" | sed '/^$/d' 2>/dev/null; } + +add() { + echo "$1" >> "$gg_file"; + sort -u "$gg_file" -o "$gg_file"; +} + +remove_branch() { + local new_branchlist=$(branchlist | grep -v "$1"); + echo "Removing $1..."; + if (confirm); then + echo "$new_branchlist" > "$gg_file"; + fi +} + +prompt_branchlist() { + branchlist | grep -v "$(current_branch)" | fzf; +} + +cmd_list() { branchlist; } + +cmd_add() { + if [ "$#" == 0 ]; then + add "$(current_branch)"; + elif [ "$1" == "-s" ]; then + local branch=$(git branch --format '%(refname:short)' | fzf); + [ -z "$branch" ] && echo "<noop>" && exit 0; + add "$branch"; + elif [ "$1" == "-" ]; then + while read b; do add "$b"; done + elif [ -n "$1" ]; then + add "$1"; + fi +} + +cmd_remove() { + if [ "$#" == 0 ]; then + local branch=$(branchlist | fzf); + [ -z "$branch" ] && echo "<noop>" && exit 0; + remove_branch "$branch"; + elif [ "$1" == "-" ]; then + while read b; do remove_branch "$b"; done + elif [ -n "$1" ]; then + remove_branch "$1"; + fi +} + +cmd_checkout() { + local branch=$(prompt_branchlist); + [ -z "$branch" ] && echo "<noop>" && exit 0; + git checkout "$branch"; +} + +cmd_clear() { + echo "Clearing branch list"; + if (confirm); then + echo -n "" > "$gg_file"; + fi +} + +cmd_rebase() { + local branch=$(prompt_branchlist); + [ -z "$branch" ] && echo "<noop>" && exit 0; + echo "Rebase $(current_branch) with base $branch"; + if (confirm); then + git rebase "$branch"; + fi +} + +cmd="$1"; shift 1; + +case "$cmd" in + l|ls|ll|list) cmd_list ;; + a|add) cmd_add "$@" ;; + c|co|checkout) cmd_checkout ;; + rb|rebase) cmd_rebase ;; + rm|remove) cmd_remove "$@" ;; + clear) cmd_clear ;; + *) + echo "Invalid command: $cmd" + echo "Use: (ls)list | (a)add | (rm)remove | (co)checkout | (re)rebase | clear" + ;; +esac + diff --git a/scripts/commands/:day b/scripts/commands/:day index 76b57cb..e2272a7 100755 --- a/scripts/commands/:day +++ b/scripts/commands/:day @@ -1,8 +1,5 @@ #!/usr/bin/env bash -~/scripts/brightness.sh set 100; - -# :gamma 0.91 0.94 0.93; - -xgamma -gamma 1; +~/scripts/brightness.sh set 100 || true; +:gamma 0.85:1.0:1.0 || true; diff --git a/scripts/commands/:gamma b/scripts/commands/:gamma index 2b2a1f8..be11946 100755 --- a/scripts/commands/:gamma +++ b/scripts/commands/:gamma @@ -6,6 +6,5 @@ else r=${1:-'1'}; g=${2:-'1'}; b=${3:-'1'}; fi; -notify-send "Setting gamma to ($r, $g, $b)"; xrandr --output eDP-1 --brightness 1 --gamma $r:$g:$b diff --git a/scripts/fontawesome-menu/icons/icons-list b/scripts/fontawesome-menu/icons/icons-list index 37607a6..55c7743 100644 --- a/scripts/fontawesome-menu/icons/icons-list +++ b/scripts/fontawesome-menu/icons/icons-list @@ -153,7 +153,7 @@ ✌ victory hand; U+270C 🤞 crossed fingers; U+1F91E 🤟 love-you gesture; U+1F91F -🤘 sign of the horns; U+1F918 +🤘 rock; sign of the horns; U+1F918 🤙 call me hand; U+1F919 👈 backhand index pointing left; U+1F448 👉 backhand index pointing right; U+1F449 diff --git a/scripts/open-project.sh b/scripts/open-project.sh index 7fb9ca7..320f938 100755 --- a/scripts/open-project.sh +++ b/scripts/open-project.sh @@ -26,10 +26,10 @@ case "$projtype" in esac if [ ! -z "$fulldir" ]; then - if [ ! -d "$fulldir" ]; then - mkdir -p $fulldir; - notify-send "Created new project at $fulldir"; - fi; + # if [ ! -d "$fulldir" ]; then + # mkdir -p $fulldir; + # notify-send "Created new project at $fulldir"; + # fi; ~/scripts/sessions/project.sh "$fulldir"; fi; |
