Terminal screensaver written in C, triggered by tmux lock-after-time (180s idle), bind S, or `donut` alias. Features: - Spinning torus with precomputed trig tables, randomized rotation - Matrix rain overlay — donut luminance colors the rain characters - 64-shade teal foreground palette with gradual dimming over time - Chunky 7x5 clock with shadow, blinking colon, periodic drift - Activity time display below clock (read from heartbeat state file) - Rim lighting and ambient occlusion on donut edges - RLE escape state machine — only emits SGR on shade transitions - Row-skip rendering — empty/leading/trailing regions use cursor jumps - Projection runs at adaptive rate (24fps bright, 6fps dim) - select()-based frame pacing, deep sleep after 2hr (1fps) - Resume detection — flushes stale PTY output after sleep/lock - Mouse click to quit (SGR + X11 protocols, release filtered) - write_all() retries partial writes, SIGPIPE handled gracefully - Alternate screen buffer preserves shell scrollback Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
83 lines
2.9 KiB
Plaintext
83 lines
2.9 KiB
Plaintext
alias bench='ZSH_BENCH=1 exec zsh'
|
|
alias dots='cd $DOTFILES'
|
|
alias j='z'
|
|
alias ji='zi'
|
|
alias reload='source ~/.zshrc'
|
|
alias reload-path='rm -f "${XDG_CACHE_HOME:-$HOME/.cache}/dots/path" && exec zsh'
|
|
alias reload-cache='rm -rf "${XDG_CACHE_HOME:-$HOME/.cache}/dots" ~/.zcompdump* && exec zsh'
|
|
alias zen='curl -s https://api.github.com/zen && echo'
|
|
alias la='ls -la'
|
|
alias vi='vim'
|
|
alias copilot='gh copilot'
|
|
if [[ -z "${CODESPACES:-}" ]]; then
|
|
cs() {
|
|
local codespace="${1:-}"
|
|
if [[ -z "$codespace" ]]; then
|
|
codespace="$(gh cs list --json name -q '.[].name' | fzf)" || return
|
|
fi
|
|
[[ -n "$TMUX" ]] && tmux rename-window "cs:$codespace"
|
|
trap '[[ -n "$TMUX" ]] && tmux set automatic-rename on' EXIT INT TERM
|
|
gh cs ssh -c "$codespace"
|
|
local rc=$?
|
|
trap - EXIT INT TERM
|
|
[[ -n "$TMUX" ]] && tmux set automatic-rename on
|
|
if (( rc == 0 )); then
|
|
local log="${XDG_DATA_HOME:-$HOME/.local/share}/ssh/log"
|
|
mkdir -p "$(dirname "$log")"
|
|
printf '%s cs:%s\n' "$(date +%s)" "$codespace" >> "$log"
|
|
fi
|
|
return $rc
|
|
}
|
|
fi
|
|
alias colby='copilot --allow-all-tools --allow-all-paths'
|
|
alias gs='git s'
|
|
alias gd='git d'
|
|
alias gdc='git dc'
|
|
alias gc='git c'
|
|
alias gl='git ld'
|
|
alias ga='git a'
|
|
alias gr='git r'
|
|
alias gw='git show'
|
|
alias gf='git f'
|
|
alias gp='git p'
|
|
alias donut='tmux lock-session'
|
|
gdm() { local base="${1:-$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@refs/remotes/origin/@@' || echo main)}"; git diff "${base}...HEAD"; }
|
|
|
|
# fzf workflows
|
|
gb() { local b; b="$(git branch --all --sort=-committerdate --format='%(refname:short)' | fzf --preview 'git log --oneline --color -20 {}')" && git checkout "${b#origin/}"; }
|
|
glo() { git log --oneline --color --decorate | fzf --ansi --preview 'git show --color --stat {1}' --bind 'enter:become(echo {1})'; }
|
|
f() { local f; f="$(fzf --preview 'head -100 {}')" && ${EDITOR:-vim} "$f"; }
|
|
|
|
if [[ -z "${CODESPACES:-}" ]]; then
|
|
ssh() {
|
|
local ssh_target="${@: -1}"
|
|
[[ -n "$TMUX" ]] && tmux rename-window "ssh:$ssh_target"
|
|
trap '[[ -n "$TMUX" ]] && tmux set automatic-rename on' EXIT INT TERM
|
|
command ssh "$@"
|
|
local rc=$?
|
|
trap - EXIT INT TERM
|
|
[[ -n "$TMUX" ]] && tmux set automatic-rename on
|
|
|
|
if (( rc == 0 )); then
|
|
local host="$ssh_target"
|
|
local ssh_log="${XDG_DATA_HOME:-$HOME/.local/share}/ssh/log"
|
|
mkdir -p "$(dirname "$ssh_log")"
|
|
|
|
if [[ "$ssh_target" == *@* ]]; then
|
|
local user="${ssh_target%%@*}"
|
|
host="${ssh_target#*@}"
|
|
local config_file="$HOME/.ssh/config.d/auto"
|
|
mkdir -p "$HOME/.ssh/config.d"
|
|
if ! grep -q "^Host $host$" "$config_file" 2>/dev/null; then
|
|
printf '\nHost %s\n HostName %s\n User %s\n' "$host" "$host" "$user" >> "$config_file"
|
|
fi
|
|
fi
|
|
|
|
printf '%s %s\n' "$(date +%s)" "$host" >> "$ssh_log"
|
|
fi
|
|
return $rc
|
|
}
|
|
s() { local h; h="$(_dots_ssh_hosts | fzf)" && ssh "$h"; }
|
|
fi
|
|
|