From d6f4aee0ccf47dea61204f4af44d8eed2e65f96c Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Sat, 26 Sep 2026 22:23:04 +0100 Subject: Use zsh for Canonical Zellij panes --- docs/canonical-laptop.md | 4 +- dot_config/zellij/config.kdl | 104 ------------------------------------ dot_config/zellij/config.kdl.tmpl | 107 ++++++++++++++++++++++++++++++++++++++ tests/test_canonical.py | 17 ++++++ 4 files changed, 127 insertions(+), 105 deletions(-) delete mode 100644 dot_config/zellij/config.kdl create mode 100644 dot_config/zellij/config.kdl.tmpl diff --git a/docs/canonical-laptop.md b/docs/canonical-laptop.md index ef988e1..67442f4 100644 --- a/docs/canonical-laptop.md +++ b/docs/canonical-laptop.md @@ -135,7 +135,9 @@ existing PaperWM installation, run `just canonical-extensions`, log out and back in, then run `just canonical-desktop`. No `just apply` is needed for these settings. Ghostty starts Nix zsh as a login shell. It does not change the authd account's -shell. GNOME keeps its own desktop environment and GNOME Keyring. `pass` remains +shell. Zellij explicitly starts Nix zsh for new shells. Existing bash panes +remain bash; run `exec ~/.nix-profile/bin/zsh` in those panes, or start a new +session after deployment. GNOME keeps its own desktop environment and GNOME Keyring. `pass` remains a terminal tool; this role does not install the pass Secret Service daemon. ## Package Sources diff --git a/dot_config/zellij/config.kdl b/dot_config/zellij/config.kdl deleted file mode 100644 index d87771a..0000000 --- a/dot_config/zellij/config.kdl +++ /dev/null @@ -1,104 +0,0 @@ -// Gruvbox dark theme (built-in) -theme "gruvbox-dark" - -// Session resurrection -serialize_pane_viewport true - -// Scrollback -scroll_buffer_size 50000 - -// Clipboard: copy to system clipboard on selection (OSC 52) -copy_on_select true - -// Auto-attach to existing session with the same name instead of erroring -attach_to_session true - -// Disable startup popups that overwrite stow-managed config when dismissed -show_startup_tips false -show_release_notes false - -// Clean UI: no pane borders -pane_frames false - -// Custom keybindings (merged with defaults) -keybinds { - shared_except "locked" { - // Free up Ctrl+* keys so they pass through to zsh / nvim. - // Mode-entry relocated to Alt+Shift+* below. Ctrl+h/j/k/l are kept - // by the vim-zellij-navigator binds further down. - unbind "Ctrl b" "Ctrl g" "Ctrl n" "Ctrl o" "Ctrl p" "Ctrl q" "Ctrl s" "Ctrl t" - - // Mode entry (Alt+Shift+) - bind "Alt Shift P" { SwitchToMode "Pane"; } - bind "Alt Shift T" { SwitchToMode "Tab"; } - bind "Alt Shift R" { SwitchToMode "Resize"; } - bind "Alt Shift S" { SwitchToMode "Scroll"; } - bind "Alt Shift O" { SwitchToMode "Session"; } - bind "Alt Shift Z" { SwitchToMode "Locked"; } - bind "Alt Shift Q" { Quit; } - - // Direct tab access (Alt+number) - bind "Alt 1" { GoToTab 1; } - bind "Alt 2" { GoToTab 2; } - bind "Alt 3" { GoToTab 3; } - bind "Alt 4" { GoToTab 4; } - bind "Alt 5" { GoToTab 5; } - bind "Alt 6" { GoToTab 6; } - bind "Alt 7" { GoToTab 7; } - bind "Alt 8" { GoToTab 8; } - bind "Alt 9" { GoToTab 9; } - - // Tab management - bind "Alt t" { NewTab; } - bind "Alt [" { GoToPreviousTab; } - bind "Alt ]" { GoToNextTab; } - - // Cycle swap layouts (tiled/stacked variants) — nearest thing to - // "reset pane sizes", since zellij has no equalize action. - bind "Alt \\" { NextSwapLayout; } - - // Pane management - bind "Alt w" { ToggleFocusFullscreen; } - bind "Alt x" { CloseFocus; } - bind "Alt e" { EditScrollback; } - - // Explicit splits (tmux-style mnemonics: | vertical, _ horizontal). - // Bypasses NewPane's aspect-ratio auto-direction which misfires on - // widescreens with pane_frames disabled. - bind "Alt |" { NewPane "Right"; } - bind "Alt _" { NewPane "Down"; } - - // Session - bind "Alt q" { Detach; } - - // Quick resize without entering resize mode - bind "Alt -" { Resize "Decrease"; } - bind "Alt =" { Resize "Increase"; } - - // Seamless vim/zellij pane navigation (requires smart-splits.nvim) - bind "Ctrl h" { - MessagePlugin "https://github.com/hiasr/vim-zellij-navigator/releases/download/0.3.0/vim-zellij-navigator.wasm" { - name "move_focus" - payload "left" - } - } - bind "Ctrl j" { - MessagePlugin "https://github.com/hiasr/vim-zellij-navigator/releases/download/0.3.0/vim-zellij-navigator.wasm" { - name "move_focus" - payload "down" - } - } - bind "Ctrl k" { - MessagePlugin "https://github.com/hiasr/vim-zellij-navigator/releases/download/0.3.0/vim-zellij-navigator.wasm" { - name "move_focus" - payload "up" - } - } - bind "Ctrl l" { - MessagePlugin "https://github.com/hiasr/vim-zellij-navigator/releases/download/0.3.0/vim-zellij-navigator.wasm" { - name "move_focus" - payload "right" - } - } - } -} diff --git a/dot_config/zellij/config.kdl.tmpl b/dot_config/zellij/config.kdl.tmpl new file mode 100644 index 0000000..04e1bbf --- /dev/null +++ b/dot_config/zellij/config.kdl.tmpl @@ -0,0 +1,107 @@ +{{ if eq (default "host" (index . "machineRole")) "canonical" }} +default_shell {{ printf "%s/.nix-profile/bin/zsh" .chezmoi.homeDir | quote }} +{{ end }} +// Gruvbox dark theme (built-in) +theme "gruvbox-dark" + +// Session resurrection +serialize_pane_viewport true + +// Scrollback +scroll_buffer_size 50000 + +// Clipboard: copy to system clipboard on selection (OSC 52) +copy_on_select true + +// Auto-attach to existing session with the same name instead of erroring +attach_to_session true + +// Disable startup popups that overwrite stow-managed config when dismissed +show_startup_tips false +show_release_notes false + +// Clean UI: no pane borders +pane_frames false + +// Custom keybindings (merged with defaults) +keybinds { + shared_except "locked" { + // Free up Ctrl+* keys so they pass through to zsh / nvim. + // Mode-entry relocated to Alt+Shift+* below. Ctrl+h/j/k/l are kept + // by the vim-zellij-navigator binds further down. + unbind "Ctrl b" "Ctrl g" "Ctrl n" "Ctrl o" "Ctrl p" "Ctrl q" "Ctrl s" "Ctrl t" + + // Mode entry (Alt+Shift+) + bind "Alt Shift P" { SwitchToMode "Pane"; } + bind "Alt Shift T" { SwitchToMode "Tab"; } + bind "Alt Shift R" { SwitchToMode "Resize"; } + bind "Alt Shift S" { SwitchToMode "Scroll"; } + bind "Alt Shift O" { SwitchToMode "Session"; } + bind "Alt Shift Z" { SwitchToMode "Locked"; } + bind "Alt Shift Q" { Quit; } + + // Direct tab access (Alt+number) + bind "Alt 1" { GoToTab 1; } + bind "Alt 2" { GoToTab 2; } + bind "Alt 3" { GoToTab 3; } + bind "Alt 4" { GoToTab 4; } + bind "Alt 5" { GoToTab 5; } + bind "Alt 6" { GoToTab 6; } + bind "Alt 7" { GoToTab 7; } + bind "Alt 8" { GoToTab 8; } + bind "Alt 9" { GoToTab 9; } + + // Tab management + bind "Alt t" { NewTab; } + bind "Alt [" { GoToPreviousTab; } + bind "Alt ]" { GoToNextTab; } + + // Cycle swap layouts (tiled/stacked variants) — nearest thing to + // "reset pane sizes", since zellij has no equalize action. + bind "Alt \\" { NextSwapLayout; } + + // Pane management + bind "Alt w" { ToggleFocusFullscreen; } + bind "Alt x" { CloseFocus; } + bind "Alt e" { EditScrollback; } + + // Explicit splits (tmux-style mnemonics: | vertical, _ horizontal). + // Bypasses NewPane's aspect-ratio auto-direction which misfires on + // widescreens with pane_frames disabled. + bind "Alt |" { NewPane "Right"; } + bind "Alt _" { NewPane "Down"; } + + // Session + bind "Alt q" { Detach; } + + // Quick resize without entering resize mode + bind "Alt -" { Resize "Decrease"; } + bind "Alt =" { Resize "Increase"; } + + // Seamless vim/zellij pane navigation (requires smart-splits.nvim) + bind "Ctrl h" { + MessagePlugin "https://github.com/hiasr/vim-zellij-navigator/releases/download/0.3.0/vim-zellij-navigator.wasm" { + name "move_focus" + payload "left" + } + } + bind "Ctrl j" { + MessagePlugin "https://github.com/hiasr/vim-zellij-navigator/releases/download/0.3.0/vim-zellij-navigator.wasm" { + name "move_focus" + payload "down" + } + } + bind "Ctrl k" { + MessagePlugin "https://github.com/hiasr/vim-zellij-navigator/releases/download/0.3.0/vim-zellij-navigator.wasm" { + name "move_focus" + payload "up" + } + } + bind "Ctrl l" { + MessagePlugin "https://github.com/hiasr/vim-zellij-navigator/releases/download/0.3.0/vim-zellij-navigator.wasm" { + name "move_focus" + payload "right" + } + } + } +} diff --git a/tests/test_canonical.py b/tests/test_canonical.py index 1a9be82..724b922 100644 --- a/tests/test_canonical.py +++ b/tests/test_canonical.py @@ -150,6 +150,23 @@ class PackageTests(unittest.TestCase): class RoleTests(unittest.TestCase): + def test_canonical_zellij_uses_zsh_without_changing_other_roles(self): + for role in ("canonical", "host", "vm"): + rendered = subprocess.check_output( + self.command( + role, + "execute-template", + "--file", + str(ROOT / "dot_config/zellij/config.kdl.tmpl"), + ), + text=True, + ) + if role == "canonical": + self.assertIn('/.nix-profile/bin/zsh"', rendered) + self.assertIn('default_shell "', rendered) + else: + self.assertNotIn("default_shell", rendered) + def test_canonical_ghostty_has_no_window_decoration(self): rendered = subprocess.check_output( self.command( -- cgit v1.3.1