Updated home and work conf files

Added tmi.sh script
Updated README
This commit is contained in:
2026-07-21 15:27:08 -04:00
parent 385cce1f5b
commit 674bcc13ee
4 changed files with 120 additions and 18 deletions
+17 -3
View File
@@ -1,9 +1,10 @@
---
CREATED : 2026-03-03
UPDATED : 2026-03-03
AUTHOR : chawley
created: 2015-09-09
updated: 2026-07-21
author: chawley
---
#readme
# TMUX Hack Session Launcher
A Bash script designed to manage and automate pre-defined tmux-sessions. This script allows you to launch complex development or administration environments - complete with multiple windows and SSH connections - using a single command.
@@ -32,6 +33,7 @@ A Bash script designed to manage and automate pre-defined tmux-sessions. This sc
1. Copy the script to a directory in your `$PATH` (e.g., `~/bin` or `/usr/local/bin`).
2. Rename it to something short, like `tm`.
3. Make the script executable:
```bash
chmod +x ~/bin/tm
```
@@ -67,4 +69,16 @@ To add a new session, add a new case stanza inside the `case $session in` block.
```
### Script Variables
- `TMUX_CONF`: Defaults to `$HOME/.tmux.conf`. Modify this variable if your configuration file is located elsewhere.
## Tmux Menu Improved (TMI)
A vibe-coded improvement on the original
### Key Improvements & Refactor Notes
- **Robust Session Detection (`tmux has-session`):** Replaced `tmux list-sessions | grep -c` with `tmux has-session -t "=${session}"`. Using exact match targeting (`=`) prevents substring false positives (e.g., matching `mine` against `mine-dev` or log strings) and eliminates pipe subshell overhead.
- **Declarative Data Structure:** Session definitions are separated from the initialization logic using an associative array (`SESSIONS`). Adding a new layout only requires defining a new key and window matrix, removing repetitive `tmux new-window` boilerplates.
- **Process Handover via `exec`:** Replaced subshell execution of `tmux attach-session` with `exec tmux ...`. This replaces the bash script process with the tmux client process directly, eliminating an orphaned shell process remaining in memory while attached.
- **Strict Shell Hygiene:** Added `set -euo pipefail` and proper variable quoting to prevent unhandled failures or field splitting errors. redirected operational error output to `stderr` (`>&2`).
- **Interactive Fallback (`fzf`):** If invoked without arguments (`tm`), the script checks for `fzf` in `$PATH`. If present, it serves an interactive fuzzy selector of configured session keys rather than instantly printing an error.