1
0
Fork 0
forked from wry/wry

feat: add alternating autotiling

This commit is contained in:
atagen 2026-05-31 17:16:44 +10:00
parent ce14169d6b
commit 5c2f631fdb
17 changed files with 244 additions and 59 deletions

View file

@ -600,6 +600,14 @@ pub struct Config {
pub simple_im: Option<SimpleIm>,
pub fallback_output_mode: Option<FallbackOutputMode>,
pub mouse_follows_focus: Option<bool>,
pub scratchpads: Vec<Scratchpad>,
pub autotile: Option<bool>,
}
#[derive(Debug, Clone)]
pub struct Scratchpad {
pub name: String,
pub exec: Option<Exec>,
}
#[derive(Debug, Error)]

View file

@ -156,6 +156,7 @@ impl Parser for ConfigParser<'_> {
mouse_follows_focus,
animations_val,
),
(scratchpads_val, autotile),
) = ext.extract((
(
opt(val("keymap")),
@ -217,6 +218,7 @@ impl Parser for ConfigParser<'_> {
recover(opt(bol("unstable-mouse-follows-focus"))),
opt(val("animations")),
),
(opt(val("scratchpads")), recover(opt(bol("autotile")))),
))?;
let mut keymap = None;
if let Some(value) = keymap_val {
@ -618,6 +620,8 @@ impl Parser for ConfigParser<'_> {
simple_im,
fallback_output_mode,
mouse_follows_focus: mouse_follows_focus.despan(),
scratchpads,
autotile: autotile.despan(),
})
}
}

View file

@ -27,7 +27,7 @@ use {
client::Client,
config, config_dir,
exec::{Command, set_env, unset_env},
get_workspace,
get_autotile, get_workspace,
input::{
FocusFollowsMouseMode, InputDevice, Seat, SwitchEvent, capability::CAP_SWITCH,
get_seat, input_devices, on_input_device_removed, on_new_input_device,
@ -40,11 +40,10 @@ use {
on_devices_enumerated, on_idle, on_unload, quit, reload, set_animation_cubic_bezier,
set_animation_curve, set_animation_duration_ms, set_animation_style,
set_animations_enabled, set_autotile, set_color_management_enabled, set_corner_radius,
set_default_workspace_capture,
set_explicit_sync_enabled, set_float_above_fullscreen, set_floating_titles, set_idle,
set_idle_grace_period, set_middle_click_paste_enabled, set_show_bar,
set_show_float_pin_icon, set_show_titles, set_tab_title_align, set_ui_drag_enabled,
set_ui_drag_threshold,
set_default_workspace_capture, set_explicit_sync_enabled, set_float_above_fullscreen,
set_floating_titles, set_idle, set_idle_grace_period, set_middle_click_paste_enabled,
set_show_bar, set_show_float_pin_icon, set_show_titles, 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,
tasks::{self, JoinHandle},
@ -270,12 +269,7 @@ impl Action {
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)
})
}
SimpleCommand::ToggleAutotile => b.new(move || set_autotile(!get_autotile())),
},
Action::Multi { actions } => {
let actions: Vec<_> = actions.into_iter().map(|a| a.into_fn(state)).collect();
@ -1747,6 +1741,9 @@ fn load_config(initial_load: bool, auto_reload: bool, persistent: &Rc<Persistent
.seat
.unstable_set_mouse_follows_focus(mouse_follows_focus);
}
if let Some(v) = config.autotile {
set_autotile(v);
}
}
fn create_command(exec: &Exec) -> Command {