Compare commits

...

3 Commits

Author SHA1 Message Date
7e925b2c31 feat: manage tv as external monitor 2025-09-27 15:27:20 +10:00
ead675c788 chore: update pass repo 2025-09-27 15:27:04 +10:00
ff3f9e4604 feat: add script to manage worktrees 2025-09-27 15:26:45 +10:00
3 changed files with 55 additions and 1 deletions

@ -1 +1 @@
Subproject commit 140aca8996acf7e16da374be2b6b22fc87b3b8e0
Subproject commit c2d6545132b7758551669ecdb32760490fffe0d2

View File

@ -88,3 +88,55 @@ export RESTIC_PASSWORD_COMMAND="pass show personal/restic/metabox"
# pdftoppm -jpeg -r 300 input_document.pdf output_image
# jpegoptim --size=100k output_image*.jpg
# img2pdf $(ls -v output_image*.jpg) -o output_document.pdf
# Create a git worktree for the current repo.
# Usage: newtree <branch-name> [<from-ref>]
# - If <from-ref> is omitted, defaults to HEAD.
# - Worktree path: $HOME/src/worktrees/<repo_name>/<branch_name_sanitised>
# (slashes and dashes in the *path component only* are replaced with underscores)
newtree() {
local branch from_ref repo_root repo_name sanitized dest parent
branch="$1"
from_ref="${2:-HEAD}"
if [[ -z "$branch" ]]; then
echo "Usage: newtree <branch-name> [<from-ref>]" >&2
return 2
fi
# Ensure we're inside a git repo
if ! repo_root="$(git rev-parse --show-toplevel 2>/dev/null)"; then
echo "Error: not inside a git repository." >&2
return 1
fi
repo_name="$(basename "$repo_root")"
# Sanitize the branch *for the path only* (keep original branch name for git)
sanitized="${branch//[\/-]/_}"
dest="$HOME/src/worktrees/$repo_name/$sanitized"
parent="$(dirname "$dest")"
# Create parent dir; git will create the final leaf
mkdir -p "$parent" || {
echo "Error: unable to create directory: $parent" >&2
return 1
}
# Optional: prune stale worktrees to avoid false conflicts
git -C "$repo_root" worktree prune >/dev/null 2>&1
# Does the branch already exist?
if git -C "$repo_root" rev-parse --verify --quiet "refs/heads/$branch" >/dev/null; then
echo "Branch '$branch' exists; adding worktree at: $dest"
# --force in case the branch is already checked out elsewhere
git -C "$repo_root" worktree add --force "$dest" "$branch" || return $?
else
echo "Branch '$branch' does not exist; creating from '$from_ref' at: $dest"
git -C "$repo_root" worktree add --force -b "$branch" "$dest" "$from_ref" || return $?
fi
# Jump into the new worktree
cd "$dest" || return $?
echo "✔ Worktree ready at: $dest"
}

View File

@ -301,11 +301,13 @@ bindsym $mod+r mode "resize"
set $laptop eDP-1
set $dell1 'Dell Inc. DELL U2713HM GK0KD357412L'
set $dell2 'Dell Inc. DELL U2713HM GK0KD357413L'
set $tv 'Samsung Electric Company SAMSUNG 0x01000E00'
bindswitch --reload --locked lid:on output $laptop disable
bindswitch --reload --locked lid:off output $laptop enable
output $laptop resolution 1920x1080 position 0,0
output $dell1 resolution 2560x1440@59.951Hz position 0,660 transform normal
output $dell2 resolution 2560x1440@59.951Hz position 2560,0 transform 270
output $tv resolution 1920x1080@59.951Hz position 0,660 transform normal
# class border bground text indicator child_border
client.focused #6272A4 #6272A4 #F8F8F2 #6272A4 #6272A4