diff --git a/apps/de/sxhkd/rc b/apps/de/sxhkd/rc index be975dc..63834b7 100755 --- a/apps/de/sxhkd/rc +++ b/apps/de/sxhkd/rc @@ -260,4 +260,8 @@ super + Escape pkill -USR1 -x sxhkd super + ctrl + c - bspc rule -a '*' -o state=floating && urxvt --geometry 64x9 -e sh -c "cal -n 3 && bash" + bspc rule -a '*' -o state=floating && kitty -o remember_window_size=no -o initial_window_width=66c -o initial_window_height=10c sh -c "cal -n 3 && printf 'Press [ENTER] to close.' && read" + +super + ctrl + p + bspc rule -a '*' -o state=floating && \ + kitty -o remember_window_size=no -o initial_window_width=122c -o initial_window_height=40c sh -c "{ env FZFP_PASS_OPTS='' FZFP_HEIGHT=100% fzfp | head -n 1 | sd '\n\$' '' | clip; } &" diff --git a/apps/shell/bash/rc b/apps/shell/bash/rc index fa37bac..ebfa94a 100644 --- a/apps/shell/bash/rc +++ b/apps/shell/bash/rc @@ -59,12 +59,10 @@ if [ "$PWD" = "$HOME" ] || [ "$PWD" = "$NICE_HOME" ]; then cd "$NICE_HOME" || cd || return fi -[ -f "$HOME/.fzf.bash" ] && . "$HOME/.fzf.bash" +# if [[ -d "$HOME/.asdf/" ]] && [[ -f "$HOME/.asdf/asdf.sh" ]]; then +# . "$HOME/.asdf/asdf.sh" +# elif [[ -d /opt/asdf-vm/ ]] && [[ -f /opt/asdf-vm/asdf.sh ]]; then +# . "/opt/asdf-vm/asdf.sh" +# fi -if [[ -d "$HOME/.asdf/" ]] && [[ -f "$HOME/.asdf/asdf.sh" ]]; then - . "$HOME/.asdf/asdf.sh" -elif [[ -d /opt/asdf-vm/ ]] && [[ -f /opt/asdf-vm/asdf.sh ]]; then - . "/opt/asdf-vm/asdf.sh" -fi - -[ -f ~/.fzf.bash ] && source ~/.fzf.bash +# [ -f ~/.fzf.bash ] && source ~/.fzf.bash diff --git a/apps/shell/fish/aliases.fish b/apps/shell/fish/aliases.fish index 7fb6188..89de6b1 100755 --- a/apps/shell/fish/aliases.fish +++ b/apps/shell/fish/aliases.fish @@ -192,3 +192,7 @@ function chat set -l pass (pass config/weechat-passphrase | head -n 1) env WEECHAT_PASSPHRASE=$pass weechat end + +# grep aliases +alias rg "rg --text" +alias grep "rg" diff --git a/apps/shell/fish/prompt.fish b/apps/shell/fish/prompt.fish index 4706379..3065065 100755 --- a/apps/shell/fish/prompt.fish +++ b/apps/shell/fish/prompt.fish @@ -15,14 +15,28 @@ function preprocess_pwd end function fish_prompt - if test $status -eq 0 - set_color blue + set last_cmd_status $status + if test (id -u) -eq 0 + if test $last_cmd_status -eq 0 + set_color -b blue black + else + set_color -b red black + end + printf " SUDO $USER@$hostname" else - set_color red + if test $last_cmd_status -eq 0 + set_color blue + else + set_color red + end + printf "$USER@$hostname" end - printf $USER"@"$hostname" " + set_color normal + printf " " set_color magenta - printf (preprocess_pwd)" " + printf (preprocess_pwd)"" + set_color normal + printf " " end function fish_mode_prompt; end diff --git a/apps/shell/tmux/conf b/apps/shell/tmux/conf index 2ca5127..0c1a5aa 100644 --- a/apps/shell/tmux/conf +++ b/apps/shell/tmux/conf @@ -97,7 +97,7 @@ bind-key u capture-pane \;\ is_vim="ps -o state= -o comm= -t \"#{pane_tty}\" \ | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" -bind-key -Tcopy-mode-vi "C-h" send -X "cancel select-pane -L" +bind-key -T copy-mode-vi "C-h" send -X "cancel select-pane -L" bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" @@ -105,7 +105,8 @@ bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" # bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" # YANKING -bind-key -Tcopy-mode-vi "y" send -X copy-selection +# bind-key -T copy-mode-vi "y" send -X copy-selection +bind-key -T copy-mode-vi "y" send-keys -X copy-pipe-and-cancel -X 'clip' set-environment -g TMUX_PLUGIN_MANAGER_PATH "~/.config/tmux/plugins/" diff --git a/bin/clip b/bin/clip index fb1da25..d8bbad1 100755 --- a/bin/clip +++ b/bin/clip @@ -1,10 +1,11 @@ #!/usr/bin/env sh +# TODO: detect MIME type? +# can a `clip-once` script exist building on this? +# wl-copy `-o`, xclip `-l 1`? + if is_wayland; then - # echo "Clip: YES. THIS IS WAYLAND SPEAKING." >&2 - sed 's/^\s+//g' | sed 's/\s+$//g' | wl-copy "$@" - echo "Your trimmed input was stored in all clipboards." + wl-copy -n wl-copy --trim-newline "$@" else - xclip -selection clipboard - sleep 5 && killall xclip > /dev/null 2>&1 & + xclip -i -sel p -f "$@" | xclip -i -sel c "$@" fi diff --git a/bin/fzfp b/bin/fzfp index 0a62049..1ba56f6 100755 --- a/bin/fzfp +++ b/bin/fzfp @@ -1,8 +1,13 @@ #!/usr/bin/env sh -op="${1:--c}"; shift >&2 2>/dev/null -cd ~/.password-store || { echo "Could not cd to ~/.password-store"; exit 1; } -pp="$(fd gpg | sd ".gpg" "" | fzf --height 40%)" -echo "pass $op $pp" -pass "$op" "$@" "$pp" -cd - || return 1 +FZFP_PASS_CMD="pass" +FZFP_PASS_DIR="$HOME/.password-store" + +FZFP_HEIGHT="${FZFP_HEIGHT:-40%}" +FZFP_PROMPT="${FZFP_PROMPT:-"$FZFP_PASS_CMD@$FZFP_PASS_DIR> "}" +FZFP_PASS_OPTS="${FZFP_PASS_OPTS:-}" +cd "$FZFP_PASS_DIR" || { echo "Could not cd to $FZFP_PASS_DIR" >&2; exit 1; } +pp="$(fd gpg | sd ".gpg" "" | fzf --height "$FZFP_HEIGHT" --prompt "$FZFP_PROMPT")" +"${FZFP_PASS_CMD}" $FZFP_PASS_OPTS "$@" "$pp" +cd - >/dev/null || return 1 + diff --git a/bin/is_wayland b/bin/is_wayland index 72253e8..cec5b52 100755 --- a/bin/is_wayland +++ b/bin/is_wayland @@ -1,3 +1,3 @@ #!/usr/bin/env bash -test "$IS_WAYLAND" == "1" || test -n "$WAYLAND_DISPLAY" || test -n "$SWAYSOCK" || test -z "$DISPLAY" +loginctl show-session "$(loginctl | grep $(whoami) | field 1)" -p Type | grep -i wayland >/dev/null diff --git a/bin/maybe_source_env_file b/bin/maybe_source_env_file index eccd8ff..d79a8b8 100755 --- a/bin/maybe_source_env_file +++ b/bin/maybe_source_env_file @@ -1,7 +1,5 @@ #!/usr/bin/env bash -set -xe - f="$1"; shift [ -f "$f" ] && source "$f" "$@" true