Inhibit workspace animations when workspaces view is open
Fixes https://github.com/pop-os/cosmic-workspaces-epoch/issues/27. We want this to apply to changes to workspace either through keybindings or the cosmic-workspaces UI, so it adding a check here seems reasonable. In principle it could be good to have some kind of privileged protocol for setting things like this. We may also want a configuration option to disable animations at some point.
This commit is contained in:
parent
94fecec9cb
commit
31358d1993
1 changed files with 13 additions and 3 deletions
|
|
@ -55,8 +55,8 @@ use crate::{
|
||||||
utils::prelude::*,
|
utils::prelude::*,
|
||||||
wayland::{
|
wayland::{
|
||||||
handlers::{
|
handlers::{
|
||||||
toplevel_management::minimize_rectangle, xdg_activation::ActivationContext,
|
screencopy::WORKSPACE_OVERVIEW_NAMESPACE, toplevel_management::minimize_rectangle,
|
||||||
xdg_shell::popup::get_popup_toplevel,
|
xdg_activation::ActivationContext, xdg_shell::popup::get_popup_toplevel,
|
||||||
},
|
},
|
||||||
protocols::{
|
protocols::{
|
||||||
toplevel_info::{
|
toplevel_info::{
|
||||||
|
|
@ -454,13 +454,23 @@ impl WorkspaceSet {
|
||||||
return Err(InvalidWorkspaceIndex);
|
return Err(InvalidWorkspaceIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Animate if workspaces overview isn't open
|
||||||
|
let layer_map = layer_map_for_output(&self.output);
|
||||||
|
let animate = !layer_map
|
||||||
|
.layers()
|
||||||
|
.any(|l| l.namespace() == WORKSPACE_OVERVIEW_NAMESPACE);
|
||||||
|
|
||||||
if self.active != idx {
|
if self.active != idx {
|
||||||
let old_active = self.active;
|
let old_active = self.active;
|
||||||
state.remove_workspace_state(&self.workspaces[old_active].handle, WState::Active);
|
state.remove_workspace_state(&self.workspaces[old_active].handle, WState::Active);
|
||||||
state.remove_workspace_state(&self.workspaces[old_active].handle, WState::Urgent);
|
state.remove_workspace_state(&self.workspaces[old_active].handle, WState::Urgent);
|
||||||
state.remove_workspace_state(&self.workspaces[idx].handle, WState::Urgent);
|
state.remove_workspace_state(&self.workspaces[idx].handle, WState::Urgent);
|
||||||
state.add_workspace_state(&self.workspaces[idx].handle, WState::Active);
|
state.add_workspace_state(&self.workspaces[idx].handle, WState::Active);
|
||||||
self.previously_active = Some((old_active, workspace_delta));
|
self.previously_active = if animate {
|
||||||
|
Some((old_active, workspace_delta))
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
self.active = idx;
|
self.active = idx;
|
||||||
Ok(true)
|
Ok(true)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue