Add hostname to tmux

This commit is contained in:
Yan Lin 2025-09-01 23:03:25 +02:00
parent 30fed0d178
commit 0ed8b2069b
3 changed files with 51 additions and 23 deletions

View file

@ -9,7 +9,7 @@ in
description = "Nix configuration"; description = "Nix configuration";
windows = [ windows = [
{ {
name = "nix"; name = "";
path = "${homeDirectory}/.config/nix"; path = "${homeDirectory}/.config/nix";
ai = true; ai = true;
git = true; git = true;
@ -22,7 +22,7 @@ in
description = "Homelab Deployment"; description = "Homelab Deployment";
windows = [ windows = [
{ {
name = "homelab"; name = "";
path = homePath "Documents/Projects/Homelab-deploy"; path = homePath "Documents/Projects/Homelab-deploy";
ai = true; ai = true;
git = true; git = true;
@ -35,7 +35,7 @@ in
description = "Obsidian notes"; description = "Obsidian notes";
windows = [ windows = [
{ {
name = "note"; name = "";
path = homePath "Obsidian/Personal"; path = homePath "Obsidian/Personal";
ai = true; ai = true;
git = false; git = false;
@ -48,7 +48,7 @@ in
description = "Academic programs"; description = "Academic programs";
windows = [ windows = [
{ {
name = "pro"; name = "";
path = homePath "Documents/Programs"; path = homePath "Documents/Programs";
ai = true; ai = true;
git = true; git = true;
@ -61,14 +61,14 @@ in
description = "Personal blog project"; description = "Personal blog project";
windows = [ windows = [
{ {
name = "code"; name = "c";
path = homePath "Documents/Projects/personal-blog"; path = homePath "Documents/Projects/personal-blog";
ai = true; ai = true;
git = true; git = true;
shell = true; shell = true;
} }
{ {
name = "content"; name = "p";
path = homePath "Documents/Projects/personal-blog/content"; path = homePath "Documents/Projects/personal-blog/content";
ai = true; ai = true;
git = false; git = false;
@ -80,7 +80,7 @@ in
description = "Personal Homepage"; description = "Personal Homepage";
windows = [ windows = [
{ {
name = "homepage"; name = "";
path = homePath "Documents/Projects/Homepage"; path = homePath "Documents/Projects/Homepage";
ai = true; ai = true;
git = true; git = true;
@ -93,14 +93,14 @@ in
description = "Material design shortcut"; description = "Material design shortcut";
windows = [ windows = [
{ {
name = "code"; name = "c";
path = homePath "Documents/Projects/Material Design Shortcut/MDShortcut-code"; path = homePath "Documents/Projects/Material Design Shortcut/MDShortcut-code";
ai = true; ai = true;
git = true; git = true;
shell = true; shell = true;
} }
{ {
name = "paper"; name = "p";
path = homePath "Documents/Projects/Material Design Shortcut/MDShortcut-paper"; path = homePath "Documents/Projects/Material Design Shortcut/MDShortcut-paper";
ai = true; ai = true;
git = true; git = true;
@ -113,21 +113,21 @@ in
description = "DAKI3 course"; description = "DAKI3 course";
windows = [ windows = [
{ {
name = "code"; name = "c";
path = homePath "Documents/Projects/AI systems & infrastructure/Codes"; path = homePath "Documents/Projects/AI systems & infrastructure/Codes";
ai = true; ai = true;
git = true; git = true;
shell = true; shell = true;
} }
{ {
name = "slides"; name = "s";
path = homePath "Documents/Projects/AI systems & infrastructure/Slides"; path = homePath "Documents/Projects/AI systems & infrastructure/Slides";
ai = true; ai = true;
git = true; git = true;
shell = false; shell = false;
} }
{ {
name = "blog"; name = "b";
path = homePath "Documents/Projects/personal-blog/content/ai-system"; path = homePath "Documents/Projects/personal-blog/content/ai-system";
ai = false; ai = false;
git = false; git = false;
@ -140,7 +140,7 @@ in
description = "DAKI3 group supervision"; description = "DAKI3 group supervision";
windows = [ windows = [
{ {
name = "group"; name = "";
path = homePath "Documents/Projects/DAKI3 Semester Project Group"; path = homePath "Documents/Projects/DAKI3 Semester Project Group";
ai = true; ai = true;
git = true; git = true;
@ -153,7 +153,7 @@ in
description = "Material Meeting Slides"; description = "Material Meeting Slides";
windows = [ windows = [
{ {
name = "slides"; name = "";
path = homePath "Documents/Projects/Material Project Group Meeting"; path = homePath "Documents/Projects/Material Project Group Meeting";
ai = true; ai = true;
git = true; git = true;
@ -166,14 +166,14 @@ in
description = "Inverse material design"; description = "Inverse material design";
windows = [ windows = [
{ {
name = "code"; name = "c";
path = homePath "Documents/Projects/Inverse Design of Disordered Materials/DiffDisMatter-dev"; path = homePath "Documents/Projects/Inverse Design of Disordered Materials/DiffDisMatter-dev";
ai = true; ai = true;
git = true; git = true;
shell = true; shell = true;
} }
{ {
name = "paper"; name = "p";
path = homePath "Documents/Projects/Inverse Design of Disordered Materials/mc-denoising-paper"; path = homePath "Documents/Projects/Inverse Design of Disordered Materials/mc-denoising-paper";
ai = true; ai = true;
git = true; git = true;
@ -186,7 +186,7 @@ in
description = "Temp misc project"; description = "Temp misc project";
windows = [ windows = [
{ {
name = "misc"; name = "";
path = homePath "Documents/Misc/2025/AI model train and infer-Wan"; path = homePath "Documents/Misc/2025/AI model train and infer-Wan";
ai = true; ai = true;
git = false; git = false;

View file

@ -42,7 +42,7 @@
set -g status-left-length 40 set -g status-left-length 40
set -g status-right-length 30 set -g status-right-length 30
set -g status-left '#{?client_prefix,#[bg=#fb4934],#[bg=#a89984]}#[fg=#282828] #S #[bg=#282828] ' set -g status-left '#{?client_prefix,#[bg=#fb4934],#[bg=#a89984]}#[fg=#282828] #S #[bg=#282828] '
set -g status-right '#{?pane_in_mode,[COPY],} %H:%M ' set -g status-right '#{?pane_in_mode,[COPY],} #H | %H:%M '
# Window status format # Window status format
set -g window-status-format ' #I:#W ' set -g window-status-format ' #I:#W '

View file

@ -187,12 +187,19 @@ while IFS= read -r window_config; do
# Create nvim window (default behavior unless explicitly disabled) # Create nvim window (default behavior unless explicitly disabled)
if [ "$NVIM_ENABLED" != "false" ]; then if [ "$NVIM_ENABLED" != "false" ]; then
# Determine window name based on whether WINDOW_NAME is empty or "none"
if [ -z "$WINDOW_NAME" ] || [ "$WINDOW_NAME" = "none" ]; then
NVIM_WINDOW_NAME="nvim"
else
NVIM_WINDOW_NAME="${WINDOW_NAME}-nvim"
fi
if [ "$WINDOW_INDEX" = 1 ]; then if [ "$WINDOW_INDEX" = 1 ]; then
# First window - rename the existing session window # First window - rename the existing session window
tmux rename-window -t "$SESSION_NAME:$WINDOW_INDEX" "${WINDOW_NAME}-nvim" tmux rename-window -t "$SESSION_NAME:$WINDOW_INDEX" "$NVIM_WINDOW_NAME"
else else
# Subsequent windows - create new window # Subsequent windows - create new window
tmux new-window -t "$SESSION_NAME:$WINDOW_INDEX" -n "${WINDOW_NAME}-nvim" -c "$WINDOW_PATH" tmux new-window -t "$SESSION_NAME:$WINDOW_INDEX" -n "$NVIM_WINDOW_NAME" -c "$WINDOW_PATH"
fi fi
tmux send-keys -t "$SESSION_NAME:$WINDOW_INDEX" "nvim" C-m tmux send-keys -t "$SESSION_NAME:$WINDOW_INDEX" "nvim" C-m
sleep 0.5 # Brief delay to ensure nvim loads sleep 0.5 # Brief delay to ensure nvim loads
@ -202,7 +209,14 @@ while IFS= read -r window_config; do
# Create AI window if enabled # Create AI window if enabled
if [ "$AI_ENABLED" = "true" ]; then if [ "$AI_ENABLED" = "true" ]; then
tmux new-window -t "$SESSION_NAME:$WINDOW_INDEX" -n "${WINDOW_NAME}-ai" -c "$WINDOW_PATH" # Determine window name based on whether WINDOW_NAME is empty or "none"
if [ -z "$WINDOW_NAME" ] || [ "$WINDOW_NAME" = "none" ]; then
AI_WINDOW_NAME="ai"
else
AI_WINDOW_NAME="${WINDOW_NAME}-ai"
fi
tmux new-window -t "$SESSION_NAME:$WINDOW_INDEX" -n "$AI_WINDOW_NAME" -c "$WINDOW_PATH"
tmux send-keys -t "$SESSION_NAME:$WINDOW_INDEX" "claude -c" C-m tmux send-keys -t "$SESSION_NAME:$WINDOW_INDEX" "claude -c" C-m
tmux split-window -t "$SESSION_NAME:$WINDOW_INDEX" -h -c "$WINDOW_PATH" tmux split-window -t "$SESSION_NAME:$WINDOW_INDEX" -h -c "$WINDOW_PATH"
tmux split-window -t "$SESSION_NAME:$WINDOW_INDEX.2" -v -c "$WINDOW_PATH" tmux split-window -t "$SESSION_NAME:$WINDOW_INDEX.2" -v -c "$WINDOW_PATH"
@ -212,7 +226,14 @@ while IFS= read -r window_config; do
# Create git window if enabled # Create git window if enabled
if [ "$GIT_ENABLED" = "true" ]; then if [ "$GIT_ENABLED" = "true" ]; then
tmux new-window -t "$SESSION_NAME:$WINDOW_INDEX" -n "${WINDOW_NAME}-git" -c "$WINDOW_PATH" # Determine window name based on whether WINDOW_NAME is empty or "none"
if [ -z "$WINDOW_NAME" ] || [ "$WINDOW_NAME" = "none" ]; then
GIT_WINDOW_NAME="git"
else
GIT_WINDOW_NAME="${WINDOW_NAME}-git"
fi
tmux new-window -t "$SESSION_NAME:$WINDOW_INDEX" -n "$GIT_WINDOW_NAME" -c "$WINDOW_PATH"
tmux send-keys -t "$SESSION_NAME:$WINDOW_INDEX" "lazygit" C-m tmux send-keys -t "$SESSION_NAME:$WINDOW_INDEX" "lazygit" C-m
tmux setw -t "$SESSION_NAME:$WINDOW_INDEX" monitor-activity off tmux setw -t "$SESSION_NAME:$WINDOW_INDEX" monitor-activity off
WINDOW_INDEX=$((WINDOW_INDEX + 1)) WINDOW_INDEX=$((WINDOW_INDEX + 1))
@ -220,7 +241,14 @@ while IFS= read -r window_config; do
# Create shell window if enabled # Create shell window if enabled
if [ "$SHELL_ENABLED" = "true" ]; then if [ "$SHELL_ENABLED" = "true" ]; then
tmux new-window -t "$SESSION_NAME:$WINDOW_INDEX" -n "${WINDOW_NAME}-shell" -c "$WINDOW_PATH" # Determine window name based on whether WINDOW_NAME is empty or "none"
if [ -z "$WINDOW_NAME" ] || [ "$WINDOW_NAME" = "none" ]; then
SHELL_WINDOW_NAME="shell"
else
SHELL_WINDOW_NAME="${WINDOW_NAME}-shell"
fi
tmux new-window -t "$SESSION_NAME:$WINDOW_INDEX" -n "$SHELL_WINDOW_NAME" -c "$WINDOW_PATH"
WINDOW_INDEX=$((WINDOW_INDEX + 1)) WINDOW_INDEX=$((WINDOW_INDEX + 1))
fi fi