aboutsummaryrefslogtreecommitdiffstats
path: root/src/config.c
diff options
context:
space:
mode:
authoruser <user@clank>2026-08-14 19:48:30 +0200
committeruser <user@clank>2026-08-14 19:48:30 +0200
commite021e0d05926fbaae2b53edaf256fdd7b31aff1d (patch)
treee841ac08f4b5a241d4013fcfd0a6207eb78e4f43 /src/config.c
parentsl0ppty: zoom a pane, and give the frame buttons for it (diff)
downloadslosh-e021e0d05926fbaae2b53edaf256fdd7b31aff1d.tar.gz
slosh-e021e0d05926fbaae2b53edaf256fdd7b31aff1d.tar.xz
slosh-e021e0d05926fbaae2b53edaf256fdd7b31aff1d.zip
sl0ppty: minimise a pane into a strip along the bottom
A pane can be put away: it leaves the layout, becomes one row at the bottom of the tab, and keeps running. The panes it leaves behind take the space back. Clicking its row brings it back. Minimised is intent, so it sits beside the weight on the node rather than with the rect and the collapsed flag — and layout_node has to be careful not to clear it the way it clears those, or every frame would undo it. That is the only sharp edge in the whole thing and it has a comment. Everything else fell out of rules that already existed. A split divides among the children that still want space, so a split with one live child is that child, exactly as a split with one child already was. A minimised leaf returns from layout_node before its rect is touched, which also skips the floor check — a pane that is one row by request is not a pane that failed to fit. And the row itself is drawn by the same code as a collapsed header, because it is the same thing: a pane you can see the name of and click. Restoring is not a verb. A focused pane is never minimised, checked once a frame, so every route that ends with the pane focused restores it — clicking the row, the control API, and anything added later that moves focus without knowing minimising exists. In a tab that has flattened into a list, minimising has no effect at all, which is what was asked for and also what falls out: every pane down there is already a row, so there is no second thing for it to be. The strip is not reserved when it would leave too little above it to be worth looking at; the tab flattens instead, and arrives at the same place. Minimising the last visible pane is refused with a toast. A tab showing nothing has no way back that can be discovered from the tab, and it is not a state worth being able to reach by accident. The frame's third button costs another three columns, which is why they are drawn right to left and stop when they run out: a narrow pane keeps close and zoom, and loses minimise first.
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/config.c b/src/config.c
index 1cc76af..bc82d7b 100644
--- a/src/config.c
+++ b/src/config.c
@@ -15,7 +15,8 @@ static const struct {
} ACTIONS[] = {
{"split-cols", ACT_SPLIT_COLS}, {"split-rows", ACT_SPLIT_ROWS},
{"close-pane", ACT_CLOSE_PANE},
- {"zoom", ACT_ZOOM}, {"focus-left", ACT_FOCUS_LEFT},
+ {"zoom", ACT_ZOOM},
+ {"minimize", ACT_MINIMIZE}, {"focus-left", ACT_FOCUS_LEFT},
{"focus-right", ACT_FOCUS_RIGHT}, {"focus-up", ACT_FOCUS_UP},
{"focus-down", ACT_FOCUS_DOWN}, {"focus-next", ACT_FOCUS_NEXT},
{"resize-left", ACT_RESIZE_LEFT}, {"resize-right", ACT_RESIZE_RIGHT},
@@ -174,6 +175,7 @@ void config_defaults(config_t *c) {
snprintf(c->zoom_mark, sizeof c->zoom_mark, "\u25a1");
snprintf(c->zoom_on_mark, sizeof c->zoom_on_mark, "\u25a3");
snprintf(c->close_mark, sizeof c->close_mark, "\u00d7");
+ snprintf(c->min_mark, sizeof c->min_mark, "\u2013");
c->bell_indicator = true;
snprintf(c->bell_mark, sizeof c->bell_mark, "\u2022");
c->min_pane_cols = 24;
@@ -270,6 +272,7 @@ void config_defaults(config_t *c) {
bind_add(c, GHOSTTY_KEY_MINUS, 0, ACT_SPLIT_ROWS);
bind_add(c, GHOSTTY_KEY_X, 0, ACT_CLOSE_PANE);
bind_add(c, GHOSTTY_KEY_Z, 0, ACT_ZOOM);
+ bind_add(c, GHOSTTY_KEY_M, 0, ACT_MINIMIZE);
bind_add(c, GHOSTTY_KEY_H, 0, ACT_FOCUS_LEFT);
bind_add(c, GHOSTTY_KEY_L, 0, ACT_FOCUS_RIGHT);
bind_add(c, GHOSTTY_KEY_K, 0, ACT_FOCUS_UP);
@@ -378,6 +381,8 @@ bool config_load(config_t *c, const char *path, char *err, size_t errcap) {
if (zo) snprintf(c->zoom_on_mark, sizeof c->zoom_on_mark, "%s", zo);
const char *cm = kdl_arg(kdl_child(root, "close_mark"), 0, NULL);
if (cm) snprintf(c->close_mark, sizeof c->close_mark, "%s", cm);
+ const char *mm = kdl_arg(kdl_child(root, "min_mark"), 0, NULL);
+ if (mm) snprintf(c->min_mark, sizeof c->min_mark, "%s", mm);
c->bell_indicator =
kdl_arg_bool(kdl_child(root, "bell_indicator"), 0, c->bell_indicator);
const char *bm = kdl_arg(kdl_child(root, "bell_mark"), 0, NULL);