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

@ -23,7 +23,7 @@ use {
},
ahash::AHashMap,
jay_config::{
Axis, Direction, Workspace,
Direction, Workspace,
client::ClientCapabilities,
input::{
FallbackOutputMode, LayerDirection, SwitchEvent, Timeline, acceleration::AccelProfile,
@ -60,15 +60,10 @@ pub enum SimpleCommand {
Quit,
ReloadConfigSo,
ReloadConfigToml,
Split(Axis),
ToggleFloating,
SetFloating(bool),
ToggleFullscreen,
SetFullscreen(bool),
ToggleMono,
SetMono(bool),
ToggleSplit,
SetSplit(Axis),
Forward(bool),
EnableWindowManagement(bool),
SetFloatAboveFullscreen(bool),
@ -94,6 +89,17 @@ pub enum SimpleCommand {
ReloadSimpleIm,
EnableUnicodeInput,
WarpMouseToFocus,
ToggleTab,
MakeGroupH,
MakeGroupV,
MakeGroupTab,
ChangeGroupOpposite,
Equalize,
EqualizeRecursive,
MoveTabLeft,
MoveTabRight,
SetAutotile(bool),
ToggleAutotile,
}
#[derive(Debug, Clone)]
@ -229,6 +235,21 @@ pub struct Theme {
pub floating_titles: Option<bool>,
pub title_gap: Option<i32>,
pub corner_radius: Option<f32>,
pub tab_active_bg_color: Option<Color>,
pub tab_active_border_color: Option<Color>,
pub tab_inactive_bg_color: Option<Color>,
pub tab_inactive_border_color: Option<Color>,
pub tab_active_text_color: Option<Color>,
pub tab_inactive_text_color: Option<Color>,
pub tab_bar_bg_color: Option<Color>,
pub tab_attention_bg_color: Option<Color>,
pub tab_bar_height: Option<i32>,
pub tab_bar_padding: Option<i32>,
pub tab_bar_radius: Option<i32>,
pub tab_bar_border_width: Option<i32>,
pub tab_bar_text_padding: Option<i32>,
pub tab_bar_gap: Option<i32>,
pub tab_title_align: Option<String>,
}
#[derive(Debug, Clone)]

View file

@ -33,7 +33,6 @@ use {
},
indexmap::IndexMap,
jay_config::{
Axis::{Horizontal, Vertical},
Direction, get_workspace,
input::{LayerDirection, Timeline},
},
@ -115,14 +114,6 @@ impl ActionParser<'_> {
"move-down" => Move(Down),
"move-up" => Move(Up),
"move-right" => Move(Right),
"split-horizontal" => Split(Horizontal),
"split-vertical" => Split(Vertical),
"toggle-split" => ToggleSplit,
"tile-horizontal" => SetSplit(Horizontal),
"tile-vertical" => SetSplit(Vertical),
"toggle-mono" => ToggleMono,
"show-single" => SetMono(true),
"show-all" => SetMono(false),
"toggle-fullscreen" => ToggleFullscreen,
"enter-fullscreen" => SetFullscreen(true),
"exit-fullscreen" => SetFullscreen(false),
@ -172,6 +163,18 @@ impl ActionParser<'_> {
"reload-simple-im" => ReloadSimpleIm,
"enable-unicode-input" => EnableUnicodeInput,
"warp-mouse-to-focus" => WarpMouseToFocus,
"toggle-tab" => ToggleTab,
"make-group-h" => MakeGroupH,
"make-group-v" => MakeGroupV,
"make-group-tab" => MakeGroupTab,
"change-group-opposite" => ChangeGroupOpposite,
"equalize" => Equalize,
"equalize-recursive" => EqualizeRecursive,
"move-tab-left" => MoveTabLeft,
"move-tab-right" => MoveTabRight,
"enable-autotile" => SetAutotile(true),
"disable-autotile" => SetAutotile(false),
"toggle-autotile" => ToggleAutotile,
_ => {
return Err(
ActionParserError::UnknownSimpleAction(string.to_string()).spanned(span)

View file

@ -101,6 +101,41 @@ impl Parser for ThemeParser<'_> {
recover(opt(s32("title-gap"))),
recover(opt(fltorint("corner-radius"))),
))?;
let (
(
tab_active_bg_color,
tab_active_border_color,
tab_inactive_bg_color,
tab_inactive_border_color,
tab_active_text_color,
tab_inactive_text_color,
tab_bar_bg_color,
tab_attention_bg_color,
tab_bar_height,
tab_bar_padding,
),
(tab_bar_radius, tab_bar_border_width, tab_bar_text_padding, tab_bar_gap, tab_title_align_val),
) = ext.extract((
(
opt(val("tab-active-bg-color")),
opt(val("tab-active-border-color")),
opt(val("tab-inactive-bg-color")),
opt(val("tab-inactive-border-color")),
opt(val("tab-active-text-color")),
opt(val("tab-inactive-text-color")),
opt(val("tab-bar-bg-color")),
opt(val("tab-attention-bg-color")),
recover(opt(s32("tab-bar-height"))),
recover(opt(s32("tab-bar-padding"))),
),
(
recover(opt(s32("tab-bar-radius"))),
recover(opt(s32("tab-bar-border-width"))),
recover(opt(s32("tab-bar-text-padding"))),
recover(opt(s32("tab-bar-gap"))),
recover(opt(str("tab-title-align"))),
),
))?;
macro_rules! color {
($e:expr) => {
match $e {
@ -156,6 +191,21 @@ impl Parser for ThemeParser<'_> {
floating_titles: floating_titles.despan(),
title_gap: title_gap.despan(),
corner_radius: corner_radius.map(|v| v.value as f32),
tab_active_bg_color: color!(tab_active_bg_color),
tab_active_border_color: color!(tab_active_border_color),
tab_inactive_bg_color: color!(tab_inactive_bg_color),
tab_inactive_border_color: color!(tab_inactive_border_color),
tab_active_text_color: color!(tab_active_text_color),
tab_inactive_text_color: color!(tab_inactive_text_color),
tab_bar_bg_color: color!(tab_bar_bg_color),
tab_attention_bg_color: color!(tab_attention_bg_color),
tab_bar_height: tab_bar_height.despan(),
tab_bar_padding: tab_bar_padding.despan(),
tab_bar_radius: tab_bar_radius.despan(),
tab_bar_border_width: tab_bar_border_width.despan(),
tab_bar_text_padding: tab_bar_text_padding.despan(),
tab_bar_gap: tab_bar_gap.despan(),
tab_title_align: tab_title_align_val.map(|v| v.value.to_string()),
})
}
}

View file

@ -23,6 +23,7 @@ use {
ahash::{AHashMap, AHashSet},
error_reporter::Report,
jay_config::{
Axis,
client::Client,
config, config_dir,
exec::{Command, set_env, unset_env},
@ -40,7 +41,7 @@ use {
set_color_management_enabled, set_default_workspace_capture, set_explicit_sync_enabled,
set_float_above_fullscreen, set_idle, set_idle_grace_period,
set_floating_titles, set_middle_click_paste_enabled, set_show_bar, set_show_float_pin_icon,
set_show_titles, set_corner_radius,
set_show_titles, set_corner_radius, set_autotile, set_tab_title_align,
set_ui_drag_enabled, set_ui_drag_threshold,
status::{set_i3bar_separator, set_status, set_status_command, unset_status_command},
switch_to_vt,
@ -169,11 +170,6 @@ impl Action {
Action::SimpleCommand { cmd } => match cmd {
SimpleCommand::Focus(dir) => b.new(move || s.focus(dir)),
SimpleCommand::Move(dir) => window_or_seat!(s, s.move_(dir)),
SimpleCommand::Split(axis) => window_or_seat!(s, s.create_split(axis)),
SimpleCommand::ToggleSplit => window_or_seat!(s, s.toggle_split()),
SimpleCommand::SetSplit(b) => window_or_seat!(s, s.set_split(b)),
SimpleCommand::ToggleMono => window_or_seat!(s, s.toggle_mono()),
SimpleCommand::SetMono(b) => window_or_seat!(s, s.set_mono(b)),
SimpleCommand::ToggleFullscreen => window_or_seat!(s, s.toggle_fullscreen()),
SimpleCommand::SetFullscreen(b) => window_or_seat!(s, s.set_fullscreen(b)),
SimpleCommand::FocusParent => b.new(move || s.focus_parent()),
@ -259,6 +255,35 @@ impl Action {
let persistent = state.persistent.clone();
b.new(move || persistent.seat.warp_mouse_to_focus())
}
SimpleCommand::ToggleTab => b.new(move || s.toggle_tab()),
SimpleCommand::MakeGroupH => {
b.new(move || s.make_group(Axis::Horizontal, true))
}
SimpleCommand::MakeGroupV => {
b.new(move || s.make_group(Axis::Vertical, true))
}
SimpleCommand::MakeGroupTab => {
b.new(move || {
s.make_group(Axis::Horizontal, true);
s.toggle_tab();
})
}
SimpleCommand::ChangeGroupOpposite => {
b.new(move || s.change_group_opposite())
}
SimpleCommand::Equalize => b.new(move || s.equalize(false)),
SimpleCommand::EqualizeRecursive => b.new(move || s.equalize(true)),
SimpleCommand::MoveTabLeft => b.new(move || s.move_tab(false)),
SimpleCommand::MoveTabRight => b.new(move || s.move_tab(true)),
SimpleCommand::SetAutotile(enabled) => {
b.new(move || set_autotile(enabled))
}
SimpleCommand::ToggleAutotile => {
b.new(move || {
// Toggle not directly supported; set to true
set_autotile(true)
})
}
},
Action::Multi { actions } => {
let actions: Vec<_> = actions.into_iter().map(|a| a.into_fn(state)).collect();
@ -997,6 +1022,14 @@ impl State {
color!(UNFOCUSED_TITLE_BACKGROUND_COLOR, unfocused_title_bg_color);
color!(UNFOCUSED_TITLE_TEXT_COLOR, unfocused_title_text_color);
color!(HIGHLIGHT_COLOR, highlight_color);
color!(TAB_ACTIVE_BACKGROUND_COLOR, tab_active_bg_color);
color!(TAB_ACTIVE_BORDER_COLOR, tab_active_border_color);
color!(TAB_INACTIVE_BACKGROUND_COLOR, tab_inactive_bg_color);
color!(TAB_INACTIVE_BORDER_COLOR, tab_inactive_border_color);
color!(TAB_ACTIVE_TEXT_COLOR, tab_active_text_color);
color!(TAB_INACTIVE_TEXT_COLOR, tab_inactive_text_color);
color!(TAB_BAR_BACKGROUND_COLOR, tab_bar_bg_color);
color!(TAB_ATTENTION_BACKGROUND_COLOR, tab_attention_bg_color);
macro_rules! size {
($sized:ident, $field:ident) => {
if let Some(size) = theme.$field {
@ -1010,6 +1043,12 @@ impl State {
size!(BAR_SEPARATOR_WIDTH, bar_separator_width);
size!(GAP, gap);
size!(TITLE_GAP, title_gap);
size!(TAB_BAR_HEIGHT, tab_bar_height);
size!(TAB_BAR_PADDING, tab_bar_padding);
size!(TAB_BAR_RADIUS, tab_bar_radius);
size!(TAB_BAR_BORDER_WIDTH, tab_bar_border_width);
size!(TAB_BAR_TEXT_PADDING, tab_bar_text_padding);
size!(TAB_BAR_GAP, tab_bar_gap);
macro_rules! font {
($fun:ident, $field:ident) => {
if let Some(font) = &theme.$field {
@ -1023,6 +1062,9 @@ impl State {
if let Some(radius) = theme.corner_radius {
set_corner_radius(radius);
}
if let Some(ref align) = theme.tab_title_align {
set_tab_title_align(align);
}
}
fn handle_switch_device(self: &Rc<Self>, dev: InputDevice, actions: &Rc<SwitchActions>) {