mirror of
https://github.com/outbackdingo/hyprcosmic-comp.git
synced 2026-08-25 14:53:22 +00:00
Patch C: open a new window beside the focused one, not inside it
COSMIC's tiling tree is already N-ary -- `Data::Group` holds a `sizes: Vec<i32>` and `add_window` divides by `sizes.len() + 1`, so three panes in a row is perfectly representable. You just cannot get there by opening windows. `map_to_tree` always wraps the focused window in a *new* group whose orientation comes from that window's aspect ratio, so the second window splits the screen into two columns, and the third one -- opening into a column that is now taller than wide -- splits that column horizontally. Quadrants. The limit was the insertion rule, not the shape of the tree. `preserve_split` makes the new window join the group the focused window is already in, at the index right after it, keeping that group's direction. Three windows land as three panes in a row, which is what Hyprland's dwindle layout does with the option of the same name. The insert is `move_current_node`'s idiom, minus the move: children and `sizes` are positional, so the node goes in at `idx + 1` and `add_window(idx + 1)` puts the size at the matching slot. Get those out of step and every window in the group draws one slot over. Off by default, so an unconfigured build still lays out like COSMIC. HyprCosmic turns it on in cosmic.conf. It only affects where the next window is inserted, never existing windows, so the config watcher just pushes the flag down through `update_config` -- there is nothing to retile.
This commit is contained in:
@@ -83,6 +83,19 @@ pub struct CosmicCompConfig {
|
||||
/// If set to Global, autotile applies to all windows in all workspaces
|
||||
/// If set to PerWorkspace, autotile only applies to new windows, and new workspaces
|
||||
pub autotile_behavior: TileBehavior,
|
||||
/// Keep a group's split direction when a new window opens into it
|
||||
///
|
||||
/// Normally a new window *splits the focused window*: it is wrapped in a
|
||||
/// fresh group whose direction is taken from that window's aspect ratio.
|
||||
/// Two windows side by side are each taller than wide, so a third one
|
||||
/// splits a column in half and you get quadrants -- three panes in a row
|
||||
/// is not reachable by opening windows at all.
|
||||
///
|
||||
/// With this set the new window joins the group the focused window is
|
||||
/// already in, keeping that group's direction, so three windows land as
|
||||
/// three panes in a row. Named after Hyprland's `dwindle:preserve_split`,
|
||||
/// which does the same thing.
|
||||
pub preserve_split: bool,
|
||||
/// Active hint enabled
|
||||
pub active_hint: bool,
|
||||
/// Enables changing keyboard focus to windows when the cursor passes into them
|
||||
@@ -129,6 +142,8 @@ impl Default for CosmicCompConfig {
|
||||
keyboard_config: Default::default(),
|
||||
autotile: Default::default(),
|
||||
autotile_behavior: Default::default(),
|
||||
// Off, so the fork's default layout is still COSMIC's.
|
||||
preserve_split: false,
|
||||
active_hint: true,
|
||||
focus_follows_cursor: false,
|
||||
cursor_follows_focus: false,
|
||||
|
||||
Reference in New Issue
Block a user