Compare commits

..

4 Commits

Author SHA1 Message Date
jsarthak 85c5d942a4 Some shell fixes 2026-07-18 22:33:23 +05:30
jsarthak dd47827e13 feat(tmux): auto-name sessions with emoji + codename
- scripts/tmux-session-name.sh: generates random emoji + adj-noun name
  40 emojis x 40 adjectives x 40 nouns = 64,000 combinations
  Only renames numerically-named sessions (skips explicit names)

- tmux.conf.local: session-created hook calls the script automatically

- shell/common: added DOTFILES=$HOME/dotfiles env var so hooks and
  scripts can find the dotfiles root without hardcoded paths

Examples: '🐉 sonic-oracle', '🌟 electric-nebula', '🔱 nova-comet'
2026-07-18 15:18:50 +05:30
jsarthak 1ec7aff593 fix(tmux): always-on Neovim-style NORMAL/VISUAL mode indicator
NORMAL = always visible when working in tmux (green)
VISUAL = switches in when entering copy-mode via prefix+Enter (blue)

Uses pane-mode-changed hook with -F flag for clean format evaluation.
Default @mode_indicator set to NORMAL on config load.
2026-07-18 14:47:18 +05:30
jsarthak 04b03d85cd fix(tmux): fix NORMAL/VISUAL mode indicators
The #{?pane_in_mode,...} inline conditional was getting mangled by
oh-my-tmux's awk/sed pipeline that processes tmux_conf_theme_status_right.

Fix: use #{@mode_indicator} user-option in status_right, driven by:
  - bind Enter  → sets NORMAL indicator (green) on copy-mode entry
  - bind v      → sets VISUAL indicator (blue) on selection start
  - bind y/Esc  → clears indicator on copy/exit
  - pane-mode-changed hook → clears indicator when mode exits

Also fixed: encoding artifacts in status_right, missing bullet separator.
2026-07-18 14:44:53 +05:30
6 changed files with 90 additions and 9 deletions
+54
View File
@@ -0,0 +1,54 @@
#!/usr/bin/env bash
# tmux-session-name.sh — Auto-name new tmux sessions with emoji + codename
#
# Called by the session-created hook in .tmux.conf
# Usage: tmux-session-name.sh <current_session_name> <session_id>
CURRENT_NAME="${1:-}"
SESSION_ID="${2:-}"
# Skip if name is empty or not a plain number (user explicitly named it)
if [[ -z "$CURRENT_NAME" || ! "$CURRENT_NAME" =~ ^[0-9]+$ ]]; then
exit 0
fi
# ── Name pool ─────────────────────────────────────────────────────────────────
EMOJIS=(
"⚡" "🔥" "🌙" "🚀" "🎯" "💎" "🌊" "🎸" "🦊" "🐉"
"🌟" "🎭" "🔮" "🦋" "🌸" "🏔️" "🎪" "🦁" "🐺" "🦅"
"🐬" "🌋" "⚗️" "🧠" "🔭" "🎲" "🏹" "🌀" "🦄" "🐙"
"🎮" "🛸" "🌈" "🔱" "⚜️" "🧬" "🦾" "💫" "🎆" "🌌"
)
ADJECTIVES=(
swift blazing cosmic silent wild golden dark frozen epic neon
cyber ghost storm iron crystal hyper zen rogue nova apex
void shadow turbo lunar sonic electric primal ancient savage brave
mystic toxic ultra prime omega alpha delta sigma raging burning
)
NOUNS=(
wolf phoenix raven otter falcon dragon viper lynx shark cobra
titan spectre nexus cipher forge matrix pulse blade hawk panther
manta kraken hydra mantis raptor condor jaguar orca wraith banshee
golem oracle anvil tempest quasar nebula comet prism zenith apex
)
# ── Pick random combination ───────────────────────────────────────────────────
# We use absolute arithmetic expansion to avoid negative index quirks
EMOJI="${EMOJIS[$((RANDOM % ${#EMOJIS[@]}))]}"
ADJ="${ADJECTIVES[$((RANDOM % ${#ADJECTIVES[@]}))]}"
NOUN="${NOUNS[$((RANDOM % ${#NOUNS[@]}))]}"
NEW_NAME="${EMOJI} ${ADJ}-${NOUN}"
# ── Rename ────────────────────────────────────────────────────────────────────
if [[ -n "$SESSION_ID" ]]; then
# Use -t with the specific session ID to avoid targeting the wrong session
tmux rename-session -t "$SESSION_ID" "$NEW_NAME" 2>/dev/null
else
# Called standalone — just print the name
echo "$NEW_NAME"
fi
+3
View File
@@ -5,6 +5,9 @@
export EDITOR='nvim' export EDITOR='nvim'
export VISUAL='nvim' export VISUAL='nvim'
# Dotfiles root — used by scripts and tmux hooks
export DOTFILES="$HOME/dotfiles"
# Man page rendering # Man page rendering
export MANROFFOPT="-c" export MANROFFOPT="-c"
+2 -3
View File
@@ -11,11 +11,10 @@ if command -v xclip >/dev/null 2>&1; then
fi fi
# fzf shell integration (Linux path) # fzf shell integration (Linux path)
# Set up fzf key bindings and fuzzy completion [[ -f /usr/share/doc/fzf/examples/key-bindings.zsh ]] && \
eval "$(fzf --bash)" source /usr/share/doc/fzf/examples/key-bindings.zsh
[[ -f ~/.fzf.zsh ]] && source ~/.fzf.zsh [[ -f ~/.fzf.zsh ]] && source ~/.fzf.zsh
# Zoxide (smarter cd) — in case not already initialized by bashrc # Zoxide (smarter cd) — in case not already initialized by bashrc
if [[ -n "$ZSH_VERSION" ]]; then if [[ -n "$ZSH_VERSION" ]]; then
command -v zoxide >/dev/null && eval "$(zoxide init zsh)" command -v zoxide >/dev/null && eval "$(zoxide init zsh)"
+1
View File
@@ -10,6 +10,7 @@ export PATH="/Users/jsarthak/.antigravity/antigravity/bin:$PATH"
# Flutter SDK # Flutter SDK
export PATH="/Users/jsarthak/flutter-sdk/flutter/bin:$PATH" export PATH="/Users/jsarthak/flutter-sdk/flutter/bin:$PATH"
export PATH="/Users/jsarthak/.local/bin:$PATH"
# fzf shell integration (macOS path) # fzf shell integration (macOS path)
source <(fzf --zsh) 2>/dev/null || true source <(fzf --zsh) 2>/dev/null || true
+6 -5
View File
@@ -1,7 +1,7 @@
# starship.toml - Fully riced modern prompt config aligned with Carbonfox theme # starship.toml - Fully riced modern prompt config aligned with Carbonfox theme
format = """ format = """
$os$username$hostname$directory$git_branch$git_state$git_status$python$nodejs$rust$golang$cmd_duration$line_break\ $os$username$hostname$directory$git_branch$git_state$git_status$cmd_duration$line_break\
$character""" $character"""
# Wait 10 milliseconds for starship to check files under the current directory. # Wait 10 milliseconds for starship to check files under the current directory.
@@ -29,7 +29,7 @@ disabled = false
[directory] [directory]
style = "bold blue" # Use terminal blue style = "bold blue" # Use terminal blue
format = "in [ $path]($style)[$read_only]($read_only_style) " format = "in [ $path]($style)[$read_only]($read_only_style) "
truncation_length = 3 truncation_length = 3
truncation_symbol = "…/" truncation_symbol = "…/"
truncate_to_repo = true truncate_to_repo = true
@@ -44,12 +44,12 @@ vimcmd_symbol = "[](bold cyan)" # Use terminal cyan
[git_branch] [git_branch]
symbol = "🌱 " symbol = "🌱 "
style = "bold red" # Use terminal red style = "bold red" # Use terminal red
format = "on [$symbol$branch]($style) " format = "on [$symbol $branch]($style) "
truncation_symbol = "" truncation_symbol = ""
[git_status] [git_status]
style = "bold red" style = "bold red"
format = "([$all_status$ahead_behind]($style) )" format = "([$all_status $ahead_behind]($style) )"
conflicted = "🏳" conflicted = "🏳"
ahead = "🏎💨" ahead = "🏎💨"
behind = "😰" behind = "😰"
@@ -87,8 +87,9 @@ format = "via [$symbol$version]($style) "
[cmd_duration] [cmd_duration]
min_time = 100 min_time = 100
symbol = "⏳"
style = "bold yellow" style = "bold yellow"
format = "underwent [$duration]($style) " format = "took [$duration]($style) "
[status] [status]
style = "bg:blue" style = "bg:blue"
+24 -1
View File
@@ -263,7 +263,7 @@ tmux_conf_theme_status_left_fg="default"
tmux_conf_theme_status_left_bg="default" tmux_conf_theme_status_left_bg="default"
tmux_conf_theme_status_left_attr="none" tmux_conf_theme_status_left_attr="none"
tmux_conf_theme_status_right=" #{prefix}#{mouse}#{pairing}#{synchronized}#{?pane_in_mode,#{?selection_active,#[fg=$color_blue,bg=default,bold] VISUAL,#[fg=$color_green,bg=default,bold] NORMAL},} | #[fg=$color_fg,bg=default,none]󰔚 #{?uptime_d,#{uptime_d}d,}#{?uptime_h,#{uptime_h}h,}#{?uptime_m,#{uptime_m}m,} #[fg=$color_gray]│ #[fg=$color_cyan,bg=default,bold]󱑒 %d %b %H:%M #[fg=$color_gray]│ #[fg=$color_purple,bg=default,bold]󰊪 #{username}#{root}@#{hostname}" tmux_conf_theme_status_right=" #{prefix}#{mouse}#{pairing}#{synchronized}#{@mode_indicator} | #[fg=$color_fg,bg=default,none]󰔚 #{?uptime_d,#{uptime_d}d,}#{?uptime_h,#{uptime_h}h,}#{?uptime_m,#{uptime_m}m,} #[fg=$color_gray]│ #[fg=$color_cyan,bg=default,bold]󱑒 %d %b %H:%M #[fg=$color_gray]│ #[fg=$color_purple,bg=default,bold]󰊪 #{username}#{root}@#{hostname}"
# status right style # status right style
tmux_conf_theme_status_right_fg="$color_red,$color_fg" tmux_conf_theme_status_right_fg="$color_red,$color_fg"
@@ -366,6 +366,29 @@ source-file "/Users/jsarthak/dotfiles/tmux/config/keybindings.conf"
setw -g window-status-separator " #[fg=#484848]• " #!important setw -g window-status-separator " #[fg=#484848]• " #!important
# ── Auto-name sessions (emoji + codename) ─────────────────────────────────────
# Fires on every new session. Skips sessions the user explicitly named.
# Script lives in ~/dotfiles/scripts/tmux-session-name.sh
# set-hook -g session-created \
# 'run-shell "bash $HOME/dotfiles/scripts/tmux-session-name.sh \"#{session_name}\" \"#{session_id}\""'
# ── Mode indicator (always-on, Neovim-style) ──────────────────────────────────
# NORMAL = working in tmux (default, always visible)
# VISUAL = in copy-mode (prefix + Enter)
#
# #{@mode_indicator} is a window user-option set via pane-mode-changed hook.
# We use -F flag so #{pane_in_mode} is evaluated as a tmux format (1=in mode).
# This bypasses oh-my-tmux's awk pipeline which mangles inline #{?...} conditionals.
# Set NORMAL as the default on startup
set-window-option -g @mode_indicator "#[fg=#25be6a,bold] NORMAL "
# Switch between NORMAL and VISUAL whenever the pane mode changes
set-hook -g pane-mode-changed \
'if-shell -F "#{pane_in_mode}" \
"set-window-option -g @mode_indicator \"#[fg=#78a9ff,bold] VISUAL \"" \
"set-window-option -g @mode_indicator \"#[fg=#25be6a,bold] NORMAL \""'
# ── Per-machine local override (untracked) ──────────────────────────────────── # ── Per-machine local override (untracked) ────────────────────────────────────
# Create ~/.tmux.conf.machine.local on each machine for host-specific tweaks # Create ~/.tmux.conf.machine.local on each machine for host-specific tweaks
# (e.g. different color scheme, right-side content, etc.) # (e.g. different color scheme, right-side content, etc.)