Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add smart window gaps feature #748

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cosmic-comp-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ pub struct CosmicCompConfig {
pub focus_follows_cursor_delay: u64,
/// Let X11 applications scale themselves
pub descale_xwayland: bool,
/// Smart gaps enabled
pub smart_gaps: bool,
}

impl Default for CosmicCompConfig {
Expand Down Expand Up @@ -60,6 +62,7 @@ impl Default for CosmicCompConfig {
cursor_follows_focus: false,
focus_follows_cursor_delay: 250,
descale_xwayland: false,
smart_gaps: Default::default(),
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,13 @@ fn config_changed(config: cosmic_config::Config, keys: Vec<String>, state: &mut
state.common.config.cosmic_conf.focus_follows_cursor_delay = new;
}
}
"smart_gaps" => {
let new = get_config::<bool>(&config, "smart_gaps");
if new != state.common.config.cosmic_conf.smart_gaps {
state.common.config.cosmic_conf.smart_gaps = new;
state.common.update_config();
}
}
_ => {}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/shell/layout/tiling/grabs/resize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ impl ResizeForkGrab {
let mut shell = data.common.shell.write().unwrap();
let tiling_layer = &mut shell.active_space_mut(&output).tiling_layer;
let gaps = tiling_layer.gaps();
let is_smart_gaps = data.common.config.cosmic_conf.smart_gaps;

let tree = &mut tiling_layer.queue.trees.back_mut().unwrap().0;
match &mut self.old_tree {
Expand Down Expand Up @@ -317,7 +318,7 @@ impl ResizeForkGrab {
}

self.last_loc = location.as_global();
let blocker = TilingLayout::update_positions(&output, tree, gaps);
let blocker = TilingLayout::update_positions(&output, tree, gaps, is_smart_gaps);
tiling_layer.pending_blockers.extend(blocker);
} else {
return true;
Expand Down
Loading
Loading