diff options
| author | Mike Vink <ivi@vinkies.net> | 2025-03-13 15:59:30 +0100 |
|---|---|---|
| committer | Mike Vink <ivi@vinkies.net> | 2025-03-13 15:59:30 +0100 |
| commit | 54d308571af70ef482e8e8bfce81738379e1f855 (patch) | |
| tree | 6caa50ab17946ff6862c742a60b220f3c483f200 | |
| parent | ea9b11e81210251630553409be1655072d251287 (diff) | |
move to macos
| -rw-r--r-- | .config/aerospace/aerospace.toml | 34 | ||||
| -rw-r--r-- | .config/kak/kakrc | 47 | ||||
| -rw-r--r-- | .config/ksh/ksh.kshrc | 9 | ||||
| -rw-r--r-- | .config/shell/aliasrc | 3 | ||||
| -rwxr-xr-x | .local/bin/cd-kak-buf | 17 | ||||
| -rwxr-xr-x | .local/bin/desktop-open-pipe | 12 | ||||
| -rwxr-xr-x | .local/bin/kc | 2 | ||||
| -rwxr-xr-x | .local/bin/ks | 2 | ||||
| -rwxr-xr-x | .local/bin/pn | 33 | ||||
| -rwxr-xr-x | .local/bin/pnsh-nvim | 41 | ||||
| -rwxr-xr-x | .local/bin/putdotfiles | 5 | ||||
| -rwxr-xr-x | .local/bin/pwd-short | 25 | ||||
| -rwxr-xr-x | .local/bin/vis-clipboard | 10 | ||||
| -rwxr-xr-x | .local/bin/xdg-open | 2 |
14 files changed, 143 insertions, 99 deletions
diff --git a/.config/aerospace/aerospace.toml b/.config/aerospace/aerospace.toml index 216faeb..930661b 100644 --- a/.config/aerospace/aerospace.toml +++ b/.config/aerospace/aerospace.toml @@ -16,20 +16,20 @@ start-at-login = true # Normalizations. See: https://nikitabobko.github.io/AeroSpace/guide#normalization enable-normalization-flatten-containers = true -enable-normalization-opposite-orientation-for-nested-containers = true +enable-normalization-opposite-orientation-for-nested-containers = false # See: https://nikitabobko.github.io/AeroSpace/guide#layouts # The 'accordion-padding' specifies the size of accordion padding # You can set 0 to disable the padding feature -accordion-padding = 100 +accordion-padding = 10 # Possible values: tiles|accordion -default-root-container-layout = 'accordion' +default-root-container-layout = 'tiles' # Possible values: horizontal|vertical|auto # 'auto' means: wide monitor (anything wider than high) gets horizontal orientation, # tall monitor (anything higher than wide) gets vertical orientation -default-root-container-orientation = 'auto' +default-root-container-orientation = 'vertical' # Mouse follows focus when focused monitor changes # Drop it from your config, if you don't like this behavior @@ -41,7 +41,7 @@ on-focused-monitor-changed = ['move-mouse monitor-lazy-center'] # You can effectively turn off macOS "Hide application" (cmd-h) feature by toggling this flag # Useful if you don't use this macOS feature, but accidentally hit cmd-h or cmd-alt-h key # Also see: https://nikitabobko.github.io/AeroSpace/goodies#disable-hide-app -automatically-unhide-macos-hidden-apps = false +automatically-unhide-macos-hidden-apps = true # Possible values: (qwerty|dvorak) # See https://nikitabobko.github.io/AeroSpace/guide#key-mapping @@ -92,7 +92,7 @@ automatically-unhide-macos-hidden-apps = false cmd-shift-d = 'exec-and-forget source /etc/profile; PATH="$HOME/.local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:$PATH" passmenu' cmd-f = 'fullscreen' cmd-d = 'exec-and-forget source /etc/profile; PATH="$HOME/.local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:$PATH" /Applications/dmenu-mac.app/Contents/MacOS/dmenu-mac' - cmd-enter = '''exec-and-forget osascript -e ' + cmd-enter = ['''exec-and-forget osascript -e ' tell application "System Events" if exists application process "Ghostty" then tell application process "Ghostty" @@ -102,7 +102,7 @@ automatically-unhide-macos-hidden-apps = false tell application "Ghostty" to activate end if end tell' - ''' + '''] cmd-w = '''exec-and-forget osascript -e ' tell application "System Events" @@ -121,16 +121,24 @@ automatically-unhide-macos-hidden-apps = false cmd-comma = 'layout accordion horizontal vertical' # See: https://nikitabobko.github.io/AeroSpace/commands#focus - cmd-j = 'focus right' - cmd-k = 'focus left' + cmd-l = 'focus right' + cmd-h = 'focus left' + cmd-k = 'focus up' + cmd-j = 'focus down' + cmd-shift-l = 'move right' + cmd-shift-h = 'move left' + cmd-shift-k = 'move up' + cmd-shift-j = 'move down' # See: https://nikitabobko.github.io/AeroSpace/commands#move - cmd-shift-j = 'move right' - cmd-shift-k = 'move left' + cmd-o = 'join-with right' + cmd-i = 'join-with left' + cmd-shift-o = 'join-with up' + cmd-shift-i = 'join-with down' # See: https://nikitabobko.github.io/AeroSpace/commands#resize - cmd-minus = 'resize smart -50' - cmd-equal = 'resize smart +50' + cmd-minus = 'resize smart -100' + cmd-equal = 'resize smart +100' # See: https://nikitabobko.github.io/AeroSpace/commands#workspace cmd-1 = 'workspace 1' diff --git a/.config/kak/kakrc b/.config/kak/kakrc index d13adbd..74a2019 100644 --- a/.config/kak/kakrc +++ b/.config/kak/kakrc @@ -10,29 +10,30 @@ map -docstring "Jump to next make error" global goto ] <esc>:make-next-error map -docstring "Jump to previous make error" global goto [ <esc>:make-previous-error<ret> hook global RegisterModified '"' %{ nop %sh{ + export kak_client_pid="$kak_client_pid" printf %s "$kak_main_reg_dquote" | vis-clipboard --copy }} -define-command -docstring "Edit file relative to current buf" -params 1 edit-relative %{ edit "%sh{dirname ""${kak_buffile}""}/%arg{@}" } -alias global er edit-relative -complete-command -menu edit-relative shell-script %{ - orig="$(realpath --relative-to . $(dirname "$kak_buffile"))" - q="${1}" - if [ "$(basename "$q")" = ".." ]; then - d="$(realpath --relative-to . "$q")" - elif [ "$(basename "$q")" = "." ]; then - d="$(realpath --relative-to . "$q")" - elif [ -n "$q" ]; then - if [ "$(printf "$q" | tail -c 1)" = / ]; then - d="$q" - else - d="$(dirname "$q")" - fi - else - d="." - fi - # echo "orig:$orig" - # echo "q:$q" - # echo "d:$d" - fdfind --base-directory "$orig" --full-path --hidden --exact-depth 1 -- . "$d" | fzf --filter "$q" -} +# define-command -docstring "Edit file relative to current buf" -params 1 edit-relative %{ edit "%sh{dirname ""${kak_buffile}""}/%arg{@}" } +# alias global er edit-relative +# complete-command -menu edit-relative shell-script %{ +# orig="$(realpath --relative-to . $(dirname "$kak_buffile"))" +# q="${1}" +# if [ "$(basename "$q")" = ".." ]; then +# d="$(realpath --relative-to . "$q")" +# elif [ "$(basename "$q")" = "." ]; then +# d="$(realpath --relative-to . "$q")" +# elif [ -n "$q" ]; then +# if [ "$(printf "$q" | tail -c 1)" = / ]; then +# d="$q" +# else +# d="$(dirname "$q")" +# fi +# else +# d="." +# fi +# # echo "orig:$orig" +# # echo "q:$q" +# # echo "d:$d" +# fdfind --base-directory "$orig" --full-path --hidden --exact-depth 1 -- . "$d" | fzf --filter "$q" +# } diff --git a/.config/ksh/ksh.kshrc b/.config/ksh/ksh.kshrc index ab69c9a..532640a 100644 --- a/.config/ksh/ksh.kshrc +++ b/.config/ksh/ksh.kshrc @@ -13,14 +13,7 @@ bind -m ^O=' mcd^J' bind -m ^X^F=' REPLY="$(vis-open .)"; [ -z "$REPLY" ] || cd "$REPLY"^J' # Emacs mode clear chops off multline prompts. -export PS1="$(hostname):/\$( -root=\$(pwd | cut -d'/' -f2- --output-delimiter ' -' | head -n-3 | cut -c1-3 | paste -sd '/') -[ -z \$root ] || echo "\${root}/" -)\$( -pwd | cut -d'/' -f2- --output-delimiter ' -' | tail -n3 | paste -sd '/' -)\$(prompt-git)\$(prompt-tf)\n jobs(\j) # " +export PS1="$(hostname):\$(pwd-short)\$(prompt-git)\$(prompt-tf)\n jobs(\j) # " bind -m ^L="^A^K clear^J" export HISTFILE="$HOME/.history" diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index cef6159..8f50878 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -5,7 +5,8 @@ alias s="{ git status --short ; git log --oneline @{push}.. ; }" alias ga="git add " alias gc="git commit " alias d="docker " -alias k="kak " +# alias k="kak " alias kd='echo cd $PWD | kak -p s ' +alias kb='cd $(cd-kak-buf)' alias t="terraform " alias e='$EDITOR ' diff --git a/.local/bin/cd-kak-buf b/.local/bin/cd-kak-buf new file mode 100755 index 0000000..8dcf77a --- /dev/null +++ b/.local/bin/cd-kak-buf @@ -0,0 +1,17 @@ +#!/bin/sh +output=$(mktemp -d -t kak-temp-XXXXXXXX)/fifo +mkfifo "${output}" +echo "echo -to-file ${output} %val{client_list}" | kak -p s + +client_list=$(cat "${output}") +for c in $client_list; do + echo "evaluate-commands -client $c %{ echo -to-file ${output} %val{client_pid} }" | kak -p s + result=$(cat "${output}") + ppid=$(ps -o ppid= $result) + [ $ppid = $PPID ] && { + echo "evaluate-commands -client $c %{ echo -to-file ${output} %val{buffile} }" | kak -p s + result=$(cat "${output}") + echo $(dirname $result) + } +done +rm -r $(dirname ${output}) diff --git a/.local/bin/desktop-open-pipe b/.local/bin/desktop-open-pipe index b739379..adc6678 100755 --- a/.local/bin/desktop-open-pipe +++ b/.local/bin/desktop-open-pipe @@ -1,6 +1,6 @@ -#!/usr/bin/env nu -echo listening for open commands -loop { - let line = nc -l 127.0.0.1 1994 - try { bash -c $"open ($line)" } -} +#!/bin/sh +while true; do + line="$(nc -l 127.0.0.1 1994 </dev/null | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" + echo "$line" + open "$line" +done diff --git a/.local/bin/kc b/.local/bin/kc index 9e6d212..5f74d14 100755 --- a/.local/bin/kc +++ b/.local/bin/kc @@ -1,2 +1,2 @@ #!/bin/sh -kak -c "$@" +exec kak -c "$@" diff --git a/.local/bin/ks b/.local/bin/ks index 71e4621..bb98146 100755 --- a/.local/bin/ks +++ b/.local/bin/ks @@ -1,2 +1,2 @@ #!/bin/sh -kak -e 'daemonize-session' -s "$@" +exec kak -e 'daemonize-session' -s "$@" diff --git a/.local/bin/pn b/.local/bin/pn new file mode 100755 index 0000000..78163aa --- /dev/null +++ b/.local/bin/pn @@ -0,0 +1,33 @@ +#!/bin/sh +args="$( +printf "%q " \ +"--init" \ +"--entrypoint=/usr/local/bin/oksh" \ +"--env=TERM=xterm-ghostty" \ +"--env=EDITOR=vis" \ +"--volume=$TERMINFO/78/xterm-ghostty:/usr/share/terminfo/x/xterm-ghostty" \ +"--env=_ZO_DATA_DIR=/hostfs/.local/share/zoxide" \ +"--volume=/etc/profiles/per-user/ivi/etc/profile.d:/etc/profiles/per-user/ivi/etc/profile.d" \ +"--env=SHELL=/usr/bin/nu" \ +"--env=DISPLAY" \ +"--env=XDG_RUNTIME_DIR" \ +"--volume=$HOME/.ssh/known_hosts:$HOME/.ssh/known_hosts" \ +"--volume=/run/pcscd/pcscd.comm:/run/pcscd/pcscd.comm" \ +"--hostname=$(hostname)" \ +"--env=STARSHIP_CONFIG=/hostfs/.config/starship.toml" \ +"--env=HOME" \ +"--volume=${HOME}:${HOME}" \ +"--workdir=${PWD:-$HOME}" \ +"--volume=${HOME}/.ssh:/root/.ssh" \ +"--volume=${XDG_RUNTIME_DIR:-/var/run}/docker.sock:/var/run/docker.sock" \ +"--net=host" +)" + +pnsh \ + --pnsh-host-bindfs-disabled \ + --pnsh-docker-extra-args="$args" \ + --with-docker \ + --docker-image=okshnew \ + --docker-tag=latest \ + -- -l -c "$*" + diff --git a/.local/bin/pnsh-nvim b/.local/bin/pnsh-nvim deleted file mode 100755 index 8e6f296..0000000 --- a/.local/bin/pnsh-nvim +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env nu -let desktop_open_pipe = $"($env.HOME)/.cache/desktop-open.pipe" -if not ($desktop_open_pipe | path exists) { - mkfifo $desktop_open_pipe - bash -c 'nohup desktop-open-pipe &' -} - -let args = ( -"--init" + -" --entrypoint=/usr/local/bin/oksh" + -" --env=TERM=xterm-ghostty" + -$" --env=EDITOR=vis" + -$" --volume=($env.TERMINFO)/78/xterm-ghostty:/usr/share/terminfo/x/xterm-ghostty" + -" --env=_ZO_DATA_DIR=/hostfs/.local/share/zoxide" + -" --volume=/etc/profiles/per-user/ivi/etc/profile.d:/etc/profiles/per-user/ivi/etc/profile.d" + -" --env=SHELL=/usr/bin/nu" + -" --env=DISPLAY" + -" --env=XDG_RUNTIME_DIR" + -" --volume=/tmp/.X11-unix:/tmp/.X11-unix" + -$" --volume=($env.HOME)/.ssh/known_hosts:($env.HOME)/.ssh/known_hosts" + -" --volume=/run/pcscd/pcscd.comm:/run/pcscd/pcscd.comm" + -$" --hostname=(hostname)" + -" --env=STARSHIP_CONFIG=/hostfs/.config/starship.toml" + -" --env=HOME" + -$" --volume=($env.HOME):($env.HOME)" + -$" --workdir=($env | default $env.HOME PWD | get PWD)" + -# " --volume=/nix/store:/nix/store" + -$" --volume=/nix-config:/nix-config" + -$" --volume=($env.HOME)/.ssh:/root/.ssh" + -$" --volume=($env | default "/var/run" XDG_RUNTIME_DIR | get XDG_RUNTIME_DIR)/docker.sock:/var/run/docker.sock" + -" --net=host" -) - -( -^pnsh - --pnsh-host-bindfs-disabled - --pnsh-docker-extra-args=$"($args)" - --with-docker - --docker-image=okshnew - --docker-tag=latest -) diff --git a/.local/bin/putdotfiles b/.local/bin/putdotfiles index 5c736ff..9b47729 100755 --- a/.local/bin/putdotfiles +++ b/.local/bin/putdotfiles @@ -1,7 +1,8 @@ #!/bin/sh if [ -d "$HOME/.local/src/dotfiles/.git" ]; then - cp -rfT \ - "$HOME/.local/src/dotfiles" \ + cd "$HOME/.local/src/dotfiles" + ls -A | xargs -I xxx cp -rvf \ + "$HOME/.local/src/dotfiles/xxx" \ "$HOME" else putgitrepo \ diff --git a/.local/bin/pwd-short b/.local/bin/pwd-short new file mode 100755 index 0000000..a4a1500 --- /dev/null +++ b/.local/bin/pwd-short @@ -0,0 +1,25 @@ +#!/bin/sh +printf '%s' $( +IFS=/ +parts="$( +for d in $(pwd); do + [ -z "$d" ] && continue + IFS= + echo "$d" | head -c3 + echo +done +)" +len="$(echo "$parts" | wc -l)" +[ $len -gt 3 ] && { + printf '/' + echo "$parts" | tail -r | tail -n+4 | tail -r | paste -sd'/' - +} + +printf '/' +IFS=/ +for d in $(pwd); do + [ -z "$d" ] && continue + IFS= + echo "$d" +done | tail -n3 | paste -sd'/' - +) diff --git a/.local/bin/vis-clipboard b/.local/bin/vis-clipboard index df28f4b..8d26c61 100755 --- a/.local/bin/vis-clipboard +++ b/.local/bin/vis-clipboard @@ -148,11 +148,17 @@ vc_xclip_paste() { } vc_osc_copy() { - osc copy -d /dev/tty + d="/dev/tty" + [ -n "$kak_client_pid" ] && d="/proc/$kak_client_pid/fd/0" + echo "$kak_client_pid" >> ~/logs + echo osc copy -d "$d" >> ~/logs + osc copy -d "$d" } vc_osc_paste() { - osc paste -d /dev/tty + d="/dev/tty" + [ -n "$kak_client_pid" ] && d="/proc/$kak_client_pid/fd/0" + osc paste -d "$d" } vc_mac_copy() { diff --git a/.local/bin/xdg-open b/.local/bin/xdg-open index 4cd0a92..71f0c39 100755 --- a/.local/bin/xdg-open +++ b/.local/bin/xdg-open @@ -1,5 +1,5 @@ #!/bin/bash case "$(file --mime-type $1 | awk '{print $2}')" in text/*|application/json) exec "$EDITOR" "$@" ;; - *) printf '%q ' "$@" | nc 127.0.0.1 1994 ;; + *) printf '%s ' "$@" | nc 127.0.0.1 1994 ;; esac |
