diff options
| -rw-r--r-- | mac/.config/aerospace/aerospace.toml | 23 | ||||
| -rw-r--r-- | mac/.config/kitty/kitty.conf | 2 | ||||
| -rwxr-xr-x | mac/.config/lf/cleaner | 3 | ||||
| -rw-r--r-- | mac/.config/lf/lfrc | 64 | ||||
| -rwxr-xr-x | mac/.config/lf/scope | 154 | ||||
| -rw-r--r-- | mac/.config/tmux/tmux.conf | 2 |
6 files changed, 143 insertions, 105 deletions
diff --git a/mac/.config/aerospace/aerospace.toml b/mac/.config/aerospace/aerospace.toml index aa055be..5412537 100644 --- a/mac/.config/aerospace/aerospace.toml +++ b/mac/.config/aerospace/aerospace.toml @@ -138,8 +138,8 @@ on-focus-changed = ['move-mouse window-lazy-center'] alt-ctrl-w = 'exec-and-forget open -na "Brave Browser"' # See: https://nikitabobko.github.io/AeroSpace/commands#layout - alt-slash = 'layout tiles horizontal vertical' - alt-comma = 'layout accordion horizontal vertical' + alt-ctrl-slash = 'layout tiles horizontal vertical' + alt-ctrl-comma = 'layout accordion horizontal vertical' # See: https://nikitabobko.github.io/AeroSpace/commands#focus alt-h = 'focus left --boundaries all-monitors-outer-frame' @@ -158,6 +158,7 @@ on-focus-changed = ['move-mouse window-lazy-center'] alt-equal = 'resize smart +50' # See: https://nikitabobko.github.io/AeroSpace/commands#workspace + alt-f = 'workspace E' alt-1 = 'workspace 1' alt-2 = 'workspace 2' alt-3 = 'workspace 3' @@ -263,6 +264,10 @@ on-focus-changed = ['move-mouse window-lazy-center'] # Application Rules [[on-window-detected]] +if.app-id = 'com.apple.finder' +run = ['move-node-to-workspace E'] + +[[on-window-detected]] if.app-id = 'com.apple.weather' run = ['layout floating'] @@ -288,31 +293,31 @@ run = ['move-node-to-workspace 4'] [[on-window-detected]] if.app-id = 'com.microsoft.VSCode' -run = ['move-node-to-workspace 5'] +run = ['move-node-to-workspace 6'] [[on-window-detected]] if.app-id = 'com.microsoft.Excel' -run = ['move-node-to-workspace 6'] +run = ['move-node-to-workspace 7'] [[on-window-detected]] if.app-id = 'com.microsoft.Word' -run = ['move-node-to-workspace 6'] +run = ['move-node-to-workspace 7'] [[on-window-detected]] if.app-id = 'com.microsoft.Powerpoint' -run = ['move-node-to-workspace 6'] +run = ['move-node-to-workspace 7'] [[on-window-detected]] if.app-id = 'org.jkiss.dbeaver.core.product' -run = ['move-node-to-workspace 7'] +run = ['move-node-to-workspace 8'] [[on-window-detected]] if.app-id = 'com.electron.dockerdesktop' -run = ['move-node-to-workspace 8'] +run = ['move-node-to-workspace 9'] [[on-window-detected]] if.app-id = 'com.microsoft.Outlook' -run = ['move-node-to-workspace 9'] +run = ['move-node-to-workspace 10'] [[on-window-detected]] if.app-id = 'com.microsoft.teams2' diff --git a/mac/.config/kitty/kitty.conf b/mac/.config/kitty/kitty.conf index fac38cc..1be69e0 100644 --- a/mac/.config/kitty/kitty.conf +++ b/mac/.config/kitty/kitty.conf @@ -1971,6 +1971,8 @@ map cmd+enter no_op # map kitty_mod+n new_os_window map cmd+n no_op +map ctrl+shift+p no_op +map ctrl+shift+n no_op #:: Works like new_window above, except that it opens a top-level OS #:: window. In particular you can use new_os_window_with_cwd to open diff --git a/mac/.config/lf/cleaner b/mac/.config/lf/cleaner index 0c8b566..ace13da 100755 --- a/mac/.config/lf/cleaner +++ b/mac/.config/lf/cleaner @@ -1,5 +1,6 @@ #!/bin/sh if command -v kitty >/dev/null 2>&1; then - kitty +kitten icat --silent --stdin no --transfer-mode file --clear </dev/null >/dev/tty + printf '\033_Ga=d,d=a\033\\' >/dev/tty 2>/dev/null + kitty +kitten icat --silent --stdin no --transfer-mode file --clear </dev/null >/dev/tty 2>/dev/null fi diff --git a/mac/.config/lf/lfrc b/mac/.config/lf/lfrc index d61b5d9..7dc668b 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) libreoffice $fx >/dev/null 2>&1 ;; - ghw) gtkwave $f >/dev/null 2>&1 ;; - ts) mpv --x11-name=video $f -quiet >/dev/null 2>&1 ;; - *) zathura $fx >/dev/null 2>&1 ;; - esac - ;; - application/epub*|application/pdf|application/postscript|application/vnd.djvu|image/vnd.djvu) 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) firefox $fx >/dev/null 2>&1 ;; - application/x-hwp|application/vnd.openxmlformats-officedocument.presentationml.presentation|application/vnd.openxmlformats-officedocument.wordprocessingml.document) libreoffice $fx >/dev/null 2>&1 ;; - audio/*|video/x-ms-asf) mpv --volume=50 --x11-name=music --force-window=yes --audio-display=embedded-first $f >/dev/null 2>&1 ;; - image/x-xcf) 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\)*$" | - 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/*) mpv --x11-name=video -quiet $f >/dev/null 2>&1 ;; - *) for f in $fx; do open -a $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) libreoffice $fx >/dev/null 2>&1 ;; +# ghw) gtkwave $f >/dev/null 2>&1 ;; +# ts) mpv --x11-name=video $f -quiet >/dev/null 2>&1 ;; +# *) zathura $fx >/dev/null 2>&1 ;; +# esac +# ;; +# application/epub*|application/pdf|application/postscript|application/vnd.djvu|image/vnd.djvu) 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) firefox $fx >/dev/null 2>&1 ;; +# application/x-hwp|application/vnd.openxmlformats-officedocument.presentationml.presentation|application/vnd.openxmlformats-officedocument.wordprocessingml.document) libreoffice $fx >/dev/null 2>&1 ;; +# audio/*|video/x-ms-asf) mpv --volume=50 --x11-name=music --force-window=yes --audio-display=embedded-first $f >/dev/null 2>&1 ;; +# image/x-xcf) 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\)*$" | +# 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/*) mpv --x11-name=video -quiet $f >/dev/null 2>&1 ;; +# *) for f in $fx; do open -a $f >/dev/null 2>&1; done;; +# esac +# }} # Rename cmd bulkrename ${{ diff --git a/mac/.config/lf/scope b/mac/.config/lf/scope index fd3bae7..2a2970d 100755 --- a/mac/.config/lf/scope +++ b/mac/.config/lf/scope @@ -1,89 +1,119 @@ #!/bin/bash -# File preview handler for lf. - set -C -f IFS="$(printf '%b_' '\n')" IFS="${IFS%_}" -image() { +cache_key() { + stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | + sha256sum | awk '{print $1}' +} + +kitty_clear_all() { + printf '\033_Ga=d,d=a\033\\' >/dev/tty 2>/dev/null + kitty +kitten icat --silent --stdin no --transfer-mode file --clear </dev/null >/dev/tty 2>/dev/null +} + +draw_image() { if [ -f "$1" ] && command -v kitty >/dev/null 2>&1; then - file=$1 - w=$2 - h=$3 - x=$4 - y=$5 - kitty +kitten icat --stdin no --transfer-mode file --place "${w}x${h}@${x}x${y}" "$file" </dev/null >/dev/tty - mediainfo --Output="Video;%Duration/String%" "$6" + kitty_clear_all + sleep 0.01 + kitty +kitten icat --silent --stdin no --transfer-mode file \ + --place "${2}x${3}@${4}x${5}" "$1" </dev/null >/dev/tty else - chafa "$1" -s "$4x" - mediainfo "$6" + chafa "$1" -s "${2}x${3}" fi } -# Note that the cache file name is a function of file information, meaning if -# an image appears in multiple places across the machine, it will not have to -# be regenerated once seen. +CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/lf" +mkdir -p "$CACHE_DIR" +mime="$(file --dereference --brief --mime-type -- "$1")" -case "$(file --dereference --brief --mime-type -- "$1")" in +case "$mime" in image/avif) - 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" ] && magick "$1" "$CACHE.jpg" - image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" - ;; -image/vnd.djvu) - 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" ] && 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/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/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" ] && magick "$1[0]" "$CACHE.jpg" - image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" - ;; -image/*) image "$1" "$2" "$3" "$4" "$5" "$1" ;; -text/html) lynx -width="$4" -display_charset=utf-8 -dump "$1" ;; -text/troff) man ./ "$1" | col -b ;; -text/* | */xml | application/json | application/x-ndjson) bat -p --theme ansi --terminal-width "$(($4 - 2))" -f "$1" ;; -audio/*) mediainfo "$1" || exit 1 ;; + key=$(cache_key "$1") + out="$CACHE_DIR/thumb.$key.jpg" + [ -f "$out" ] || magick "$1" "$out" >/dev/null 2>&1 + draw_image "$out" "$2" "$3" "$4" "$5" + ;; +image/svg+xml) + key=$(cache_key "$1") + out="$CACHE_DIR/thumb.$key.png" + [ -f "$out" ] || inkscape --convert-dpi-method=none -o "$out" --export-overwrite -D "$1" >/dev/null 2>&1 + draw_image "$out" "$2" "$3" "$4" "$5" + ;; +image/png | image/jpg | image/jpeg) + draw_image "$1" "$2" "$3" "$4" "$5" + ;; +image/x-xcf) + key=$(cache_key "$1") + out="$CACHE_DIR/thumb.$key.jpg" + [ -f "$out" ] || magick "$1[0]" "$out" >/dev/null 2>&1 + draw_image "$out" "$2" "$3" "$4" "$5" + ;; +image/*) + draw_image "$1" "$2" "$3" "$4" "$5" + ;; +text/html) + lynx -width="$4" -display_charset=utf-8 -dump "$1" + ;; +text/troff) + man ./ "$1" | col -b + ;; +text/* | */xml | application/json | application/x-ndjson) + bat -p --theme ansi --terminal-width "$(($4 - 2))" -f "$1" + ;; +audio/*) + mediainfo "$1" || exit 1 + ;; video/* | application/octet-stream | application/vnd.rn-realmedia) - # 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" ] && ffmpegthumbnailer -i "$1" -o "$CACHE.jpg" -s 0 -q 5 - image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" + key=$(cache_key "$1") + jpg="$CACHE_DIR/thumb.$key.jpg" + [ -f "$jpg" ] || ffmpegthumbnailer -i "$1" -o "$jpg" -s 0 -q 5 >/dev/null 2>&1 + draw_image "$jpg" "$2" "$3" "$4" "$5" + # 필요 시 메타 한 줄: + # mediainfo --Output="Video;%Duration/String%" "$1" ;; */pdf) - 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" ] && pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE" - image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" + key=$(cache_key "$1") + base="$CACHE_DIR/thumb.$key" + [ -f "$base.jpg" ] || pdftoppm -jpeg -f 1 -singlefile "$1" "$base" >/dev/null 2>&1 + draw_image "$base.jpg" "$2" "$3" "$4" "$5" ;; application/vnd.openxmlformats-officedocument.presentationml.presentation) - 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" ] && unoconv -f jpg -o "$CACHE.jpg" "$1" - image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" + key=$(cache_key "$1") + jpg="$CACHE_DIR/thumb.$key.jpg" + [ -f "$jpg" ] || unoconv -f jpg -o "$jpg" "$1" >/dev/null 2>&1 + draw_image "$jpg" "$2" "$3" "$4" "$5" ;; application/x-hwp) - 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)" - OUT_DIR="$(dirname "$CACHE")" - [ ! -f "$CACHE" ] && libreoffice --headless --convert-to jpg --outdir "$OUT_DIR" "$1" && mv "$OUT_DIR/$(basename "$1" .hwp).jpg" "$CACHE.jpg" - image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" + key=$(cache_key "$1") + jpg="$CACHE_DIR/thumb.$key.jpg" + outdir="$(dirname "$jpg")" + [ -f "$jpg" ] || { libreoffice --headless --convert-to jpg --outdir "$outdir" "$1" >/dev/null 2>&1 && mv "$outdir/$(basename "$1" .hwp).jpg" "$jpg"; } + draw_image "$jpg" "$2" "$3" "$4" "$5" ;; */epub+zip | */mobi*) - 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" ] && gnome-epub-thumbnailer "$1" "$CACHE.jpg" - image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" + key=$(cache_key "$1") + jpg="$CACHE_DIR/thumb.$key.jpg" + [ -f "$jpg" ] || gnome-epub-thumbnailer "$1" "$jpg" >/dev/null 2>&1 + draw_image "$jpg" "$2" "$3" "$4" "$5" + ;; +application/*zip) + atool --list -- "$1" + ;; +*opendocument*) + odt2txt "$1" + ;; +application/pgp-encrypted) + gpg -d -- "$1" ;; -application/*zip) atool --list -- "$1" ;; -*opendocument*) odt2txt "$1" ;; -application/pgp-encrypted) gpg -d -- "$1" ;; application/vnd.openxmlformats-officedocument.wordprocessingml.document) - 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.txt" ] && pandoc "$1" -t plain -o "$CACHE.txt" - bat -p --theme ansi --terminal-width "$(($4 - 2))" -f "$CACHE.txt" + key=$(cache_key "$1") + txt="$CACHE_DIR/thumb.$key.txt" + [ -f "$txt" ] || pandoc "$1" -t plain -o "$txt" >/dev/null 2>&1 + bat -p --theme ansi --terminal-width "$(($4 - 2))" -f "$txt" ;; esac + exit 1 diff --git a/mac/.config/tmux/tmux.conf b/mac/.config/tmux/tmux.conf index 9de13f9..508860d 100644 --- a/mac/.config/tmux/tmux.conf +++ b/mac/.config/tmux/tmux.conf @@ -10,7 +10,7 @@ if 'test ! -d "${TMUX_PLUGIN_MANAGER_PATH}"' { ### --- Settings --- ### # general -set -as terminal-features 'xterm*:extkeys' +set -ga terminal-features "xterm-kitty:RGB" set -g base-index 1 set -g pane-base-index 1 set -g default-shell /bin/zsh |
