Merge pull request #31 from Quackdoc/tiling-toggle

Add a toggle to enable/disable tiling windows by default
This commit is contained in:
Victoria Brekenfeld 2022-08-10 05:35:34 -06:00 committed by GitHub
commit a8fa068f2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View file

@ -53,4 +53,5 @@
(modifiers: [], key: "XF86MonBrightnessDown"): Spawn("busctl --user call com.system76.CosmicSettingsDaemon /com/system76/CosmicSettingsDaemon com.system76.CosmicSettingsDaemon DecreaseDisplayBrightness"), (modifiers: [], key: "XF86MonBrightnessDown"): Spawn("busctl --user call com.system76.CosmicSettingsDaemon /com/system76/CosmicSettingsDaemon com.system76.CosmicSettingsDaemon DecreaseDisplayBrightness"),
}, },
workspace_mode: OutputBound, workspace_mode: OutputBound,
floating_default: false,
) )

View file

@ -34,6 +34,7 @@ pub struct Config {
pub struct StaticConfig { pub struct StaticConfig {
pub key_bindings: HashMap<KeyPattern, Action>, pub key_bindings: HashMap<KeyPattern, Action>,
pub workspace_mode: WorkspaceMode, pub workspace_mode: WorkspaceMode,
pub floating_default: bool,
} }
#[derive(Debug, Deserialize, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Deserialize, Clone, Copy, PartialEq, Eq)]
@ -216,6 +217,7 @@ impl Config {
StaticConfig { StaticConfig {
key_bindings: HashMap::new(), key_bindings: HashMap::new(),
workspace_mode: WorkspaceMode::Global, workspace_mode: WorkspaceMode::Global,
floating_default: false,
} }
} }

View file

@ -47,7 +47,7 @@ pub struct Shell {
pub outputs: Vec<Output>, pub outputs: Vec<Output>,
pub workspace_mode: WorkspaceMode, pub workspace_mode: WorkspaceMode,
pub shell_mode: ShellMode, pub shell_mode: ShellMode,
pub floating_default: bool,
pub pending_windows: Vec<(Window, Seat<State>)>, pub pending_windows: Vec<(Window, Seat<State>)>,
pub pending_layers: Vec<(LayerSurface, Output, Seat<State>)>, pub pending_layers: Vec<(LayerSurface, Output, Seat<State>)>,
@ -120,12 +120,14 @@ impl Shell {
&mut workspace_state, &mut workspace_state,
&mut spaces, &mut spaces,
); );
let floating_default = config.static_conf.floating_default;
Shell { Shell {
popups: PopupManager::new(None), popups: PopupManager::new(None),
spaces, spaces,
outputs: Vec::new(), outputs: Vec::new(),
workspace_mode: mode, workspace_mode: mode,
floating_default,
shell_mode: ShellMode::Normal, shell_mode: ShellMode::Normal,
pending_windows: Vec::new(), pending_windows: Vec::new(),
@ -592,7 +594,7 @@ impl Shell {
.toplevel_enter_workspace(&window, &workspace.handle); .toplevel_enter_workspace(&window, &workspace.handle);
self.toplevel_info_state self.toplevel_info_state
.toplevel_enter_output(&window, &output); .toplevel_enter_output(&window, &output);
if layout::should_be_floating(&window) { if layout::should_be_floating(&window) || self.floating_default {
workspace workspace
.floating_layer .floating_layer
.map_window(&mut workspace.space, window, &seat, None); .map_window(&mut workspace.space, window, &seat, None);