diff options
| author | user <user@clank> | 2026-08-20 23:22:33 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-20 23:22:33 +0200 |
| commit | b33e8c13ff7981effc7ec2735e6aeaaaf1705af7 (patch) | |
| tree | 4933eb476b5d09e9d8131986c84bb966bca317a2 /src/config.c | |
| parent | fuzz: libFuzzer harness for all six parser surfaces (diff) | |
| download | slosh-b33e8c13ff7981effc7ec2735e6aeaaaf1705af7.tar.gz slosh-b33e8c13ff7981effc7ec2735e6aeaaaf1705af7.tar.xz slosh-b33e8c13ff7981effc7ec2735e6aeaaaf1705af7.zip | |
slosh: floating panes and the drop grammar
A pane can float: lifted out of the layout, drawn over the tiled panes and
under the modals, freely moved and shaped. The model is a flag and a rect on
the leaf, exactly like `minimized` -- the seat in the tree is kept, layout
skips it, the siblings absorb its share, and un-floating returns it home.
The drawn rect is the wanted one clamped to the tab every frame, never
written back, so a terminal squeeze round-trips exactly; an explicit move or
resize *does* write back, because the hand is the author of the intent.
Floating pops the pane to the centre: the jump is what says it happened.
Painted after everything tiled, so the hit list -- searched backwards --
resolves an overlap to the float you can see: the z-order and the click
order are the same list. It casts a shadow (float_shadow, one number), and
`floating` joins the states table above `unfocused`, so a float is never
dimmed as merely-unfocused.
The hands: the title moves it, any other border resizes it (a bottom corner
on both axes; the grabbed edge pins at walls and floors, never sliding the
window), H J K L move a focused float, the =/+ key grows it about its
centre, `-` shrinks it (its split was a refusal anyway), and hovering shows
which edges a grab would take, from the same derivation the press uses.
Equalize moved to `0` to free the key; `C-a f` floats (finder went to `s`,
where it reads as search); `C-a F` opens a new floating shell -- the
throwaway terminal; the function row f1..f12 became nameable in configs
along the way. Guards throughout: the last tiled pane cannot float or
minimize away, closing it lands the top float, splits are refused with
their own words, floats are not swap targets.
Dropping got a grammar: while a pane is carried, the pane under the pointer
subdivides into a swap centre and four edge bands meaning "insert me beside
this pane, on this side" -- detach_leaf + place_beside, the surgery
cross-tab moves already had. Bands are thirds (the first map of quarters
showed the swap owning half of each axis), the hovered band fills the half
the drop would hand over, the release resolves against the painted frame's
hits so it cannot disagree with the fill, and a drop between siblings along
the axis is a reorder that always fits -- refusing it was refusing the most
ordinary drag there is.
Also: rename-pane/rename-tab as palette actions (renaming was a
double-click and nothing else, the one verb the palette could not reach),
and C-u clears the rename editor like it clears the picker's query.
Design log in PLAN-FLOATING-PANES.md; to fold into DESIGN.md as D22/M10-11.
Diffstat (limited to 'src/config.c')
| -rw-r--r-- | src/config.c | 70 |
1 files changed, 66 insertions, 4 deletions
diff --git a/src/config.c b/src/config.c index 6060479..f1361ef 100644 --- a/src/config.c +++ b/src/config.c @@ -22,7 +22,13 @@ static const struct { {"rerun", ACT_RERUN}, {"zoom", ACT_ZOOM}, {"minimize", ACT_MINIMIZE}, + {"float", ACT_FLOAT}, + {"new-float", ACT_NEW_FLOAT}, + {"float-grow", ACT_FLOAT_GROW}, + {"float-shrink", ACT_FLOAT_SHRINK}, {"set-purpose", ACT_SET_PURPOSE}, + {"rename-pane", ACT_RENAME_PANE}, + {"rename-tab", ACT_RENAME_TAB}, {"focus-left", ACT_FOCUS_LEFT}, {"focus-right", ACT_FOCUS_RIGHT}, {"focus-up", ACT_FOCUS_UP}, @@ -83,6 +89,21 @@ static const struct { {"slash", GHOSTTY_KEY_SLASH}, {"comma", GHOSTTY_KEY_COMMA}, {"period", GHOSTTY_KEY_PERIOD}, + /* The function row. The decoder has always understood these (legacy + * CSI ~-forms, SS3 and kitty alike); the config simply had no name for + * them, so nothing could be bound there. */ + {"f1", GHOSTTY_KEY_F1}, + {"f2", GHOSTTY_KEY_F2}, + {"f3", GHOSTTY_KEY_F3}, + {"f4", GHOSTTY_KEY_F4}, + {"f5", GHOSTTY_KEY_F5}, + {"f6", GHOSTTY_KEY_F6}, + {"f7", GHOSTTY_KEY_F7}, + {"f8", GHOSTTY_KEY_F8}, + {"f9", GHOSTTY_KEY_F9}, + {"f10", GHOSTTY_KEY_F10}, + {"f11", GHOSTTY_KEY_F11}, + {"f12", GHOSTTY_KEY_F12}, }; /* A character to a key, and whether typing it needs shift. @@ -277,8 +298,8 @@ size_t config_messages(const config_t *c, const char **out, size_t max) { } static const char *const PSTATE_NAMES[PSTATE_COUNT] = { - "dragging", "drop_hover", "drop_target", "dead", - "suspended", "bell", "scrolled", "unfocused", + "dragging", "drop_hover", "drop_target", "dead", "suspended", + "bell", "scrolled", "floating", "unfocused", }; const char *pane_state_name(pane_state_t s) { @@ -846,6 +867,7 @@ void config_defaults(config_t *c) { * At 60 white text lands on #c3c3c3, which reads as "not this one" without * reading as "not available". */ c->dim_unfocused = 60; + c->float_shadow = 110; c->min_pane_cols = 24; c->min_pane_rows = 6; c->min_split_cols = 32; @@ -1033,6 +1055,11 @@ void config_defaults(config_t *c) { bind_add(c, GHOSTTY_KEY_Z, 0, ACT_ZOOM, false); bind_add(c, GHOSTTY_KEY_E, 0, ACT_EDIT_CONFIG, false); bind_add(c, GHOSTTY_KEY_M, 0, ACT_MINIMIZE, false); + /* `f` is float, not finder. Both wanted the letter; the tie went to the + * verb -- f is what "float" sounds like, a float toggle is pressed in a + * flow (lift, look, put back) where a reach hurts, and the finder reads + * just as naturally as *search* on `s`. */ + bind_add(c, GHOSTTY_KEY_F, 0, ACT_FLOAT, false); bind_add(c, GHOSTTY_KEY_H, 0, ACT_FOCUS_LEFT, false); bind_add(c, GHOSTTY_KEY_L, 0, ACT_FOCUS_RIGHT, false); bind_add(c, GHOSTTY_KEY_K, 0, ACT_FOCUS_UP, false); @@ -1050,7 +1077,23 @@ void config_defaults(config_t *c) { bind_add(c, GHOSTTY_KEY_ARROW_RIGHT, MOD_SHIFT, ACT_RESIZE_RIGHT, false); bind_add(c, GHOSTTY_KEY_ARROW_UP, MOD_SHIFT, ACT_RESIZE_UP, false); bind_add(c, GHOSTTY_KEY_ARROW_DOWN, MOD_SHIFT, ACT_RESIZE_DOWN, false); - bind_add(c, GHOSTTY_KEY_EQUAL, 0, ACT_EQUALIZE, false); + /* The =/+ key grows a focused float and `-` shrinks one (through the + * split-rows case, where a float's split is a refusal anyway). Grow is + * bound with and without shift, because whether `+` arrives shifted + * depends on the outer terminal -- the same deal `?` has with `/` -- and + * that ambiguity is also why equalize moved instead of sharing the key: + * two verbs on one key survive only until a terminal drops the shift. + * Equalize lands on `0`, the digit row it already lives on: 1..9 pick a + * tab, 0 resets the shares. */ + bind_add(c, GHOSTTY_KEY_EQUAL, 0, ACT_FLOAT_GROW, false); + bind_add(c, GHOSTTY_KEY_EQUAL, MOD_SHIFT, ACT_FLOAT_GROW, false); + bind_add(c, GHOSTTY_KEY_DIGIT_0, 0, ACT_EQUALIZE, false); + /* Shifted beside `f`, the same verb on a fresh thing: `f` floats this + * pane, `F` opens a new floating shell -- the throwaway terminal. (It + * spent a day on F12, the IDE key for the same idea, and came back: a + * chord of the leader and a letter is what every other verb here costs, + * and the function row is a reach the home row is not.) */ + bind_add(c, GHOSTTY_KEY_F, MOD_SHIFT, ACT_NEW_FLOAT, false); /* The leader and the space bar: the biggest key on the keyboard, no modifier, * and the one tmux already spends on cycling layouts — so the hand that knows * that reaches for the right thing here. Four presses come back round, which @@ -1088,7 +1131,7 @@ void config_defaults(config_t *c) { * same shifted-pair shape as `p`/`P`, on the letter people reach for. */ bind_add(c, GHOSTTY_KEY_W, 0, ACT_WORKSPACES, false); bind_add(c, GHOSTTY_KEY_W, MOD_SHIFT, ACT_SAVE_WORKSPACE, false); - bind_add(c, GHOSTTY_KEY_F, 0, ACT_FINDER, false); + bind_add(c, GHOSTTY_KEY_S, 0, ACT_FINDER, false); bind_add(c, GHOSTTY_KEY_P, 0, ACT_PALETTE, false); /* Shifted, beside the palette on the same letter: `p` runs a command, `P` * tags this pane. A purpose was reachable only from a layout or the socket, @@ -1137,10 +1180,17 @@ static const struct { {ACT_RERUN, "panes", "run a finished pane again"}, {ACT_ZOOM, "panes", "fill the tab with it"}, {ACT_MINIMIZE, "panes", "put it away in the strip"}, + {ACT_FLOAT, "panes", "float it above the layout"}, + {ACT_NEW_FLOAT, "panes", "a new floating shell"}, /* Under `panes` because a purpose is a fact about this pane, and the label * says "tag" rather than "set purpose": the word people arrive with is the * one for what it is *for*, which is finding the pane again later. */ {ACT_SET_PURPOSE, "panes", "tag it with a purpose"}, + /* Renaming was a double-click and nothing else, which made it the one + * verb the palette could not reach — exactly what the palette exists to + * prevent. Unbound by default: the double-click is the fast path, and an + * action with no key is the palette's whole reason to list it. */ + {ACT_RENAME_PANE, "panes", "rename this pane"}, {ACT_FOCUS_LEFT, "focus", "go left"}, {ACT_FOCUS_RIGHT, "focus", "go right"}, @@ -1156,6 +1206,8 @@ static const struct { /* Short enough to fit the palette's label column, which truncates at 26 — * "give every pane an even share" read as "give every pane an even sh". */ {ACT_EQUALIZE, "size", "even out every split"}, + {ACT_FLOAT_GROW, "size", "grow a floating pane"}, + {ACT_FLOAT_SHRINK, "size", "shrink a floating pane"}, /* Under `panes`, not `size`: it undoes what the program in the pane did to * the pane, which is a fact about that pane and not about the layout. */ {ACT_CLEAR_SHADERS, "panes", "clear this pane's shaders"}, @@ -1168,6 +1220,7 @@ static const struct { {ACT_ROTATE_LAYOUT, "size", "turn the layout a quarter"}, {ACT_NEW_TAB, "tabs", "new tab"}, + {ACT_RENAME_TAB, "tabs", "rename this tab"}, {ACT_CLOSE_TAB, "tabs", "close this tab"}, {ACT_NEXT_TAB, "tabs", "next tab"}, {ACT_PREV_TAB, "tabs", "previous tab"}, @@ -1562,6 +1615,10 @@ char *config_render(const config_t *c) { "dim_unfocused %u // ...and how far the panes you are not in\n", c->dim_unfocused); cb_add(&b, + "float_shadow %u // the shade a floating pane casts; 0 for " + "none\n", + c->float_shadow); + cb_add(&b, "keep_dead \"%s\" // which dead panes stay: commands, all, none\n", c->keep_dead == KEEP_DEAD_ALL ? "all" : c->keep_dead == KEEP_DEAD_NONE ? "none" @@ -1772,6 +1829,7 @@ static const char *const KNOWN_TOP[] = { "double_click_ms", "word_separators", "editor", + "float_shadow", "focus_follows_mouse", "gap", "gap_aspect", @@ -2114,6 +2172,10 @@ static bool load_into(config_t *c, const char *path, int depth, char *err, long v = kdl_arg_int(kdl_child(root, "modal_scrim"), 0, c->modal_scrim); c->modal_scrim = (uint8_t)(v < 0 ? 0 : v > 255 ? 255 : v); } + { + long v = kdl_arg_int(kdl_child(root, "float_shadow"), 0, c->float_shadow); + c->float_shadow = (uint8_t)(v < 0 ? 0 : v > 255 ? 255 : v); + } const char *sh = kdl_arg(kdl_child(root, "shell"), 0, NULL); if (sh) { |
