From 6a7193ab145dd4230a0da41374128ca04390e4a4 Mon Sep 17 00:00:00 2001 From: Dennis Date: Wed, 21 Jan 2026 14:43:51 +0100 Subject: [PATCH] switches to tmuxinator instead of cobbled together script --- home/darwin-work.nix | 1 + home/darwin.nix | 1 + modules/fish/default.nix | 16 ++-------------- modules/tmux/default.nix | 8 +++++--- modules/tmuxinator/personal-layouts/main.yml | 7 +++++++ .../personal-layouts/nix-config.yml | 11 +++++++++++ modules/tmuxinator/personal-layouts/notes.yml | 11 +++++++++++ modules/tmuxinator/personal.nix | 8 ++++++++ modules/tmuxinator/work-layouts/devtools.yml | 11 +++++++++++ .../work-layouts/k8s-admin-certification.yml | 11 +++++++++++ modules/tmuxinator/work-layouts/main.yml | 7 +++++++ .../tmuxinator/work-layouts/nix-config.yml | 11 +++++++++++ modules/tmuxinator/work-layouts/notes.yml | 11 +++++++++++ .../tmuxinator/work-layouts/ride-charts.yml | 11 +++++++++++ modules/tmuxinator/work-layouts/ride.yml | 19 +++++++++++++++++++ modules/tmuxinator/work.nix | 8 ++++++++ 16 files changed, 135 insertions(+), 17 deletions(-) create mode 100644 modules/tmuxinator/personal-layouts/main.yml create mode 100644 modules/tmuxinator/personal-layouts/nix-config.yml create mode 100644 modules/tmuxinator/personal-layouts/notes.yml create mode 100644 modules/tmuxinator/personal.nix create mode 100644 modules/tmuxinator/work-layouts/devtools.yml create mode 100644 modules/tmuxinator/work-layouts/k8s-admin-certification.yml create mode 100644 modules/tmuxinator/work-layouts/main.yml create mode 100644 modules/tmuxinator/work-layouts/nix-config.yml create mode 100644 modules/tmuxinator/work-layouts/notes.yml create mode 100644 modules/tmuxinator/work-layouts/ride-charts.yml create mode 100644 modules/tmuxinator/work-layouts/ride.yml create mode 100644 modules/tmuxinator/work.nix diff --git a/home/darwin-work.nix b/home/darwin-work.nix index 5d3dd65..9b13986 100644 --- a/home/darwin-work.nix +++ b/home/darwin-work.nix @@ -19,6 +19,7 @@ ../modules/fish ../modules/ghostty ../modules/tmux + ../modules/tmuxinator/work.nix ../modules/nvim ../modules/lazygit ]; diff --git a/home/darwin.nix b/home/darwin.nix index ba014f6..5cb2d7b 100644 --- a/home/darwin.nix +++ b/home/darwin.nix @@ -19,6 +19,7 @@ ../modules/fish ../modules/nvim ../modules/tmux + ../modules/tmuxinator/personal.nix ../modules/ghostty ../modules/lazygit ]; diff --git a/modules/fish/default.nix b/modules/fish/default.nix index 79891c9..2e01c53 100644 --- a/modules/fish/default.nix +++ b/modules/fish/default.nix @@ -60,25 +60,13 @@ end ''; sessionizer = /* fish */ '' - set -l selected (dev_projects | fzf --prompt "sessionize >> ") + set -l selected (tmuxinator ls | fzf --prompt "switch to >> ") if test -z "$selected" return 1 end - set -l session_name (basename $selected) - set -l tmux_running (pgrep tmux) - - if test -z $TMUX && test -z $tmux_running - tmux new-session -s $session_name -c $selected - return 0 - end - - if not tmux has-session -t=$session_name 2> /dev/null - tmux new-session -ds $session_name -c $selected - end - - tmux switch-client -t $session_name + tmuxinator start "$selected" ''; tmux_sessionizer = /* fish */ '' tmux display-popup -h 50% -w 80% -E sessionizer diff --git a/modules/tmux/default.nix b/modules/tmux/default.nix index 01ab062..7399a34 100644 --- a/modules/tmux/default.nix +++ b/modules/tmux/default.nix @@ -39,11 +39,13 @@ set -g status-style bg=#1d202f,fg=white set -g status-left "" set -g status-right "#[bg=default,fg=magenta]>> #S << #[bg=default,fg=white]#H " - set -g window-status-current-style bg=default,fg=magenta,bold - set-window-option -g window-status-format "[#I] #W#F " - set-window-option -g window-status-current-format "[#I] #W#F " + set-window-option -g window-status-style 'fg=magenta,bg=black' + set-window-option -g window-status-format ' #I #[fg=white]#W #[fg=cyan]#F ' + set-window-option -g window-status-current-style "fg=black,bg=magenta" + set-window-option -g window-status-current-format " #I #W #F " set -g pane-border-style fg=#807c9f set -g pane-active-border-style fg=magenta + set -g message-style "fg=black,bg=red,bold" unbind % bind "|" split-window -h diff --git a/modules/tmuxinator/personal-layouts/main.yml b/modules/tmuxinator/personal-layouts/main.yml new file mode 100644 index 0000000..aaf99be --- /dev/null +++ b/modules/tmuxinator/personal-layouts/main.yml @@ -0,0 +1,7 @@ +name: main +root: ~/ +windows: + - default: + layout: main-vertical + panes: + - clear diff --git a/modules/tmuxinator/personal-layouts/nix-config.yml b/modules/tmuxinator/personal-layouts/nix-config.yml new file mode 100644 index 0000000..86a3c62 --- /dev/null +++ b/modules/tmuxinator/personal-layouts/nix-config.yml @@ -0,0 +1,11 @@ +name: nix-config +root: ~/dev/nix-config/ +windows: + - code: + layout: main-horizontal + panes: + - nvim +"lua Snacks.picker.files({ hidden = true })" + - run: + layout: even-vertical + panes: + - clear diff --git a/modules/tmuxinator/personal-layouts/notes.yml b/modules/tmuxinator/personal-layouts/notes.yml new file mode 100644 index 0000000..814af92 --- /dev/null +++ b/modules/tmuxinator/personal-layouts/notes.yml @@ -0,0 +1,11 @@ +name: notes +root: ~/dev/notes +windows: + - code: + layout: main-horizontal + panes: + - nvim +"lua Snacks.picker.files({ hidden = true })" + - run: + layout: even-vertical + panes: + - clear diff --git a/modules/tmuxinator/personal.nix b/modules/tmuxinator/personal.nix new file mode 100644 index 0000000..7b16f91 --- /dev/null +++ b/modules/tmuxinator/personal.nix @@ -0,0 +1,8 @@ +{ config, ... }: + +{ + xdg.configFile."tmuxinator" = { + # mkOutOfStoreSymlink needs an absolute path, otherwise it does not work: https://github.com/nix-community/home-manager/issues/676#issuecomment-1595795685 + source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/dev/nix-config/modules/tmuxinator/personal-layouts"; + }; +} diff --git a/modules/tmuxinator/work-layouts/devtools.yml b/modules/tmuxinator/work-layouts/devtools.yml new file mode 100644 index 0000000..56941fe --- /dev/null +++ b/modules/tmuxinator/work-layouts/devtools.yml @@ -0,0 +1,11 @@ +name: devtools +root: ~/dev/devtools/ +windows: + - code: + layout: main-horizontal + panes: + - nvim +"lua Snacks.picker.files({ hidden = true })" + - run: + layout: even-vertical + panes: + - clear diff --git a/modules/tmuxinator/work-layouts/k8s-admin-certification.yml b/modules/tmuxinator/work-layouts/k8s-admin-certification.yml new file mode 100644 index 0000000..0673120 --- /dev/null +++ b/modules/tmuxinator/work-layouts/k8s-admin-certification.yml @@ -0,0 +1,11 @@ +name: k8s-admin-certification +root: ~/dev/kubernetes-admin-certification +windows: + - notes: + layout: main-vertical + panes: + - cd notes && nvim +"lua Snacks.picker.files({ hidden = true })" + - experiments: + layout: even-vertical + panes: + - cd experiments && clear diff --git a/modules/tmuxinator/work-layouts/main.yml b/modules/tmuxinator/work-layouts/main.yml new file mode 100644 index 0000000..aaf99be --- /dev/null +++ b/modules/tmuxinator/work-layouts/main.yml @@ -0,0 +1,7 @@ +name: main +root: ~/ +windows: + - default: + layout: main-vertical + panes: + - clear diff --git a/modules/tmuxinator/work-layouts/nix-config.yml b/modules/tmuxinator/work-layouts/nix-config.yml new file mode 100644 index 0000000..86a3c62 --- /dev/null +++ b/modules/tmuxinator/work-layouts/nix-config.yml @@ -0,0 +1,11 @@ +name: nix-config +root: ~/dev/nix-config/ +windows: + - code: + layout: main-horizontal + panes: + - nvim +"lua Snacks.picker.files({ hidden = true })" + - run: + layout: even-vertical + panes: + - clear diff --git a/modules/tmuxinator/work-layouts/notes.yml b/modules/tmuxinator/work-layouts/notes.yml new file mode 100644 index 0000000..814af92 --- /dev/null +++ b/modules/tmuxinator/work-layouts/notes.yml @@ -0,0 +1,11 @@ +name: notes +root: ~/dev/notes +windows: + - code: + layout: main-horizontal + panes: + - nvim +"lua Snacks.picker.files({ hidden = true })" + - run: + layout: even-vertical + panes: + - clear diff --git a/modules/tmuxinator/work-layouts/ride-charts.yml b/modules/tmuxinator/work-layouts/ride-charts.yml new file mode 100644 index 0000000..6fc4ae8 --- /dev/null +++ b/modules/tmuxinator/work-layouts/ride-charts.yml @@ -0,0 +1,11 @@ +name: ride-charts +root: ~/dev/ride-charts +windows: + - code: + layout: main-horizontal + panes: + - nvim +"lua Snacks.picker.files({ hidden = true })" + - run: + layout: even-vertical + panes: + - clear diff --git a/modules/tmuxinator/work-layouts/ride.yml b/modules/tmuxinator/work-layouts/ride.yml new file mode 100644 index 0000000..fb71ec4 --- /dev/null +++ b/modules/tmuxinator/work-layouts/ride.yml @@ -0,0 +1,19 @@ +name: ride +root: ~/dev/ride +windows: + - code: + layout: main-horizontal + panes: + - nvim +"lua Snacks.picker.files({ hidden = true })" + - run: + layout: even-vertical + panes: + - clear + - db_staging: + layout: main-horizontal + panes: + - dbui_stg + - db_production: + layout: main-horizontal + panes: + - dbui_prod diff --git a/modules/tmuxinator/work.nix b/modules/tmuxinator/work.nix new file mode 100644 index 0000000..44a772f --- /dev/null +++ b/modules/tmuxinator/work.nix @@ -0,0 +1,8 @@ +{ config, ... }: + +{ + xdg.configFile."tmuxinator" = { + # mkOutOfStoreSymlink needs an absolute path, otherwise it does not work: https://github.com/nix-community/home-manager/issues/676#issuecomment-1595795685 + source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/dev/nix-config/modules/tmuxinator/work-layouts"; + }; +}