From 955bce98fc4d1f14c51dad59fd5dbf446d955e80 Mon Sep 17 00:00:00 2001 From: yage Date: Thu, 3 Sep 2026 21:03:02 -0600 Subject: [PATCH] updated configs --- config/bin/godot | 56 ++++++ config/bin/godot-lsp-proxy.py | 184 ++++++++++++++++++++ config/bin/i3-utils | 28 +-- config/colorschemes/active/default.yaml | 3 +- config/i3.conf | 2 +- config/i3.config.yaml | 3 +- config/local/altaria/bin/beeg-game | 3 +- config/local/altaria/bin/default | 6 +- config/local/altaria/bin/emergency-screen | 13 ++ config/local/altaria/bin/smol-game | 7 +- config/local/altaria/bin/xorg.zsh | 106 ++++++++--- config/scwrypts/config.zsh | 1 + config/user/code-activator-zsh/settings.zsh | Bin 2077 -> 2191 bytes config/user/compton/compton.conf | 2 - config/user/flameshot/flameshot.ini | 9 +- config/user/systemd/user/i3-session.target | 5 + config/user/xdg-desktop-portal/portals.conf | 2 + config/xinitrc.i3wm | 11 +- setup/os-dependencies/arch.txt | 1 + vim/rc.d/00.plugin-vundle.vim | 1 + vim/rc.d/01.plugin-youcompleteme.vim | 3 + vim/rc.d/12.plugin-vim-godot.vim | 53 ++++++ vim/rc.d/41.file-formatting.vim | 3 +- zsh/plugins/fzf-tab | 2 +- zsh/rc.d/30.utils-dd.zsh | 47 +++++ 25 files changed, 492 insertions(+), 59 deletions(-) create mode 100755 config/bin/godot create mode 100755 config/bin/godot-lsp-proxy.py create mode 100755 config/local/altaria/bin/emergency-screen create mode 100644 config/user/systemd/user/i3-session.target create mode 100644 config/user/xdg-desktop-portal/portals.conf create mode 100644 vim/rc.d/12.plugin-vim-godot.vim create mode 100644 zsh/rc.d/30.utils-dd.zsh diff --git a/config/bin/godot b/config/bin/godot new file mode 100755 index 0000000..9b32b4d --- /dev/null +++ b/config/bin/godot @@ -0,0 +1,56 @@ +#!/usr/bin/env zsh +# +# getting Godot + External vim working requires a little work... +# +# so this script shadows godot, and handles the spin-up of everything needed! +# +# After starting `godot`, connect to the `godot` tmux session (and DON'T close the vim over there) +# + +GODOT_EXECUTABLE=/usr/bin/godot +TMUX_SESSION=godot + +echo.helper() { + notify-send 'godot' "${@:2}" + echo "${@}\\033[0m" >&2 +} + +echo.info() { echo.helper "\\033[1;32m" "INFO : ${@}" >&2; } +echo.error() { echo.helper "\\033[1;31m" "ERROR : ${@}" >&2; return 1 } +echo.warning() { echo.helper "\\033[1;33m" "WARNING : ${@}" >&2; } + +tmux.has-session () { + tmux has-session -t "${TMUX_SESSION}" &>/dev/null +} + +tmux.has-session && { + echo.error "tmux session '${TMUX_SESSION}' already exists; refusing to start godot" + exit 1 +} + +tmux new-session -d -s "${TMUX_SESSION}" -n vim \ + 'sleep 3; while tmux list-windows -t godot -F "#{window_name}" | grep -q lsp-proxy; do vim; echo "vim closed, restarting..."; sleep 1; done' + +tmux new-window -t "${TMUX_SESSION}" -n lsp-proxy \ + 'while true; do ~/.wryn/config/bin/godot-lsp-proxy.py; echo "proxy died, restarting in 2s..."; sleep 2; done' + +tmux select-window -t "${TMUX_SESSION}:0" + +echo.info "godot editor session running on tmux '${TMUX_SESSION}'; connect with tmux.godot" + +"${GODOT_EXECUTABLE}" "$@" +GODOT_STATUS=$? + +# godot relaunches itself when opening a project; so we wait for all godot instances to fully exit +sleep 3 +while pgrep -x godot &>/dev/null; do sleep 3; done + +tmux kill-window -t "${TMUX_SESSION}:lsp-proxy" +tmux send-keys -t "${TMUX_SESSION}" Escape ':qa' Enter +sleep 3 + +tmux.has-session && { + echo.warning "tmux session '${TMUX_SESSION}' still exists; please connect, save, and close for next connection" +} + +exit ${GODOT_STATUS} diff --git a/config/bin/godot-lsp-proxy.py b/config/bin/godot-lsp-proxy.py new file mode 100755 index 0000000..c590e09 --- /dev/null +++ b/config/bin/godot-lsp-proxy.py @@ -0,0 +1,184 @@ +#!/usr/bin/env python3 +# +# godot-lsp-proxy +# +# TCP proxy that sits between vim (YCM) and Godot's built-in GDScript +# language server, rewriting malformed file URIs on the fly. +# +# THE PROBLEM +# +# YCM (ycmd) sends LSP document URIs without any slash in protocol: +# +# file:/home/user/project/script.gd +# ^^^^^ +# prefix 'file:' +# +# The LSP spec (RFC 3986) requires two slashes after protocol: +# +# file:///home/user/project/script.gd +# ^^^^^^^ +# prefix 'file://' +# +# Most language servers are lenient about this, but Godot 4.5+ is +# strict and rejects single-slash URIs with: +# +# ERROR: LSP: The language server only supports the file protocol +# +# This causes the LSP handshake to fail and Godot drops the +# connection. YCM then reports "godotCompleter not running" and you +# get zero autocompletion, jump-to-definition, or diagnostics. +# +# As of 2025-04, there is no config on either side to fix this: +# - YCM has no setting to control URI format +# - Godot has no setting to relax URI validation +# +# THE FIX +# +# This proxy listens on a local port (default 6015), and for every +# LSP message FROM the editor TO Godot, rewrites: +# +# "file:/home/... -> "file:///home/... +# +# Messages are parsed as proper LSP (Content-Length header + JSON +# body), so the Content-Length is recalculated after rewriting to +# keep the protocol valid. +# +# Messages from Godot back to the editor are passed through +# unmodified (Godot sends correct triple-slash URIs). +# +# USAGE +# +# godot-lsp-proxy [listen_port] [godot_port] +# +# defaults: listen on 6015, forward to 6005 +# +# Point YCM at the proxy port (6015) instead of Godot's port (6005) +# in your vim config: +# +# let g:ycm_language_server += [ +# \ { 'name': 'godot', +# \ 'filetypes': ['gdscript'], +# \ 'project_root_files': ['project.godot'], +# \ 'port': 6015 } +# \ ] +# +# REMOVAL +# +# When YCM or Godot fixes the URI handling on their end, delete +# this script and point YCM back at port 6005 directly. +# +import socket +import threading +import re +import sys + +LISTEN_PORT = int(sys.argv[1]) if len(sys.argv) > 1 else 6015 +GODOT_PORT = int(sys.argv[2]) if len(sys.argv) > 2 else 6005 + + +def fix_uri(data: bytes) -> bytes: + return re.sub(rb'"file:/([^/])', rb'"file:///\1', data) + + +def read_message(sock): + header = b'' + while b'\r\n\r\n' not in header: + chunk = sock.recv(1) + if not chunk: + return None + header += chunk + + match = re.search(rb'Content-Length: (\d+)', header) + if not match: + return None + length = int(match.group(1)) + + body = b'' + while len(body) < length: + chunk = sock.recv(length - len(body)) + if not chunk: + return None + body += chunk + + return body + + +def send_message(sock, body: bytes): + header = f'Content-Length: {len(body)}\r\n\r\n'.encode() + sock.sendall(header + body) + + +def relay(src, dst, label='', transform=None): + try: + while True: + body = read_message(src) + if body is None: + break + if transform: + body = transform(body) + send_message(dst, body) + except Exception as e: + print(f' [{label}] connection closed ({e})') + finally: + try: + src.close() + except Exception: + pass + try: + dst.close() + except Exception: + pass + print(f' [{label}] relay stopped') + + +def print_banner(): + print() + print(' godot-lsp-proxy') + print(' ===============') + print() + print(' Workaround for YCM sending malformed file URIs to Godot.') + print() + print(f' vim (YCM) -> :{LISTEN_PORT} [rewrite file: -> file://] -> :{GODOT_PORT} (Godot LSP)') + print(f' vim (YCM) <- :{LISTEN_PORT} [passthrough] <- :{GODOT_PORT} (Godot LSP)') + print() + print(' Waiting for YCM to connect...') + print() + + +def main(): + server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + server.bind(('127.0.0.1', LISTEN_PORT)) + server.listen(1) + + print_banner() + + while True: + client, addr = server.accept() + print(f' YCM connected from {addr[0]}:{addr[1]}') + + try: + godot = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + godot.connect(('127.0.0.1', GODOT_PORT)) + print(f' Connected to Godot LSP on :{GODOT_PORT}') + print(' Proxying LSP messages (ctrl-c to stop)') + print() + except ConnectionRefusedError: + print(f' ERROR: Godot LSP not available on :{GODOT_PORT}') + print(f' Is Godot running with the project open?') + print() + client.close() + continue + + threading.Thread( + target=relay, args=(client, godot, 'ycm->godot', fix_uri), + daemon=True, + ).start() + threading.Thread( + target=relay, args=(godot, client, 'godot->ycm'), + daemon=True, + ).start() + + +if __name__ == '__main__': + main() diff --git a/config/bin/i3-utils b/config/bin/i3-utils index 3d0dc15..64ce6b1 100755 --- a/config/bin/i3-utils +++ b/config/bin/i3-utils @@ -44,24 +44,30 @@ case $1 in local PROGRAM local ARGS=() case $2 in - messages ) PROGRAM=slack ARGS+=(-c Slack --has-statusbar-icon) ;; - voice ) PROGRAM=google-voice-desktop ;; - ytmusic ) PROGRAM=youtube-music-desktop-app ARGS+=(-c '"YouTube Music Desktop App"' --has-statusbar-icon) ;; + ( messages ) PROGRAM=slack ARGS+=(-c slack --has-statusbar-icon) ;; + ( voice ) PROGRAM=google-voice-desktop ;; + ( ytmusic ) PROGRAM=youtube-music-desktop-app ARGS+=(-c '"YouTube Music Desktop App"' --has-statusbar-icon) ;; + ( signal ) PROGRAM=signal ;; - 1pass ) PROGRAM=1password ARGS+=(-c 1Password) ;; - discord ) PROGRAM=discord ARGS+=(--has-statusbar-icon) ;; - obs ) PROGRAM=obs ARGS+=(-c '^obs' -n -l --has-statusbar-icon) ;; - pavuctrl ) PROGRAM=pavucontrol ARGS+=(-s 0.5 -c '^Pavucontrol') ;; - scrcpy ) PROGRAM=scrcpy ARGS+=(-n -l) ;; - spotify ) PROGRAM=youtube-music-desktop-app ARGS+=(-c '"YouTube Music Desktop App"' --has-statusbar-icon) ;; + ( 1pass ) PROGRAM=1password ARGS+=(-c 1Password) ;; + ( discord ) PROGRAM=fluxer ARGS+=(-c Fluxer) ;; + ( obs ) PROGRAM=obs ARGS+=(-c '^obs' -n -l --has-statusbar-icon) ;; + ( pavuctrl ) PROGRAM=pavucontrol ARGS+=(-s 0.5 -c '^Pavucontrol') ;; + ( scrcpy ) PROGRAM=scrcpy ARGS+=(-n -l) ;; + ( spotify ) PROGRAM=youtube-music-desktop-app ARGS+=(-c '"YouTube Music Desktop App"' --has-statusbar-icon) ;; - * ) PROGRAM=$2 ;; + ( * ) PROGRAM=$2 ;; esac scwrypts i3 launch or show -- $PROGRAM ${ARGS[@]} ;; ( screenshot ) command -v flameshot || notify-send "I3 UTILS" "screenshot application 'flameshot' not available" - flameshot gui + + # v13 and below + #flameshot gui + + # v14 complicated af + flameshot screen --edit --number "$(xdotool getmouselocation | sed 's/^.*screen:\([0-9]\+\) .*$/\1/')" ;; esac diff --git a/config/colorschemes/active/default.yaml b/config/colorschemes/active/default.yaml index d36e768..ce6e819 100644 --- a/config/colorschemes/active/default.yaml +++ b/config/colorschemes/active/default.yaml @@ -1,4 +1,5 @@ ---- # yamllint disable rule:colons +--- +# yamllint disable rule:colons ansi: red: regular: .material.base.error diff --git a/config/i3.conf b/config/i3.conf index 3adea3e..a310c97 100644 --- a/config/i3.conf +++ b/config/i3.conf @@ -34,7 +34,7 @@ bindsym $mod+Shift+m $UTILS launch messages bindsym $mod+Shift+d $UTILS launch discord bindsym $mod+c $UTILS launch voice bindsym $mod+m $UTILS launch ytmusic -bindsym $mod+Shift+s $UTILS launch spotify +bindsym $mod+Shift+s $UTILS launch signal bindsym $mod+a $UTILS launch pavuctrl bindsym $mod+Shift+p $UTILS launch scrcpy bindsym $mod+Shift+o $UTILS launch obs diff --git a/config/i3.config.yaml b/config/i3.config.yaml index a927b84..ad56049 100644 --- a/config/i3.config.yaml +++ b/config/i3.config.yaml @@ -1,4 +1,5 @@ ---- # used by scwrypts i3 generate config (override at ~/.config/i3/local.yaml) +--- +# used by scwrypts i3 generate config (override at ~/.config/i3/local.yaml) font: size: 14 family: >- diff --git a/config/local/altaria/bin/beeg-game b/config/local/altaria/bin/beeg-game index 4ad8b1f..36c8f37 100755 --- a/config/local/altaria/bin/beeg-game +++ b/config/local/altaria/bin/beeg-game @@ -2,8 +2,9 @@ [ $1 ] && RESOLUTION=$1 || RESOLUTION=4k source ${0:a:h}/xorg.zsh ${RESOLUTION} ${@:2} -#DISABLE+=(splitter) +DISABLE+=(splitter) DISABLE+=(desk) +#DISABLE+=(zapdos) XRANDR_OFF ${DISABLE[@]} diff --git a/config/local/altaria/bin/default b/config/local/altaria/bin/default index 8c46c34..5c6dc7b 100755 --- a/config/local/altaria/bin/default +++ b/config/local/altaria/bin/default @@ -1,6 +1,6 @@ #!/bin/zsh -[ $1 ] && RESOLUTION=$1 || RESOLUTION=2k -source ${0:a:h}/xorg.zsh ${RESOLUTION} ${@:2} +[[ "${1}" ]] && RESOLUTION="${1}" || RESOLUTION=4k +source "${0:a:h}/xorg.zsh" "${RESOLUTION}" "${@:2}" case $MONITOR_CONFIGURATION in ( home ) @@ -12,7 +12,7 @@ case $MONITOR_CONFIGURATION in --sound-effect login \ --background ${I3_DEFAULT_THEME_BACKGROUND} \ ${XRANDR_ARGS__desk[@]} --pos 0x0 --primary \ - ${XRANDR_ARGS__splitter[@]} --pos 0x0 \ + ${XRANDR_ARGS__zapdos[@]} --pos 0x0 \ ;; ( unknown ) diff --git a/config/local/altaria/bin/emergency-screen b/config/local/altaria/bin/emergency-screen new file mode 100755 index 0000000..a2efa4b --- /dev/null +++ b/config/local/altaria/bin/emergency-screen @@ -0,0 +1,13 @@ +#!/bin/zsh +[ $1 ] && RESOLUTION=$1 || RESOLUTION=4k +source ${0:a:h}/xorg.zsh ${RESOLUTION} ${@:2} + +[[ "${XRANDR_OUTPUT__server_rack}" ]] || { + echo "sorry; can't find server rack screen" + exit 1 +} + +case "$(xrandr | grep "^${XRANDR_OUTPUT__server_rack} connected [0-9]")" in + ( *connected* ) xrandr --output "${XRANDR_OUTPUT__server_rack}" --off ;; + ( * ) xrandr --output "${XRANDR_OUTPUT__server_rack}" --auto ;; +esac diff --git a/config/local/altaria/bin/smol-game b/config/local/altaria/bin/smol-game index 7aa1ab4..f97103f 100755 --- a/config/local/altaria/bin/smol-game +++ b/config/local/altaria/bin/smol-game @@ -2,13 +2,8 @@ [ $1 ] && RESOLUTION=$1 || RESOLUTION=4k source ${0:a:h}/xorg.zsh ${RESOLUTION} ${@:2} -DISABLE+=(splitter) -#DISABLE+=(desk) - -XRANDR_OFF ${DISABLE[@]} - XRANDR_SET \ - --compositing enable \ + --compositing disable \ --screen-blank disable \ --sound-effect gamedock \ ${XRANDR_ARGS__desk[@]} --pos 0x0 --primary \ diff --git a/config/local/altaria/bin/xorg.zsh b/config/local/altaria/bin/xorg.zsh index b1a3c23..5293351 100644 --- a/config/local/altaria/bin/xorg.zsh +++ b/config/local/altaria/bin/xorg.zsh @@ -1,8 +1,36 @@ #!/bin/zsh ##################################################################### -XRANDR_OUTPUT__splitter='HDMI-0' -XRANDR_OUTPUT__desk='DP-4' +graphics_cards_detected="$(xrandr | sed -n 's/\(DP-[0-9]-\).*$/\1/p' | sort -u | wc -l)" + +case "${graphics_cards_detected}" in + ( 1 ) # sometimes the graphics card on the motherboard is detected and becomes primary + XRANDR_OUTPUT__splitter='HDMI-1-0' + XRANDR_OUTPUT__desk='unknown -> probably wont come up but future me needs to put this in manually' + XRANDR_OUTPUT__house='DP-1-4' + XRANDR_OUTPUT__zapdos='DP-1-0' + XRANDR_OUTPUT__server_rack='HDMI2' + ;; + + ( 0 | * ) # default: just the dedicated graphics card detected + XRANDR_OUTPUT__splitter='HDMI-0' + XRANDR_OUTPUT__desk='DP-2' + XRANDR_OUTPUT__zapdos='DP-0' + XRANDR_OUTPUT__server_rack='DP-4' + ;; +esac + +XRANDR_OUTPUTS=() +for XRANDR_OUTPUT in \ + splitter \ + desk \ + zapdos \ + server_rack \ + ; +do + XRANDR_OUTPUT_var=XRANDR_OUTPUT__${XRANDR_OUTPUT} + XRANDR_OUTPUTS+=("${(P)XRANDR_OUTPUT_var}") +done I3_DEFAULT_THEME_BACKGROUND=$(scwrypts -n get theme).png @@ -12,7 +40,7 @@ MONITOR_CONFIGURATION=unknown && xrandr --query | grep -q "^${XRANDR_OUTPUT__splitter} connected" \ && MONITOR_CONFIGURATION=home \ ; - #&& xrandr --query | grep -q "^${XRANDR_OUTPUT__desk} connected" \ + #&& xrandr --query | grep -q "^${XRANDR_OUTPUT__house} connected" \ ##################################################################### @@ -24,17 +52,20 @@ case $1 in EXTRA_ARGS__splitter=() EXTRA_ARGS__desk=() + EXTRA_ARGS__house=() + EXTRA_ARGS__zapdos=() I3_BACKGROUND=link-vs-gdizz.jpg ;; - ( 1440 | 1440p | 2k ) + ( 1440 | 1440p | 2k | guild-wars-2 ) XRANDR_MODE=(--mode 2560x1440) XRANDR_OFFSET_X=2560 XRANDR_OFFSET_Y=1440 - EXTRA_ARGS__splitter=(--rate 120.00) - EXTRA_ARGS__desk=(--rate 120.00) + EXTRA_ARGS__splitter=() + EXTRA_ARGS__desk=() + EXTRA_ARGS__zapdos=(--rate 120.00) I3_BACKGROUND=roy-art.jpg ;; @@ -44,12 +75,22 @@ case $1 in XRANDR_OFFSET_X=3840 XRANDR_OFFSET_Y=2160 - EXTRA_ARGS__splitter=(--rate 120.00) - EXTRA_ARGS__desk=(--rate 120.00) + EXTRA_ARGS__splitter=(--rate 119.88) + EXTRA_ARGS__desk=(--rate 119.88) # make it match + EXTRA_ARGS__house=() + #EXTRA_ARGS__zapdos=(--rate 143.99) # I thought this was a bad cable... apparently this is a MANUFACTURERS error -> they messed up the OS software and I'm big mad at LG I3_BACKGROUND=${I3_DEFAULT_THEME_BACKGROUND[@]} ;; + ( max ) # use only for desk gaming + XRANDR_MODE=(--mode 3840x2160) + XRANDR_OFFSET_X=3840 + XRANDR_OFFSET_Y=2160 + + EXTRA_ARGS__desk=(--rate 239.99) + ;; + ( * ) echo "error : unknown resolution '$1'" exit 1 @@ -58,7 +99,9 @@ esac XRANDR_ARGS__splitter=(--output ${XRANDR_OUTPUT__splitter[@]} ${XRANDR_MODE[@]} ${EXTRA_ARGS__splitter[@]}) -XRANDR_ARGS__desk=(--output ${XRANDR_OUTPUT__desk[@]} ${XRANDR_MODE[@]} ${EXTRA_ARGS__desk[@]}) +XRANDR_ARGS__desk=(--output ${XRANDR_OUTPUT__desk[@]} ${XRANDR_MODE[@]} ${EXTRA_ARGS__desk}) +XRANDR_ARGS__house=(--output ${XRANDR_OUTPUT__house[@]} ${XRANDR_MODE[@]} ${EXTRA_ARGS__house[@]}) +XRANDR_ARGS__zapdos=(--output ${XRANDR_OUTPUT__zapdos[@]} ${XRANDR_MODE[@]} ${EXTRA_ARGS__zapdos[@]}) ########################################## @@ -67,17 +110,6 @@ export DISPLAY=:0 ############################################################################### -XRANDR_OFF() { - local MONITOR ARGS=() - for MONITOR in $@ - do - MONITOR="XRANDR_OUTPUT__${MONITOR}" - ARGS+=(--output ${(P)MONITOR} --off) - done - - xrandr ${ARGS[@]} -} - XRANDR_SET() { local ERRORS=0 @@ -87,6 +119,8 @@ XRANDR_SET() { local SOUND_EFFECT=login local XRANDR_ARGS=() + local enable_server_rack=false + while [[ $# -gt 0 ]] do case $1 in @@ -95,22 +129,44 @@ XRANDR_SET() { ( --background ) BACKGROUND="$2" ; shift 1 ;; ( --sound-effect ) SOUND_EFFECT="$2" ; shift 1 ;; + ( --server-rack ) enabled_server_rack=true ;; + ( * ) XRANDR_ARGS+=($1) ; esac shift 1 done - case ${COMPOSITING} in + local xrandr_output xrandr_output_should_turn_off + for xrandr_output in "${XRANDR_OUTPUTS[@]}" + do + [[ "${XRANDR_ARGS[(re)${xrandr_output}]}" == "${xrandr_output}" ]] \ + && xrandr_output_should_turn_off=false \ + || xrandr_output_should_turn_off=true \ + ; + + [[ "${xrandr_output_should_turn_off}" == true ]] \ + && XRANDR_ARGS+=(--output "${xrandr_output}" --off) + done + + if [[ "${XRANDR_OUTPUT__server_rack}" ]] + then + case "${enable_server_rack}" in + ( true ) XRANDR_ARGS+=(--output "${XRANDR_OUTPUT__server_rack}" --auto) ;; + ( false ) XRANDR_ARGS+=(--output "${XRANDR_OUTPUT__server_rack}" --off) ;; + esac + fi + + case "${COMPOSITING}" in ( enable ) (pkill compton; sleep 1; compton;) & ;; ( disable ) pkill compton ;; - * ) + ( * ) echo "ERROR : invalid setting '${COMPOSITING}' for compositing" >&2 return 1 esac - case ${SCREEN_BLANK} in - enable | disable ) ;; - * ) + case "${SCREEN_BLANK}" in + ( enable | disable ) ;; + ( * ) echo "ERROR : invalid setting '${SCREEN_BLANK}' for screen blank" >&2 return 1 esac diff --git a/config/scwrypts/config.zsh b/config/scwrypts/config.zsh index 5eeb321..ec464bc 100644 --- a/config/scwrypts/config.zsh +++ b/config/scwrypts/config.zsh @@ -12,6 +12,7 @@ SCWRYPTS_GENERATOR__SHOW_HELP=false [ ${DOTWRYN} ] || source "${HOME}/.zshrc" SCWRYPTS_GROUP_DIRS+=( "${DOTWRYN}/scwrypts" + "${XDG_DATA_HOME:-${HOME}/.local/share}/project-source-code/gizmos" "${XDG_DATA_HOME:-${HOME}/.local/share}/project-source-code/yage/home" "${XDG_DATA_HOME:-${HOME}/.local/share}/project-source-code/yage/ttf-pokemoji" ) diff --git a/config/user/code-activator-zsh/settings.zsh b/config/user/code-activator-zsh/settings.zsh index 0026c04057eea4a2a25de5baf4b0504dc331f0d4..1ac471240447ef4a3130a51e63564eedd03ec789 100644 GIT binary patch delta 140 zcmbO$&@Z^5h`FAN)7{_2KP2ACG1xWU#WToONu@f%#Xa7|F~l+6!{67{N>`;CMAz!; z6=x(CrRwM8Cnx6A>Zj+Y/dev/null || return 0 + +utils.dd() { + local ARGS=() + + # "byte size" dd default is 512-bytes, but 4M is modern sweet spot + local bs=4M + + # show the progress bar (I can never remember to include this) + local status=progress + + # By default, dd goes through kernel write cache which means dd could + # report "Done" but the kernel is still flushing data to the USB in + # the background. Disconnecting the USB drive at that point will + # corrupt the image + # + # synchronous mosde is slower, but forces each write to hit the + # physical device before dd moves on to the next block + # + # tl;dr "synchronous" mode = Done means Done + local oflag=sync + + local _S + while [[ ${#} -gt 0 ]] + do + _S=1 + case ${1} in + ( bs=* ) bs='' ; ARGS+=(${1}) ;; + ( status=* ) status='' ; ARGS+=(${1}) ;; + ( oflag=* ) oflag='' ; ARGS+=(${1}) ;; + ( * ) ARGS+=(${1}) ;; + esac + + shift ${_S} || { + echo "ERROR missing argument for '${1}'" + return 1 + } + done + + local my_default + for my_default in bs status oflag + do + [ "${(P)my_default}" ] && ARGS+=("${my_default}=${(P)my_default}") + done + + dd ${ARGS[@]} +}