aboutsummaryrefslogtreecommitdiffstats
path: root/config/layouts/default.kdl
blob: b898e7be4999aadb6175042008744704efa438f5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
// ~/.config/sl0ppij/layouts/default.kdl
// zjstatus bar, palette-matched to themes/gruber-darker-pop.kdl.
//
// WHY THIS FILE EXISTS: a layout named `default` is what zellij applies to every
// new tab/session, so dropping zjstatus in here replaces the stock tab-bar +
// status-bar everywhere without touching config.kdl.
//
// NOTE ON FRAMES: `hide_frame_for_single_pane` is deliberately NOT set. That
// option makes zjstatus toggle pane frames itself, which would fight the
// `frame_unselected` / `frame_selected` colors tuned in gruber-darker-pop.kdl.
// config.kdl keeps `pane_frames true` and stays authoritative over frames.
//
// NOTE ON SWAP LAYOUTS: overriding the default layout also overrides zellij's
// default swap layouts, so they are restored in default.swap.kdl next to this
// file. Alt-[ / Alt-] keep working.
//
// PERMISSIONS: on first launch zjstatus asks for ReadApplicationState,
// ChangeApplicationState and RunCommands (the last one is for the git widget).
// Click the bar, press `y`. Must be repeated whenever zjstatus.wasm is updated.

layout {
    // A pane_template, not an inline pane: the SAME parser reads
    // default.swap.kdl, so the collapsed layout in there can reuse this whole
    // configuration at a different height instead of duplicating 100 lines of
    // it. `size` is set where it is used, not here.
    pane_template name="sl0pbar" borderless=true {
        plugin location="file:~/.config/sl0ppij/plugins/zjstatus.wasm" {

            // ── palette: lifted verbatim from gruber-darker-pop.kdl ──────
            color_bg      "#181818"  // 24 24 24     theme background
            color_bg_alt  "#282828"  // 40 40 40     ribbon_unselected bg
            color_dim     "#484848"  // 72 72 72     frame_unselected base
            color_fg      "#e4e4ef"  // 228 228 239  text base
            color_sage    "#95a99f"  // 149 169 159  emphasis_0
            color_yellow  "#ffdd33"  // 255 221 51   frame_selected / gruber yellow
            color_green   "#73c936"  // 115 201 54   frame_highlight / success
            color_blue    "#96a6c8"  // 150 166 200
            color_purple  "#9e95c7"  // 158 149 199
            color_brown   "#cc8c3c"  // 204 140 60
            color_red     "#ff4f58"  // 255 79 88    exit_code_error

            format_left   "{mode}{session}"
            format_center "{tabs}{new_tab}"
            format_right  "{command_git} {datetime}"
            format_space  "#[bg=$bg]"

            // ── line up with the panes ──────────────────────────────────
            // sl0p fork only. The bar is a full-width pane, but every pane
            // above it is inset by the pane gap, so without this the bar's
            // ends stick out past every frame on screen.
            //
            // Keep in step with config.kdl's `gap` x `gap_aspect`
            // (1 x 2 = 2 columns). Deliberately not derived automatically:
            // the plugin cannot see that config, and guessing it from pane
            // geometry would be a magic trick that breaks on the first
            // borderless pane.
            margin_left   "2"
            margin_right  "2"

            // ── the bar as a pane ────────────────────────────────────
            // sl0p fork only. With three rows the bar draws the same box
            // the panes do, so the bottom of the screen reads as one more
            // pane rather than as a strip of text. With fewer -- the
            // collapsed layout -- it stays a single line and this is
            // ignored, so the box never appears half-drawn.
            //
            // $dim is `frame_unselected` from the theme: the bar is chrome,
            // so it wears an unfocused pane's border colour and never the
            // focused yellow.
            bar_frame_enabled "true"
            bar_frame_rounded "true"   // keep in step with config.kdl's rounded_corners
            bar_frame_format  "#[fg=$dim]"

            // hide the least-important part instead of letting the three
            // sections collide on a narrow terminal. Priority: center
            // (tabs) > left (mode) > right (git/clock is the first to go).
            format_hide_on_overlength "true"
            format_precedence         "clr"

            // ── mode ────────────────────────────────────────────────────
            // config.kdl is `default_mode "locked"` with Ctrl-g as leader,
            // so LOCKED is the resting state and is styled to recede.
            // Every *unlocked* mode is loud on purpose: with a leader-key
            // setup the expensive mistake is typing into a pane while a
            // mode is still live, so the bar should be impossible to miss.
            // Powerline caps: U+E0B6 left-round, U+E0B4 right-round.
            // These live in the Powerline Symbols block and exist in every
            // Nerd Font AND every powerline-patched font, so they are the
            // safe part. The lock/unlock glyphs below are Font Awesome
            // range and are Nerd-Font-only: if ONLY those show as tofu,
            // you have a powerline font rather than a Nerd Font.
            // Pre-Nerd-Font version saved at default.kdl.pre-nerdfont.
            mode_locked       "#[bg=$dim,fg=$bg,bold] LOCKED #[bg=$bg,fg=$dim]#[bg=$bg,fg=$dim,italic] ^g "
            mode_normal       "#[bg=$yellow,fg=$bg,bold] NORMAL #[bg=$bg,fg=$yellow]#[bg=$bg,fg=$sage,italic] p t r m s o "
            mode_pane         "#[bg=$blue,fg=$bg,bold] PANE #[bg=$bg,fg=$blue]#[bg=$bg,fg=$sage,italic] hjkl n d r s x f w e c "
            mode_tab          "#[bg=$purple,fg=$bg,bold] TAB #[bg=$bg,fg=$purple]#[bg=$bg,fg=$sage,italic] hl n x r b 1-9 "
            mode_resize       "#[bg=$brown,fg=$bg,bold] RESIZE #[bg=$bg,fg=$brown]#[bg=$bg,fg=$sage,italic] hjkl HJKL +- "
            mode_move         "#[bg=$brown,fg=$bg,bold] MOVE #[bg=$bg,fg=$brown]#[bg=$bg,fg=$sage,italic] hjkl n p "
            mode_scroll       "#[bg=$green,fg=$bg,bold] SCROLL #[bg=$bg,fg=$green]#[bg=$bg,fg=$sage,italic] jk du f=find e=edit "
            mode_enter_search "#[bg=$green,fg=$bg,bold] SEARCH: #[bg=$bg,fg=$green]#[bg=$bg,fg=$sage,italic] type, Enter "
            mode_search       "#[bg=$green,fg=$bg,bold] FOUND #[bg=$bg,fg=$green]#[bg=$bg,fg=$sage,italic] n p c w o "
            mode_session      "#[bg=$sage,fg=$bg,bold] SESSION #[bg=$bg,fg=$sage]#[bg=$bg,fg=$sage,italic] g=panes w d c p "
            mode_rename_tab   "#[bg=$red,fg=$bg,bold] RENAME TAB #[bg=$bg,fg=$red]"
            mode_rename_pane  "#[bg=$red,fg=$bg,bold] RENAME PANE #[bg=$bg,fg=$red]"
            mode_prompt       "#[bg=$red,fg=$bg,bold] PROMPT #[bg=$bg,fg=$red]"
            mode_tmux         "#[bg=$brown,fg=$bg,bold] TMUX #[bg=$bg,fg=$brown]"
            mode_default_to_mode "locked"

            // ── session ─────────────────────────────────────────────────
            session "#[bg=$bg,fg=$blue,bold] {name} #[bg=$bg,fg=$dim] "

            // ── tabs ────────────────────────────────────────────────────
            // ▐ / ▌ are half-block glyphs: they fake a hard-edged powerline
            // pill without needing a Nerd Font, and stay square-cornered to
            // match `rounded_corners false`.
            tab_normal            "#[bg=$bg,fg=$dim] {index}#[bg=$bg,fg=$sage] {name} {floating_indicator}#[bg=$bg,fg=$dim] "
            tab_normal_fullscreen "#[bg=$bg,fg=$dim] {index}#[bg=$bg,fg=$sage] {name} {fullscreen_indicator}#[bg=$bg,fg=$dim] "
            tab_normal_sync       "#[bg=$bg,fg=$dim] {index}#[bg=$bg,fg=$sage] {name} {sync_indicator}#[bg=$bg,fg=$dim] "

            tab_active            "#[bg=$yellow,fg=$bg,bold] {index} {name} {floating_indicator}#[bg=$bg,fg=$yellow]"
            tab_active_fullscreen "#[bg=$yellow,fg=$bg,bold] {index} {name} {fullscreen_indicator}#[bg=$bg,fg=$yellow]"
            tab_active_sync       "#[bg=$yellow,fg=$bg,bold] {index} {name} {sync_indicator}#[bg=$bg,fg=$yellow]"

            tab_separator "#[bg=$bg] "
            tab_rename    "#[bg=$red,fg=$bg,bold] {index} {name} #[bg=$bg,fg=$red]"

            tab_sync_indicator       "<> "
            tab_fullscreen_indicator "[] "
            tab_floating_indicator   "^ "

            // ── new tab button ─────────────────────────────────────────
            // sl0p fork only ({new_tab}). Clicking it opens a tab with the
            // default layout and focuses it -- the mouse spelling of the
            // `n` binding in TAB mode. Styled like an inactive tab so it
            // reads as the next thing in the strip rather than as chrome.
            new_tab "#[bg=$bg,fg=$dim] + "

            // ── git branch of the FOCUSED pane's cwd ────────────────────
            // {focused_pane_cwd} (zjstatus 0.24.0+) makes this track
            // whichever pane you are in rather than the session's cwd.
            //
            // The `bash -c` wrapper is REQUIRED, not cosmetic: zjstatus
            // execs the command directly with no shell, so a bare
            // `git ... 2>/dev/null` hands `2>/dev/null` to git as a literal
            // revision argument and git dies with "ambiguous argument".
            // The redirect also matters: outside a git repo git writes to
            // stderr, and without it that noise can reach the bar.
            //
            // rendermode "static" = format with the config's format string
            // and ignore any zjstatus directives in the command's own output.
            command_git_command    "bash -c \"git rev-parse --abbrev-ref HEAD 2>/dev/null\""
            command_git_format     "#[bg=$bg,fg=$green] {stdout}"
            command_git_interval   "10"
            command_git_rendermode "static"
            command_git_cwd        "{focused_pane_cwd}"

            // ── clock ───────────────────────────────────────────────────
            // Keep `#[..]` directives OUT of datetime_format: that string is
            // strftime output substituted into {format} after the outer
            // format is parsed, so a directive in here renders literally.
            datetime           "#[bg=$bg,fg=$sage]{format}"
            datetime_format    "%a %d %b %H:%M"
            datetime_timezone  "Europe/Amsterdam"

            // ── thin rule above the bar, so it reads as chrome ──────────
            border_enabled  "false"
            border_char     "─"
            border_format   "#[fg=$dim]{char}"
            border_position "top"
        }
    }

    default_tab_template {
        children
        // size=3: the bar draws itself as a framed box in the pane style (see
        // bar_frame_enabled), which needs a row for each border. The collapsed
        // "mobile" template in default.swap.kdl uses size=1 instead and the
        // plugin falls back to a single line -- a plugin cannot resize its own
        // pane, so the height is the layout's call.
        sl0pbar size=3
    }
}