diff options
| -rwxr-xr-x | mac/.config/lf/cleaner | 4 | ||||
| -rw-r--r-- | mac/.config/lf/lfrc | 66 | ||||
| -rwxr-xr-x | mac/.config/lf/scope | 14 | ||||
| -rw-r--r-- | mac/.config/shell/aliasrc | 14 | ||||
| -rw-r--r-- | mac/.config/shell/git-aliasrc | 2 | ||||
| -rw-r--r-- | mac/.config/shell/profile | 29 | ||||
| -rw-r--r-- | mac/.config/zsh/.zshrc | 11 | ||||
| -rwxr-xr-x | mac/.local/bin/gitupdate | 5 | ||||
| -rwxr-xr-x | mac/.local/bin/ifinstalled | 7 | ||||
| -rwxr-xr-x | mac/.local/bin/lfub | 2 | ||||
| -rwxr-xr-x | mac/.local/bin/localshortcuts (renamed from mac/.local/bin/shortcuts) | 56 | ||||
| -rwxr-xr-x | mac/.local/bin/rgafiles | 6 | ||||
| -rwxr-xr-x | mac/.local/bin/tmuxdbussync | 26 | ||||
| -rwxr-xr-x | mac/.local/bin/torwrap | 2 | ||||
| -rwxr-xr-x | mac/.local/bin/transadd | 5 |
15 files changed, 126 insertions, 123 deletions
diff --git a/mac/.config/lf/cleaner b/mac/.config/lf/cleaner index a380dcd..a5f68d5 100755 --- a/mac/.config/lf/cleaner +++ b/mac/.config/lf/cleaner @@ -1,5 +1,5 @@ #!/bin/sh -if [ -n "$FIFO_UEBERZUGPP" ]; then - printf '{"action": "remove", "identifier": "PREVIEW"}\n' >"$FIFO_UEBERZUGPP" +if command -v kitty >/dev/null 2>&1; then + kitty +kitten icat --silent --stdin no --transfer-mode file --clear >/dev/tty fi diff --git a/mac/.config/lf/lfrc b/mac/.config/lf/lfrc index 661ccf3..6243955 100644 --- a/mac/.config/lf/lfrc +++ b/mac/.config/lf/lfrc @@ -269,38 +269,38 @@ cmd mpvdir ${{ }} # Open -cmd open ${{ - case $(file --mime-type "$(readlink -f $f)" -b) in - application/octet-stream) - case ${f##*.} in - doc|docx|xls|xlsx|odt|ppt|pptx) setsid -f libreoffice $fx >/dev/null 2>&1 ;; - ghw) setsid -f gtkwave $f >/dev/null 2>&1 ;; - ts) setsid -f mpv --x11-name=video $f -quiet >/dev/null 2>&1 ;; - *) setsid -f zathura $fx >/dev/null 2>&1 ;; - esac - ;; - application/epub*|application/pdf|application/postscript|application/vnd.djvu|image/vnd.djvu) setsid -f zathura $fx >/dev/null 2>&1 ;; - application/pgp-encrypted) $EDITOR $fx ;; - application/vnd.oasis.opendocument.text|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.presentation|application/vnd.ms-powerpoint|application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template|application/vnd.oasis.opendocument.formula|application/vnd.oasis.opendocument.database) setsid -f firefox $fx >/dev/null 2>&1 ;; - application/x-hwp|application/vnd.openxmlformats-officedocument.presentationml.presentation|application/vnd.openxmlformats-officedocument.wordprocessingml.document) setsid -f libreoffice $fx >/dev/null 2>&1 ;; - audio/*|video/x-ms-asf) setsid -f mpv --volume=50 --x11-name=music --force-window=yes --audio-display=embedded-first $f >/dev/null 2>&1 ;; - image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;; - image/svg+xml) display -- $f ;; - image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|avif\|tif\|ico\)\(_large\)*$" | - setsid -f nsxiv -aiop 2>/dev/null | while read -r file; do - [ -z "$file" ] && continue - lf -remote "send select \"$file\"" - lf -remote "send toggle" - done & - ;; - text/csv|application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) sc-im $fx;; - text/html|text/xml) lynx $fx;; - text/troff) groff -mom $fx -Tpdf | zathura - ;; - text/*|application/json|inode/x-empty|application/x-subrip) $EDITOR $fx;; - video/*) setsid -f mpv --x11-name=video -quiet $f >/dev/null 2>&1 ;; - *) for f in $fx; do setsid -f ${OPENER:-xdg-open} $f >/dev/null 2>&1; done;; - esac -}} +# cmd open ${{ +# case $(file --mime-type "$(readlink -f $f)" -b) in +# application/octet-stream) +# case ${f##*.} in +# doc|docx|xls|xlsx|odt|ppt|pptx) setsid -f libreoffice $fx >/dev/null 2>&1 ;; +# ghw) setsid -f gtkwave $f >/dev/null 2>&1 ;; +# ts) setsid -f mpv --x11-name=video $f -quiet >/dev/null 2>&1 ;; +# *) setsid -f zathura $fx >/dev/null 2>&1 ;; +# esac +# ;; +# application/epub*|application/pdf|application/postscript|application/vnd.djvu|image/vnd.djvu) setsid -f zathura $fx >/dev/null 2>&1 ;; +# application/pgp-encrypted) $EDITOR $fx ;; +# application/vnd.oasis.opendocument.text|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.presentation|application/vnd.ms-powerpoint|application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template|application/vnd.oasis.opendocument.formula|application/vnd.oasis.opendocument.database) setsid -f firefox $fx >/dev/null 2>&1 ;; +# application/x-hwp|application/vnd.openxmlformats-officedocument.presentationml.presentation|application/vnd.openxmlformats-officedocument.wordprocessingml.document) setsid -f libreoffice $fx >/dev/null 2>&1 ;; +# audio/*|video/x-ms-asf) setsid -f mpv --volume=50 --x11-name=music --force-window=yes --audio-display=embedded-first $f >/dev/null 2>&1 ;; +# image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;; +# image/svg+xml) display -- $f ;; +# image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|avif\|tif\|ico\)\(_large\)*$" | +# setsid -f nsxiv -aiop 2>/dev/null | while read -r file; do +# [ -z "$file" ] && continue +# lf -remote "send select \"$file\"" +# lf -remote "send toggle" +# done & +# ;; +# text/csv|application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) sc-im $fx;; +# text/html|text/xml) lynx $fx;; +# text/troff) groff -mom $fx -Tpdf | zathura - ;; +# text/*|application/json|inode/x-empty|application/x-subrip) $EDITOR $fx;; +# video/*) setsid -f mpv --x11-name=video -quiet $f >/dev/null 2>&1 ;; +# *) for f in $fx; do setsid -f ${OPENER:-xdg-open} $f >/dev/null 2>&1; done;; +# esac +# }} # Rename cmd bulkrename ${{ @@ -536,7 +536,7 @@ map th $nsxiv -apt "$(pwd)" # Open map O $mimeopen "$f" -map o open +map o open "$f" map <c-o> $mimeopen --ask "$f" # Paste diff --git a/mac/.config/lf/scope b/mac/.config/lf/scope index fc26f5e..2a2f7fa 100755 --- a/mac/.config/lf/scope +++ b/mac/.config/lf/scope @@ -7,10 +7,16 @@ IFS="$(printf '%b_' '\n')" IFS="${IFS%_}" image() { - if [ -f "$1" ] && [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzugpp >/dev/null 2>&1; then - printf '{"action": "add", "identifier": "PREVIEW", "x": "%s", "y": "%s", "width": "%s", "height": "%s", "scaler": "contain", "path": "%s"}\n' "$4" "$(($5 + 1))" "$(($2 - 1))" "$(($3 - 2))" "$1" >"$FIFO_UEBERZUGPP" + if [ -f "$1" ] && command -v kitty >/dev/null 2>&1; then + file=$1 + w=$2 + h=$3 + x=$4 + y=$5 + kitty +kitten icat --silent --stdin no --transfer-mode file --place "${w}x${h}@${x}x${y}" "$file" </dev/null >/dev/tty mediainfo --Output="Video;%Duration/String%" "$6" else + chafa "$1" -s "$4x" mediainfo "$6" fi } @@ -30,12 +36,12 @@ image/vnd.djvu) [ ! -f "$CACHE" ] && djvused "$1" -e 'select 1; save-page-with /dev/stdout' | magick -density 200 - "$CACHE.jpg" >/dev/null 2>&1 image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" ;; -image/svg+xml) +image/svg+xml | image/png) CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" [ ! -f "$CACHE" ] && inkscape --convert-dpi-method=none -o "$CACHE.png" --export-overwrite -D --export-png-color-mode=RGBA_16 "$1" image "$CACHE.png" "$2" "$3" "$4" "$5" "$1" ;; -image/x-xcf) +image/x-xcf | image/jpg | image/jpeg) CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}')" [ ! -f "$CACHE.jpg" ] && magick "$1[0]" "$CACHE.jpg" image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" diff --git a/mac/.config/shell/aliasrc b/mac/.config/shell/aliasrc index 13ae888..30fb9f9 100644 --- a/mac/.config/shell/aliasrc +++ b/mac/.config/shell/aliasrc @@ -206,7 +206,7 @@ alias dgst='dotbare status' alias ff='fastfetch' # fcitx5-remote -alias fr='fcitx5-remote' +# alias fr='fcitx5-remote' # ffmpeg alias ffmpeg='ffmpeg -hide_banner' @@ -255,7 +255,7 @@ alias k9='kill -9' alias k15='kill -15' # lf -alias lf='lfub' +# alias lf='lfub' # mime alias mimereset="update-desktop-database ${XDG_DATA_HOME:-${HOME}/.local/share}/applications" @@ -298,7 +298,7 @@ alias nsxiv='nsxiv -p' alias vo="cd $HOME/Obsidian/SI && nvim Dashboard.md" # open -alias open='xdg-open' +# alias open='xdg-open' # pacman command -v pacman > /dev/null 2>&1 && { @@ -343,9 +343,9 @@ alias rscr='rsync -vrazPlu --remove-source-files' alias rrr='sudo udevadm control --reload-rules' # samba -alias winip="[ ! -d /media/$USER/hdd >/dev/null 2>&1 ] && mkdir -p /media/$USER/hdd >/dev/null 2>&1; sudo mount -t cifs //$(pass show smb/hdd) /media/$USER/hdd -o username=\"si\",password=\"$(pass show default/default)vers=2.0\"" -alias win10="[ ! -d /media/$USER/win10 >/dev/null 2>&1 ] && mkdir -p /media/$USER/win10 >/dev/null 2>&1; sudo mount -t cifs //$(pass show smb/share) /media/$USER/win10 -o username=\"THESIAHXYZ-WIN1\",password=\"$(pass show default/default)\"" -alias macair="[ ! -d /media/$USER/macair >/dev/null 2>&1 ] && mkdir -p /media/$USER/macair >/dev/null 2>&1; sudo mount -t cifs //$(pass show smb/macair)/si /media/$USER/macair -o username=\"Soomin Im\",password=\"$(pass show default/default)\"" +# alias winip="[ ! -d /media/$USER/hdd >/dev/null 2>&1 ] && mkdir -p /media/$USER/hdd >/dev/null 2>&1; sudo mount -t cifs //$(pass show smb/hdd) /media/$USER/hdd -o username=\"si\",password=\"$(pass show default/default)vers=2.0\"" +# alias win10="[ ! -d /media/$USER/win10 >/dev/null 2>&1 ] && mkdir -p /media/$USER/win10 >/dev/null 2>&1; sudo mount -t cifs //$(pass show smb/share) /media/$USER/win10 -o username=\"THESIAHXYZ-WIN1\",password=\"$(pass show default/default)\"" +# alias macair="[ ! -d /media/$USER/macair >/dev/null 2>&1 ] && mkdir -p /media/$USER/macair >/dev/null 2>&1; sudo mount -t cifs //$(pass show smb/macair)/si /media/$USER/macair -o username=\"Soomin Im\",password=\"$(pass show default/default)\"" # sc-im alias scim='sc-im' @@ -372,7 +372,7 @@ alias tofish="sudo chsh $USER -s /bin/fish && 'Now log out.'" alias shck='shellcheck --color=always' # shortcut -alias ref='shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-${HOME}/.config}/shell/shortcutrc; source ${XDG_CONFIG_HOME:-${HOME}/.config}/shell/shortcutenvrc; source ${XDG_CONFIG_HOME:-${HOME}/.config}/shell/zshnameddirrc' +alias ref='localshortcuts >/dev/null; source ${XDG_CONFIG_HOME:-${HOME}/.config}/shell/shortcutrc; source ${XDG_CONFIG_HOME:-${HOME}/.config}/shell/shortcutenvrc; source ${XDG_CONFIG_HOME:-${HOME}/.config}/shell/zshnameddirrc' # skype alias skype='skypeforlinux' diff --git a/mac/.config/shell/git-aliasrc b/mac/.config/shell/git-aliasrc index f87a556..e6560c4 100644 --- a/mac/.config/shell/git-aliasrc +++ b/mac/.config/shell/git-aliasrc @@ -102,7 +102,7 @@ compdef _git ggpnp=git-checkout alias ggpur='ggu' alias g='git' -! pidof transmission-daemon >/dev/null && alias gaa='git add --all' || alias gaa='echo "Turn off transmission-daemon first!"' +! pgrep -x transmission-daemon >/dev/null 2>&1 && alias gaa='git add --all' || alias gaa='echo "Turn off transmission-daemon first!"' alias gapa='git add --patch' alias gau='git add --update' alias gav='git add --verbose' diff --git a/mac/.config/shell/profile b/mac/.config/shell/profile index ad43eb2..21858e9 100644 --- a/mac/.config/shell/profile +++ b/mac/.config/shell/profile @@ -3,6 +3,7 @@ ################################################### # Add all directories in each subdirectory to $PATH export PATH="$PATH:/opt/homebrew/bin" +export PATH="$PATH:$(find -L /opt/homebrew/opt -name bin -type d -print 2>/dev/null | sort -u | paste -s -d ':' -)" export PATH="$PATH:$(find ~/.local/bin -path '*/.git*' -prune -o \( -type f -o -type l \) -perm -u=x -exec dirname {} \; | sort -u | paste -sd ':' -)" export PATH="$PATH:$(find ~/.local/share/.password-store -type d -name '.extensions' | paste -sd ':' -)" @@ -113,19 +114,19 @@ export LYNX_CFG_PATH="$XDG_CONFIG_HOME/lynx" ### --- MANPAGER --- ### ([ -x "$(command -v batcat)" ] || [ -x "$(command -v batman)" ]) && { - export MANPAGER="sh -c 'col -bx | bat -l man -p'" - export MANROFFOPT="-c" -} || { - export MANPAGER='less -s' - export LESS="R" - export LESS_TERMCAP_mb="$(printf '%b' '[1;31m')" - export LESS_TERMCAP_md="$(printf '%b' '[1;36m')" - export LESS_TERMCAP_me="$(printf '%b' '[0m')" - export LESS_TERMCAP_so="$(printf '%b' '[01;44;33m')" - export LESS_TERMCAP_se="$(printf '%b' '[0m')" - export LESS_TERMCAP_us="$(printf '%b' '[1;32m')" - export LESS_TERMCAP_ue="$(printf '%b' '[0m')" - export LESSOPEN="| lesspipe.sh %s" + export MANPAGER="sh -c 'col -bx | bat -l man -p'" + export MANROFFOPT="-c" + } || { + export MANPAGER='less -s' + export LESS="R" + export LESS_TERMCAP_mb="$(printf '%b' '[1;31m')" + export LESS_TERMCAP_md="$(printf '%b' '[1;36m')" + export LESS_TERMCAP_me="$(printf '%b' '[0m')" + export LESS_TERMCAP_so="$(printf '%b' '[01;44;33m')" + export LESS_TERMCAP_se="$(printf '%b' '[0m')" + export LESS_TERMCAP_us="$(printf '%b' '[1;32m')" + export LESS_TERMCAP_ue="$(printf '%b' '[0m')" + export LESSOPEN="| lesspipe.sh %s" } ### --- MOZILLA --- ### @@ -159,6 +160,8 @@ export POWERLEVEL9K_INSTALLATION_DIR="/usr/share/zsh-theme-powerlevel10k" ### --- PYTHON --- ### export PYTHONPYCACHEPREFIX=$XDG_CACHE_HOME/python export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/pythonrc" +export PIPX_BIN_DIR="$XDG_SCRIPTS_HOME" +export PIPX_MAN_DIR="$XDG_DATA_HOME/man" ### --- RUST --- ### export RUSTUP_HOME="$XDG_DATA_HOME/rustup" diff --git a/mac/.config/zsh/.zshrc b/mac/.config/zsh/.zshrc index 4126b8f..d5f3490 100644 --- a/mac/.config/zsh/.zshrc +++ b/mac/.config/zsh/.zshrc @@ -112,14 +112,3 @@ zstyle ':fzf-tab:*' switch-group ',' '.' # switch group using `,` and `.` [ -f "${XDG_CONFIG_HOME:-${HOME}/.config}/shell/shortcutrc" ] && source "${XDG_CONFIG_HOME:-${HOME}/.config}/shell/shortcutrc" [ -f "${XDG_CONFIG_HOME:-${HOME}/.config}/shell/shortcutenvrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutenvrc" [ -f "${XDG_CONFIG_HOME:-${HOME}/.config}/shell/zshnameddirrc" ] && source "${XDG_CONFIG_HOME:-${HOME}/.config}/shell/zshnameddirrc" - -if command -v tmux >/dev/null 2>&1 && [ -z "$TMUX" ]; then - terminal_count=$(pgrep -u "$USER" -ax "${TERMINAL:-st}" | grep -Ev 'ncmpcpp|newsboat|pulsemixer|spterm|splf|spcalc|stig|vimwikitodo' | wc -l) - if [ "$terminal_count" -le 1 ]; then - if ! tmux has-session 2>/dev/null; then - exec tmux new-session -s code - else - exec tmux attach-session - fi - fi -fi diff --git a/mac/.local/bin/gitupdate b/mac/.local/bin/gitupdate index 4fed27e..a2c83b5 100755 --- a/mac/.local/bin/gitupdate +++ b/mac/.local/bin/gitupdate @@ -2,7 +2,10 @@ set -eu -pidof transmission-daemon >/dev/null && echo "Turn off transmission-daemon first!" && exit 1 +pgrep -x transmission-daemon >/dev/null 2>&1 && { + echo "Turn off transmission-daemon first!" + exit 1 +} # Check if inside a Git repository ! git rev-parse --is-inside-work-tree >/dev/null 2>&1 && echo "Not a git repository." && exit 1 diff --git a/mac/.local/bin/ifinstalled b/mac/.local/bin/ifinstalled index d0bd26b..b48dd63 100755 --- a/mac/.local/bin/ifinstalled +++ b/mac/.local/bin/ifinstalled @@ -6,7 +6,10 @@ # various other scripts for clarity's sake. for x in "$@"; do - if ! which "$x" >/dev/null 2>&1 && ! pacman -Qq "$x" >/dev/null 2>&1; then - notify-send "📦 $x" "must be installed for this function." && exit 1 + if ! command -v "$x" >/dev/null 2>&1 && + ! brew list --formula "$x" >/dev/null 2>&1 && + ! brew list --cask "$x" >/dev/null 2>&1; then + osascript -e 'display notification "'"$x"' must be installed for this function." with title "📦 Dependency missing"' + exit 1 fi done diff --git a/mac/.local/bin/lfub b/mac/.local/bin/lfub index c999412..065f7c7 100755 --- a/mac/.local/bin/lfub +++ b/mac/.local/bin/lfub @@ -19,6 +19,6 @@ else mkfifo "$FIFO_UEBERZUGPP" ueberzugpp layer -s -p json <"$FIFO_UEBERZUGPP" & exec 3>"$FIFO_UEBERZUGPP" - trap cleanup HUP INT QUIT TERM PWR EXIT + trap cleanup HUP INT QUIT TERM EXIT lf "$@" 3>&- fi diff --git a/mac/.local/bin/shortcuts b/mac/.local/bin/localshortcuts index 118becb..b9d5ba9 100755 --- a/mac/.local/bin/shortcuts +++ b/mac/.local/bin/localshortcuts @@ -24,7 +24,7 @@ printf "\" vim: filetype=vim\\n" >"$vifm_shortcuts" # Format the `directories` file in the correct syntax and sent it to all three configs. eval "echo \"$(cat "$bmdirs")\"" | - awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\"); + gawk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\"); printf(\"%s=\42cd %s && ls -A\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ; printf(\"[ -n \42%s\42 ] && export %s=\42%s\42 \n\",\$1,\$1,\$2) >> \"$shell_env_shortcuts\" ; printf(\"hash -d %s=%s \n\",\$1,\$2) >> \"$zsh_named_dirs\" ; @@ -41,7 +41,7 @@ eval "echo \"$(cat "$bmdirs")\"" | # Format the `files` file in the correct syntax and sent it to both configs. eval "echo \"$(cat "$bmfiles")\"" | - awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\"); + gawk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\"); printf(\"%s=\42\$EDITOR %s\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ; printf(\"[ -n \42%s\42 ] && export %s=\42%s\42 \n\",\$1,\$1,\$2) >> \"$shell_env_shortcuts\" ; printf(\"v%s=\42\$EDITOR2 %s\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ; @@ -58,29 +58,29 @@ eval "echo \"$(cat "$bmfiles")\"" | printf(\"vim.keymap.set('c', ';%s', '%s<cr>', { noremap = true, silent = true, desc = '%s' })\n\", \$1, \$2, gensub(\"^/home/$USER/\",\"~/\",\"g\",\$2)) >> \"$nvim_shortcuts\" ; printf(\"vim.keymap.set('n', '<localleader><localleader>%s', '<cmd>e %s<cr>', { noremap = true, silent = true, desc = '%s' })\n\", \$1, \$2, gensub(\"^/home/$USER/\",\"~/\",\"g\",\$2)) >> \"$nvim_shortcuts\"}" -# root -root_shell_shortcuts="/root/.config/shell/rootshortcutrc" -root_zsh_named_dirs="/root/.config/shell/rootzshnameddirrc" -root_lf_shortcuts="/root/.config/lf/rootshortcutrc" -root_vim_shortcuts="/root/.config/vim/rootshortcuts.vim" - -sudo rm -f "$root_zsh_named_dirs" "$root_lf_shortcuts" "$root_vim_shortcuts" 2>/dev/null -printf "# vim: filetype=sh\\nalias " | sudo tee "$root_shell_shortcuts" 2>/dev/null -sudo mkdir -p /root/.config/shell/ /root/.config/lf/ /root/.config/vim/ -sudo touch "$root_shell_shortcuts" "$root_zsh_named_dirs" "$root_lf_shortcuts" "$root_vim_shortcuts" - -eval "echo \"$(cat "$bmdirs")\"" | - sudo awk "!/^\s*#/ && !/^\s*\$/ && /cache|config($|\/bash|\/lf|\/shell|\/vim)|local\/(bin|share|state)$/ {gsub(\"\\\s*#.*$\",\"\"); gsub(\"home/$USER\", \"root\"); - printf(\",%s=\42cd %s && ls -A\42 \\\\\n\",\$1,\$2) >> \"$root_shell_shortcuts\" ; - printf(\"hash -d ,%s=%s \n\",\$1,\$2) >> \"$root_zsh_named_dirs\" ; - printf(\"map ,%s cd \42%s\42 \n\",\$1,\$2) >> \"$root_lf_shortcuts\" ; - printf(\"cmap ;%s %s\n\",\$1,\$2) >> \"$root_vim_shortcuts\" ; - printf(\"nmap <localleader><localleader>%s :Explore %s<cr>\n\",\$1,\$2) >> \"$root_vim_shortcuts\"}" - -eval "echo \"$(cat "$bmfiles")\"" | - sudo awk "!/^\s*#/ && !/^\s*\$/ && /config\/(bash|lf|vim)\/.*rc |inputrc|\$EDITOR / {gsub(\"\\\s*#.*$\",\"\"); gsub(\"home/$USER\", \"root\"); - printf(\",%s=\42\$EDITOR %s\42 \\\\\n\",\$1,\$2) >> \"$root_shell_shortcuts\" ; - printf(\"hash -d ,%s=%s \n\",\$1,\$2) >> \"$root_zsh_named_dirs\" ; - printf(\"map ,%s \$\$EDITOR \42%s\42 \n\",\$1,\$2) >> \"$root_lf_shortcuts\" ; - printf(\"cmap ;%s %s\n\",\$1,\$2) >> \"$root_vim_shortcuts\" ; - printf(\"nmap <localleader><localleader>%s :e %s<cr>\n\",\$1,\$2) >> \"$root_vim_shortcuts\"}" +# # root +# root_shell_shortcuts="/root/.config/shell/rootshortcutrc" +# root_zsh_named_dirs="/root/.config/shell/rootzshnameddirrc" +# root_lf_shortcuts="/root/.config/lf/rootshortcutrc" +# root_vim_shortcuts="/root/.config/vim/rootshortcuts.vim" +# +# sudo rm -f "$root_zsh_named_dirs" "$root_lf_shortcuts" "$root_vim_shortcuts" 2>/dev/null +# printf "# vim: filetype=sh\\nalias " | sudo tee "$root_shell_shortcuts" 2>/dev/null +# sudo mkdir -p /root/.config/shell/ /root/.config/lf/ /root/.config/vim/ +# sudo touch "$root_shell_shortcuts" "$root_zsh_named_dirs" "$root_lf_shortcuts" "$root_vim_shortcuts" +# +# eval "echo \"$(cat "$bmdirs")\"" | +# sudo awk "!/^\s*#/ && !/^\s*\$/ && /cache|config($|\/bash|\/lf|\/shell|\/vim)|local\/(bin|share|state)$/ {gsub(\"\\\s*#.*$\",\"\"); gsub(\"home/$USER\", \"root\"); +# printf(\",%s=\42cd %s && ls -A\42 \\\\\n\",\$1,\$2) >> \"$root_shell_shortcuts\" ; +# printf(\"hash -d ,%s=%s \n\",\$1,\$2) >> \"$root_zsh_named_dirs\" ; +# printf(\"map ,%s cd \42%s\42 \n\",\$1,\$2) >> \"$root_lf_shortcuts\" ; +# printf(\"cmap ;%s %s\n\",\$1,\$2) >> \"$root_vim_shortcuts\" ; +# printf(\"nmap <localleader><localleader>%s :Explore %s<cr>\n\",\$1,\$2) >> \"$root_vim_shortcuts\"}" +# +# eval "echo \"$(cat "$bmfiles")\"" | +# sudo awk "!/^\s*#/ && !/^\s*\$/ && /config\/(bash|lf|vim)\/.*rc |inputrc|\$EDITOR / {gsub(\"\\\s*#.*$\",\"\"); gsub(\"home/$USER\", \"root\"); +# printf(\",%s=\42\$EDITOR %s\42 \\\\\n\",\$1,\$2) >> \"$root_shell_shortcuts\" ; +# printf(\"hash -d ,%s=%s \n\",\$1,\$2) >> \"$root_zsh_named_dirs\" ; +# printf(\"map ,%s \$\$EDITOR \42%s\42 \n\",\$1,\$2) >> \"$root_lf_shortcuts\" ; +# printf(\"cmap ;%s %s\n\",\$1,\$2) >> \"$root_vim_shortcuts\" ; +# printf(\"nmap <localleader><localleader>%s :e %s<cr>\n\",\$1,\$2) >> \"$root_vim_shortcuts\"}" diff --git a/mac/.local/bin/rgafiles b/mac/.local/bin/rgafiles index e8b5e72..ea02fc9 100755 --- a/mac/.local/bin/rgafiles +++ b/mac/.local/bin/rgafiles @@ -29,10 +29,6 @@ search_term() { echo "Error: 'rga' is not installed." >&2 exit 1 fi - if ! command -v xclip >/dev/null 2>&1; then - echo "Error: 'xclip' is not installed." >&2 - exit 1 - fi # Construct the preview command preview_cmd=$(printf "rga %s --pretty --context 10 '%s' {}" "$case_flag" "$*") @@ -48,7 +44,7 @@ search_term() { fi # copy target to the clipboard - echo "$@" | xclip -selection clipboard 2>/dev/null + echo "$@" | pbcopy 2>/dev/null openfiles "$files" diff --git a/mac/.local/bin/tmuxdbussync b/mac/.local/bin/tmuxdbussync index d6da872..b049fae 100755 --- a/mac/.local/bin/tmuxdbussync +++ b/mac/.local/bin/tmuxdbussync @@ -1,15 +1,15 @@ #!/bin/sh -fcitx5_pid=$(pgrep -f fcitx5 | head -n1) - -if [ -z "$fcitx5_pid" ]; then - echo "echo 'No terminal process found matching: fcitx5' >&2" - exit 1 -fi - -fcitx5_dbus=$(tr '\0' '\n' </proc/"$fcitx5_pid"/environ | grep DBUS_SESSION_BUS_ADDRESS) -fcitx5_dbus="${fcitx5_dbus#DBUS_SESSION_BUS_ADDRESS=}" - -if [ "$DBUS_SESSION_BUS_ADDRESS" != "$fcitx5_dbus" ]; then - echo "export DBUS_SESSION_BUS_ADDRESS=$fcitx5_dbus" -fi +# fcitx5_pid=$(pgrep -f fcitx5 | head -n1) +# +# if [ -z "$fcitx5_pid" ]; then +# echo "echo 'No terminal process found matching: fcitx5' >&2" +# exit 1 +# fi +# +# fcitx5_dbus=$(tr '\0' '\n' </proc/"$fcitx5_pid"/environ | grep DBUS_SESSION_BUS_ADDRESS) +# fcitx5_dbus="${fcitx5_dbus#DBUS_SESSION_BUS_ADDRESS=}" +# +# if [ "$DBUS_SESSION_BUS_ADDRESS" != "$fcitx5_dbus" ]; then +# echo "export DBUS_SESSION_BUS_ADDRESS=$fcitx5_dbus" +# fi diff --git a/mac/.local/bin/torwrap b/mac/.local/bin/torwrap index 54f5c0e..f038361 100755 --- a/mac/.local/bin/torwrap +++ b/mac/.local/bin/torwrap @@ -2,7 +2,7 @@ ifinstalled stig transmission-cli || exit 1 -! pidof transmission-daemon >/dev/null && transmission-daemon && notify-send "Starting torrent daemon..." +! pgrep -x transmission-daemon >/dev/null 2>&1 && transmission-daemon && osascript -e 'display notification "Starting torrent daemon..." with title "transmission-daemon"' "${TERMINAL:-st}" -n stig -e stig pkill -RTMIN+22 "${STATUSBAR:-dwmblocks}" diff --git a/mac/.local/bin/transadd b/mac/.local/bin/transadd index ffd8ded..c6d2e94 100755 --- a/mac/.local/bin/transadd +++ b/mac/.local/bin/transadd @@ -4,7 +4,10 @@ # transmission-daemon sometimes fails to take remote requests in its first moments, hence the sleep. -pidof transmission-daemon >/dev/null || (transmission-daemon && notify-send "💡 Starting transmission daemon..." && sleep 3 && pkill -RTMIN+22 "${STATUSBAR:-dwmblocks}") +pgrep -x transmission-daemon >/dev/null 2>&1 || ( + transmission-daemon && + osascript -e 'display notification "💡 Starting transmission daemon..." with title "transmission-daemon"' +) directory="$HOME/Torrents" |
