diff --git a/README.md b/README.md index 488a4ff..474e546 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,8 @@ stow agents bash dolphin ghostty git kde-themes konsole mangohud nvim python vim | Script | Purpose | |--------|---------| -| `arch/update.sh` | Update uv, pacman, and flatpak | +| `arch/update.sh` | Update uv, pacman, flatpak, and VS Code (`/opt/vscode`) | +| `arch/upgrade_vscode.sh` | Upgrade `/opt/vscode` tarball install when a newer release is available | | `arch/fix_vscode.sh` | Create VS Code desktop entry and icon symlinks for `/opt/vscode` | | `dolphin.sh` | Copy live Dolphin config into the repo and `stow dolphin` | | `vscode-server/install-vscode-extensions.sh` | Install extensions from `extensions.txt` (local, remote, or both) | diff --git a/arch/update.sh b/arch/update.sh new file mode 100755 index 0000000..8cb229a --- /dev/null +++ b/arch/update.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +step() { + echo + echo "==> $*" +} + +step "uv" +uv self update + +step "pacman" +sudo pacman -Syu + +step "flatpak" +sudo flatpak update -y + +step "vscode" +"${SCRIPT_DIR}/upgrade_vscode.sh" \ No newline at end of file diff --git a/arch/upgrade_vscode.sh b/arch/upgrade_vscode.sh new file mode 100755 index 0000000..e705a84 --- /dev/null +++ b/arch/upgrade_vscode.sh @@ -0,0 +1,74 @@ +#!/usr/bin/env bash +set -euo pipefail + +VSCODE_DIR=/opt/vscode +PRODUCT_JSON="${VSCODE_DIR}/resources/app/product.json" +RELEASES_API='https://update.code.visualstudio.com/api/releases/stable' + +installed_version() { + if [[ ! -f "${PRODUCT_JSON}" ]]; then + return 0 + fi + python3 -c "import json; print(json.load(open('${PRODUCT_JSON}'))['version'])" +} + +latest_version() { + curl -fsSL "${RELEASES_API}" | python3 -c 'import json, sys; print(json.load(sys.stdin)[0])' +} + +vscode_arch() { + case "$(uname -m)" in + x86_64) echo linux-x64 ;; + aarch64) echo linux-arm64 ;; + *) + echo "unsupported architecture: $(uname -m)" >&2 + exit 1 + ;; + esac +} + +needs_upgrade() { + local installed="$1" latest="$2" + + [[ -z "${installed}" ]] && return 0 + [[ "${installed}" == "${latest}" ]] && return 1 + [[ "$(printf '%s\n' "${installed}" "${latest}" | sort -V | head -n1)" == "${installed}" ]] +} + +installed="$(installed_version || true)" +latest="$(latest_version)" + +if ! needs_upgrade "${installed}" "${latest}"; then + if [[ -z "${installed}" ]]; then + echo "VS Code is not installed at ${VSCODE_DIR}" + else + echo "VS Code ${installed} is up to date" + fi + exit 0 +fi + +echo "Upgrading VS Code: ${installed:-not installed} -> ${latest}" + +arch="$(vscode_arch)" +tmp="$(mktemp -d)" +trap 'rm -rf "${tmp}"' EXIT + +archive="${tmp}/vscode.tar.gz" +curl -fsSL "https://update.code.visualstudio.com/${latest}/${arch}/stable" -o "${archive}" +tar -xzf "${archive}" -C "${tmp}" + +extract_dir="$(find "${tmp}" -maxdepth 1 -type d -name 'VSCode-linux-*' -print -quit)" +if [[ -z "${extract_dir}" ]]; then + echo "failed to find extracted VS Code directory" >&2 + exit 1 +fi + +mkdir -p "$(dirname "${VSCODE_DIR}")" +if [[ -d "${VSCODE_DIR}" ]]; then + rm -rf "${VSCODE_DIR}.old" + mv "${VSCODE_DIR}" "${VSCODE_DIR}.old" +fi +mv "${extract_dir}" "${VSCODE_DIR}" +rm -rf "${VSCODE_DIR}.old" + +echo "VS Code upgraded to ${latest}" \ No newline at end of file diff --git a/git/.gitconfig b/git/.gitconfig index d145b69..11bb15e 100644 --- a/git/.gitconfig +++ b/git/.gitconfig @@ -21,6 +21,7 @@ [core] excludesfile = /home/anoto/.gitignore_global editor = code --wait + symlinks = true # pager = code --wait - [diff] tool = vscode diff --git a/konsole/.local/share/konsole/zsh.profile b/konsole/.local/share/konsole/zsh.profile new file mode 100644 index 0000000..8fac9c2 --- /dev/null +++ b/konsole/.local/share/konsole/zsh.profile @@ -0,0 +1,13 @@ +[Appearance] +ColorScheme=catppuccin-mocha + +[General] +Command=/usr/bin/zsh +Icon=utilities-terminal-symbolic +Name=zsh +Parent=FALLBACK/ +StartInCurrentSessionDir=false +TerminalColumns=128 + +[Keyboard] +KeyBindings=default diff --git a/vscode-server/.vscode-server/data/Machine/settings.json b/vscode-server/.vscode-server/data/Machine/settings.json index 5b8588b..ea80133 100644 --- a/vscode-server/.vscode-server/data/Machine/settings.json +++ b/vscode-server/.vscode-server/data/Machine/settings.json @@ -94,5 +94,5 @@ "__pycache__", ".grok" ], - "chat.titleBar.signIn.enabled": false, + "chat.titleBar.signIn.enabled": false } \ No newline at end of file diff --git a/zsh/.zshrc b/zsh/.zshrc index dde0e48..8326be4 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -32,5 +32,8 @@ fpath=("$HOME/.grok/completions/zsh" $fpath) # If not running interactively, don't do anything [[ -o interactive ]] || return +# Delete key sends ESC[3~; without this binding zsh inserts "~" literally +[[ -n ${terminfo[kdch1]} ]] && bindkey "${terminfo[kdch1]}" delete-char + autoload -Uz compinit compinit \ No newline at end of file diff --git a/zsh/.zshrc.d/git.zsh b/zsh/.zshrc.d/git.zsh index 8173a6e..bc31052 100644 --- a/zsh/.zshrc.d/git.zsh +++ b/zsh/.zshrc.d/git.zsh @@ -11,4 +11,5 @@ zstyle ':vcs_info:git:*' stagedstr ' +' zstyle ':vcs_info:git:*' unstagedstr ' *' setopt prompt_subst -PROMPT='%B%F{38;5;46m}%n@%m%b%f %F{38;5;51m}%~%f%F{90m}${vcs_info_msg_0_}%f $ ' \ No newline at end of file +# Bright green user@host (matches bash git.bash) +PROMPT='%B%F{46}%n@%m%b%f %F{51}%~%f%F{90}${vcs_info_msg_0_}%f $ ' \ No newline at end of file