Enhance shell widgets, tmux status, and git colors

- Add frecency scoring + git status boost to ^E edit widget
- Add network latency indicator to tmux status bar (wifi/wired detection, 10s cache)
- Add powerline separators between tmux status sections
- Swap git status colors: modified=bluish grey, untracked=amber (prompt, gitconfig, widget)
- Remove bold from feature branch name in prompt
- Add gw (git show) and gdm (diff against default branch) aliases

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-25 14:45:21 +00:00
parent 53bd2f49ef
commit dc6b117016
6 changed files with 65 additions and 9 deletions

View File

@@ -37,6 +37,8 @@ alias gc='git c'
alias gl='git ld'
alias ga='git a'
alias gr='git r'
alias gw='git show'
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/}"; }

View File

@@ -50,8 +50,8 @@
[color "status"]
added = "#2CB494"
changed = "#F88C14"
untracked = "#808080" italic
changed = "#8787AF"
untracked = "#F88C14" italic
branch = "#2CB494"
header = "#CCE0D0"
[color "diff"]

View File

@@ -63,8 +63,8 @@ set -g status-position bottom
set -g status-interval 1
set -g status-style "fg=#728cb8,bg=default"
set -g status-left "#{?client_prefix,#[fg=#2cb494]● ,#[fg=#3c3c3c]● }"
set -g status-right "#(~/.tmux/battery.sh) #[fg=#808080,bg=default]%a %d %b #[fg=#2cb494,bg=#1a1a1a] %H:%M #[default] "
set -g status-right-length 60
set -g status-right "#(~/.tmux/network.sh) #[fg=#3c3c3c] #(~/.tmux/battery.sh) #[fg=#3c3c3c] #[fg=#808080]%a %d %b #[fg=#2cb494,bg=#1a1a1a] %H:%M #[default] "
set -g status-right-length 80
set -g window-status-format "#{?window_last_flag, #[fg=#1a7a64]#I#[fg=default] #W , #I #W }"
set -g window-status-current-format " #[fg=#085040]#I#[fg=#0a0a0a] #W "
set -g window-status-separator " "

54
home/.tmux/network.sh Executable file
View File

@@ -0,0 +1,54 @@
#!/usr/bin/env bash
# Network indicator for tmux status bar.
# Pings 1.1.1.1 to measure latency, detects wired vs wifi.
# Caches result for 10s to avoid excessive pinging.
cache="${TMPDIR:-/tmp}/.tmux_network_cache"
# Return cached result if fresh (<10s old)
if [[ -f "$cache" ]]; then
age=$(( $(date +%s) - $(stat -f%m "$cache" 2>/dev/null || stat -c%Y "$cache" 2>/dev/null || echo 0) ))
if (( age < 10 )); then
cat "$cache"
exit 0
fi
fi
# Detect connection type
wired=1
if [[ "$(uname)" == "Darwin" ]]; then
iface=$(route -n get default 2>/dev/null | awk '/interface:/{print $2}')
if networksetup -listallhardwareports 2>/dev/null | grep -A1 'Wi-Fi' | grep -q "$iface"; then
wired=""
fi
else
iface=$(ip route show default 2>/dev/null | awk '{print $5; exit}')
[[ -d "/sys/class/net/${iface}/wireless" ]] && wired=""
fi
# Measure latency
ms=""
if [[ "$(uname)" == "Darwin" ]]; then
ms=$(ping -c1 -t1 1.1.1.1 2>/dev/null | awk '/time=/{gsub(/.*time=/,""); printf "%.0f", $1}')
else
ms=$(ping -c1 -W1 1.1.1.1 2>/dev/null | awk '/time=/{gsub(/.*time=/,""); printf "%.0f", $1}')
fi
# Pick icon: wired 󰈀 vs wifi 󰤨
if [[ -n "$wired" ]]; then
icon="󰈀"
else
icon="󰤨"
fi
if [[ -z "$ms" ]]; then
result="#[fg=#F40404]󰤭 --#[default]"
elif (( ms <= 50 )); then
result="#[fg=#808080]${icon} ${ms}ms#[default]"
elif (( ms <= 150 )); then
result="#[fg=#f88c14]${icon} ${ms}ms#[default]"
else
result="#[fg=#F40404]${icon} ${ms}ms#[default]"
fi
echo "$result" | tee "$cache"

View File

@@ -145,7 +145,7 @@ _dots_git_info_sync() {
elif [[ "$branch" == (main|master) ]]; then
branch_pill="${_dots_pc[dark_bg]}${_dots_pc[dark]}(${_dots_pc[grey]}${branch}${_dots_pc[reset]}${_dots_pc[dark_bg]}${_dots_pc[dark]})${_dots_pc[reset]}"
else
branch_pill="${_dots_pc[dark_bg]}${_dots_pc[dark]}(${_dots_pc[purple]}${_dots_pc[bold]}${branch}${_dots_pc[reset]}${_dots_pc[dark_bg]}${_dots_pc[dark]})${_dots_pc[reset]}"
branch_pill="${_dots_pc[dark_bg]}${_dots_pc[dark]}(${_dots_pc[purple]}${branch}${_dots_pc[reset]}${_dots_pc[dark_bg]}${_dots_pc[dark]})${_dots_pc[reset]}"
fi
local info="$branch_pill"
@@ -156,11 +156,11 @@ _dots_git_info_sync() {
sep=" "
fi
if (( unstaged )); then
dirty+="${sep}${_dots_pc[orange]}~${unstaged}"
dirty+="${sep}${_dots_pc[grey]}~${unstaged}"
sep=" "
fi
if (( untracked )); then
dirty+="${sep}${_dots_pc[grey]}?${untracked}"
dirty+="${sep}${_dots_pc[orange]}?${untracked}"
fi
local arrows=""

View File

@@ -53,10 +53,10 @@ _dots_load_keybindings() {
for (f in git) printf "100000\t%s\t%s\n", clr(git[f]), f
}
function clr(st) {
if (st ~ /^\?\?/) return "\033[90m?\033[0m"
if (st ~ /^\?\?/) return "\033[33m?\033[0m"
if (st ~ /^R/) return "\033[36mR\033[0m"
if (st ~ /^A/) return "\033[32mA\033[0m"
if (st ~ /M/) return "\033[33mM\033[0m"
if (st ~ /M/) return "\033[38;5;103mM\033[0m"
return "\033[90m~\033[0m"
}' /dev/null 2>/dev/null | sort -rn | cut -f2-
rg --files --hidden --glob '!.git' 2>/dev/null | awk '{print " \t" $0}'