Skip to content

Commit

Permalink
feat: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-berger committed Dec 2, 2024
1 parent b40ea5e commit 1baba07
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
1 change: 1 addition & 0 deletions packages/wm/src/cleanup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub fn run_cleanup(managed_windows: Vec<NativeWindow>) {
warn!("Failed to show window: {:?}", err);
}

_ = window.set_taskbar_visibility(true);
_ = window.set_border_color(None);
}
}
22 changes: 12 additions & 10 deletions packages/wm/src/common/commands/platform_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ use crate::{
Container, WindowContainer,
},
user_config::{
CornerStyle, CursorJumpTrigger, UserConfig, WindowEffectConfig,
CornerStyle, CursorJumpTrigger, HideMethod, UserConfig,
WindowEffectConfig,
},
windows::traits::WindowGetters,
wm_event::WmEvent,
Expand Down Expand Up @@ -154,16 +155,17 @@ fn redraw_containers(
warn!("Failed to set window position: {}", err);
}

let taskbar_visibility = if config.value.general.show_all_in_taskbar {
true
} else {
is_visible
};

if let Err(err) =
window.native().set_taskbar_visibility(taskbar_visibility)
// Skip setting taskbar visibility if the window is hidden (has no
// effect). Since cloaked windows are normally always visible in the
// taskbar, we only need to set visibility if `show_all_in_taskbar` is
// `false`.
if config.value.general.hide_method == HideMethod::Cloak
&& !config.value.general.show_all_in_taskbar
{
warn!("Failed to set taskbar visibility: {}", err);
if let Err(err) = window.native().set_taskbar_visibility(is_visible)
{
warn!("Failed to set taskbar visibility: {}", err);
}
}
}

Expand Down
13 changes: 12 additions & 1 deletion packages/wm/src/common/commands/reload_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,24 @@ pub fn reload_config(

// Ensure all windows are shown when hide method is changed.
if old_config.general.hide_method != config.value.general.hide_method
&& old_config.general.hide_method == HideMethod::Hide
&& config.value.general.hide_method == HideMethod::Cloak
{
for window in state.windows() {
let _ = window.native().show();
}
}

// Ensure all windows are shown in taskbar when `show_all_in_taskbar` is
// changed.
if old_config.general.show_all_in_taskbar
!= config.value.general.show_all_in_taskbar
&& config.value.general.show_all_in_taskbar
{
for window in state.windows() {
let _ = window.native().set_taskbar_visibility(true);
}
}

// Clear active binding modes.
state.binding_modes = Vec::new();

Expand Down
3 changes: 2 additions & 1 deletion resources/assets/sample-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ general:
# but has stability issues with some apps.
hide_method: 'cloak'

# Affects which windows get shown in the native Windows taskbar.
# Affects which windows get shown in the native Windows taskbar. Has no
# effect if `hide_method: 'hide'`.
# - 'true': Show all windows (regardless of workspace).
# - 'false': Only show windows from the currently shown workspaces.
show_all_in_taskbar: false
Expand Down

0 comments on commit 1baba07

Please sign in to comment.