1
0
Fork 0
forked from wry/wry

all: add support for hy3 like tiling

This commit is contained in:
kossLAN 2026-04-10 13:16:35 -04:00
parent a41dbae899
commit cea4187fc0
No known key found for this signature in database
21 changed files with 1237 additions and 48 deletions

View file

@ -2035,6 +2035,42 @@ impl ConfigClient {
radius
}
pub fn seat_toggle_expand(&self, seat: Seat) {
self.send(&ClientMessage::SeatToggleExpand { seat });
}
pub fn seat_toggle_tab(&self, seat: Seat) {
self.send(&ClientMessage::SeatToggleTab { seat });
}
pub fn seat_make_group(&self, seat: Seat, axis: Axis, ephemeral: bool) {
self.send(&ClientMessage::SeatMakeGroup {
seat,
axis,
ephemeral,
});
}
pub fn seat_change_group_opposite(&self, seat: Seat) {
self.send(&ClientMessage::SeatChangeGroupOpposite { seat });
}
pub fn seat_equalize(&self, seat: Seat, recursive: bool) {
self.send(&ClientMessage::SeatEqualize { seat, recursive });
}
pub fn set_autotile(&self, enabled: bool) {
self.send(&ClientMessage::SetAutotile { enabled });
}
pub fn set_tab_title_align(&self, align: u32) {
self.send(&ClientMessage::SetTabTitleAlign { align });
}
pub fn seat_move_tab(&self, seat: Seat, right: bool) {
self.send(&ClientMessage::SeatMoveTab { seat, right });
}
fn handle_msg(&self, msg: &[u8]) {
self.handle_msg2(msg);
self.dispatch_futures();

View file

@ -884,6 +884,34 @@ pub enum ClientMessage<'a> {
radius: f32,
},
GetCornerRadius,
SeatToggleExpand {
seat: Seat,
},
SeatToggleTab {
seat: Seat,
},
SeatMakeGroup {
seat: Seat,
axis: Axis,
ephemeral: bool,
},
SeatChangeGroupOpposite {
seat: Seat,
},
SeatEqualize {
seat: Seat,
recursive: bool,
},
SetAutotile {
enabled: bool,
},
SetTabTitleAlign {
align: u32,
},
SeatMoveTab {
seat: Seat,
right: bool,
},
}
#[derive(Serialize, Deserialize, Debug)]

View file

@ -677,6 +677,33 @@ impl Seat {
pub fn unstable_set_mouse_follows_focus(self, enabled: bool) {
get!().seat_set_mouse_follows_focus(self, enabled)
}
/// Toggles tabbed mode on the focused window's parent container.
pub fn toggle_tab(self) {
get!().seat_toggle_tab(self)
}
/// Wraps the focused child in a new sub-container with the given split axis.
pub fn make_group(self, axis: Axis, ephemeral: bool) {
get!().seat_make_group(self, axis, ephemeral)
}
/// Toggles the parent container's split direction (H↔V).
pub fn change_group_opposite(self) {
get!().seat_change_group_opposite(self)
}
/// Resets all siblings' size factors to equal.
pub fn equalize(self, recursive: bool) {
get!().seat_equalize(self, recursive)
}
/// Move the active tab left or right within the current tab bar.
///
/// Equivalent to hy3's `movewindow` within a tabbed group.
pub fn move_tab(self, right: bool) {
get!().seat_move_tab(self, right)
}
}
/// A focus-follows-mouse mode.

View file

@ -394,6 +394,30 @@ pub fn get_corner_radius() -> f32 {
get!(0.0).get_corner_radius()
}
/// Enables or disables autotiling.
///
/// When enabled, new windows are automatically placed in a perpendicular
/// sub-container if the predicted body would be narrower than tall (or vice versa).
///
/// The default is `false`.
pub fn set_autotile(enabled: bool) {
get!().set_autotile(enabled)
}
/// Sets the horizontal alignment of title text within tab buttons.
///
/// - `"start"` — left-aligned (default)
/// - `"center"` — centered
/// - `"end"` — right-aligned
pub fn set_tab_title_align(align: &str) {
let val = match align {
"center" => 1,
"end" => 2,
_ => 0, // start
};
get!().set_tab_title_align(val)
}
/// Sets a callback to run when this config is unloaded.
///
/// Only one callback can be set at a time. If another callback is already set, it will be

View file

@ -302,6 +302,38 @@ pub mod colors {
///
/// Default: `#9d28c67f`.
const 15 => HIGHLIGHT_COLOR,
/// The background color of an active (focused) tab.
///
/// Default: `#33ccff40`.
const 16 => TAB_ACTIVE_BACKGROUND_COLOR,
/// The border color of an active (focused) tab.
///
/// Default: `#33ccffee`.
const 17 => TAB_ACTIVE_BORDER_COLOR,
/// The background color of an inactive tab.
///
/// Default: `#222222`.
const 18 => TAB_INACTIVE_BACKGROUND_COLOR,
/// The border color of an inactive tab.
///
/// Default: `#333333`.
const 19 => TAB_INACTIVE_BORDER_COLOR,
/// The text color of an active (focused) tab.
///
/// Default: `#ffffff`.
const 20 => TAB_ACTIVE_TEXT_COLOR,
/// The text color of an inactive tab.
///
/// Default: `#888888`.
const 21 => TAB_INACTIVE_TEXT_COLOR,
/// The background color of the tab bar strip.
///
/// Default: `#111111`.
const 22 => TAB_BAR_BACKGROUND_COLOR,
/// The background color of a tab that has requested attention.
///
/// Default: `#23092c`.
const 23 => TAB_ATTENTION_BACKGROUND_COLOR,
}
/// Sets the color of GUI element.
@ -374,5 +406,29 @@ pub mod sized {
///
/// Default: 0
const 06 => TITLE_GAP,
/// The height of the tab bar in pixels.
///
/// Default: 22
const 07 => TAB_BAR_HEIGHT,
/// The padding between tabs in the tab bar in pixels.
///
/// Default: 6
const 08 => TAB_BAR_PADDING,
/// The corner radius of tabs in the tab bar in pixels.
///
/// Default: 6
const 09 => TAB_BAR_RADIUS,
/// The border width of tabs in the tab bar in pixels.
///
/// Default: 2
const 10 => TAB_BAR_BORDER_WIDTH,
/// The horizontal padding within each tab for text in pixels.
///
/// Default: 4
const 11 => TAB_BAR_TEXT_PADDING,
/// The gap between the tab bar and the window content below in pixels.
///
/// Default: 4
const 12 => TAB_BAR_GAP,
}
}