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

@ -454,6 +454,14 @@ colors! {
bar_text = (0xff, 0xff, 0xff),
attention_requested_background = (0x23, 0x09, 0x2c),
highlight = (0x9d, 0x28, 0xc6, 0x7f),
tab_active_background = (0x4c, 0x78, 0x99),
tab_active_border = (0x28, 0x55, 0x77),
tab_inactive_background = (0x22, 0x22, 0x22),
tab_inactive_border = (0x33, 0x33, 0x33),
tab_active_text = (0xff, 0xff, 0xff),
tab_inactive_text = (0x88, 0x88, 0x88),
tab_bar_background = (0x00, 0x00, 0x00, 0x00),
tab_attention_background = (0x23, 0x09, 0x2c),
}
impl StaticText for ThemeColor {
@ -476,6 +484,14 @@ impl StaticText for ThemeColor {
ThemeColor::bar_text => "Bar Text",
ThemeColor::attention_requested_background => "Attention Requested",
ThemeColor::highlight => "Highlight",
ThemeColor::tab_active_background => "Tab Background (active)",
ThemeColor::tab_active_border => "Tab Border (active)",
ThemeColor::tab_inactive_background => "Tab Background (inactive)",
ThemeColor::tab_inactive_border => "Tab Border (inactive)",
ThemeColor::tab_active_text => "Tab Text (active)",
ThemeColor::tab_inactive_text => "Tab Text (inactive)",
ThemeColor::tab_bar_background => "Tab Bar Background",
ThemeColor::tab_attention_background => "Tab Attention Background",
}
}
}
@ -588,6 +604,12 @@ sizes! {
bar_separator_width = (0, 1000, 1),
gap = (0, 1000, 0),
title_gap = (0, 1000, 5),
tab_bar_height = (0, 1000, 22),
tab_bar_padding = (0, 1000, 6),
tab_bar_radius = (0, 1000, 6),
tab_bar_border_width = (0, 1000, 2),
tab_bar_text_padding = (0, 1000, 4),
tab_bar_gap = (0, 1000, 4),
}
impl StaticText for ThemeSized {
@ -599,6 +621,12 @@ impl StaticText for ThemeSized {
ThemeSized::bar_separator_width => "Bar Separator Width",
ThemeSized::gap => "Gap",
ThemeSized::title_gap => "Title Gap",
ThemeSized::tab_bar_height => "Tab Bar Height",
ThemeSized::tab_bar_padding => "Tab Bar Padding",
ThemeSized::tab_bar_radius => "Tab Bar Radius",
ThemeSized::tab_bar_border_width => "Tab Bar Border Width",
ThemeSized::tab_bar_text_padding => "Tab Bar Text Padding",
ThemeSized::tab_bar_gap => "Tab Bar Gap",
}
}
}
@ -732,6 +760,15 @@ impl CornerRadius {
}
}
/// Horizontal alignment of title text inside tab buttons.
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
pub enum TabTitleAlign {
#[default]
Start,
Center,
End,
}
pub struct Theme {
pub colors: ThemeColors,
pub sizes: ThemeSizes,
@ -745,6 +782,8 @@ pub struct Theme {
pub floating_titles: Cell<bool>,
pub bar_position: Cell<BarPosition>,
pub corner_radius: Cell<CornerRadius>,
pub autotile_enabled: Cell<bool>,
pub tab_title_align: Cell<TabTitleAlign>,
}
impl Default for Theme {
@ -761,6 +800,8 @@ impl Default for Theme {
floating_titles: Cell::new(false),
bar_position: Default::default(),
corner_radius: Cell::new(CornerRadius::default()),
autotile_enabled: Cell::new(false),
tab_title_align: Cell::new(TabTitleAlign::default()),
}
}
}
@ -770,6 +811,10 @@ impl Theme {
self.bar_font.get().unwrap_or_else(|| self.font.get())
}
pub fn title_font(&self) -> Arc<String> {
self.title_font.get().unwrap_or_else(|| self.font.get())
}
pub fn title_height(&self) -> i32 {
0
}