mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2024-12-27 21:58:18 +01:00
Toggle tags on windows correctly
This commit is contained in:
parent
b67867c066
commit
5b116c68be
2 changed files with 8 additions and 17 deletions
|
@ -1454,18 +1454,24 @@ impl pinnacle_api_defs::pinnacle::window::v0alpha1::window_service_server::Windo
|
||||||
let Some(tag) = tag_id.tag(state) else { return };
|
let Some(tag) = tag_id.tag(state) else { return };
|
||||||
|
|
||||||
// TODO: turn state.tags into a hashset
|
// TODO: turn state.tags into a hashset
|
||||||
window.with_state(|state| state.tags.retain(|tg| tg != &tag));
|
|
||||||
match set_or_toggle {
|
match set_or_toggle {
|
||||||
Some(set) => {
|
Some(set) => {
|
||||||
if set {
|
if set {
|
||||||
window.with_state(|state| {
|
window.with_state(|state| {
|
||||||
|
state.tags.retain(|tg| tg != &tag);
|
||||||
state.tags.push(tag.clone());
|
state.tags.push(tag.clone());
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
window.with_state(|state| {
|
||||||
|
state.tags.retain(|tg| tg != &tag);
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => window.with_state(|state| {
|
None => window.with_state(|state| {
|
||||||
if !state.tags.contains(&tag) {
|
if !state.tags.contains(&tag) {
|
||||||
state.tags.push(tag.clone());
|
state.tags.push(tag.clone());
|
||||||
|
} else {
|
||||||
|
state.tags.retain(|tg| tg != &tag);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
17
src/state.rs
17
src/state.rs
|
@ -1,28 +1,13 @@
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
api::{
|
api::{msg::Msg, ApiState},
|
||||||
msg::Msg,
|
|
||||||
protocol::{
|
|
||||||
InputService, OutputService, PinnacleService, ProcessService, TagService, WindowService,
|
|
||||||
},
|
|
||||||
ApiState,
|
|
||||||
},
|
|
||||||
backend::Backend,
|
backend::Backend,
|
||||||
config::Config,
|
config::Config,
|
||||||
cursor::Cursor,
|
cursor::Cursor,
|
||||||
focus::FocusState,
|
focus::FocusState,
|
||||||
grab::resize_grab::ResizeSurfaceState,
|
grab::resize_grab::ResizeSurfaceState,
|
||||||
window::WindowElement,
|
window::WindowElement,
|
||||||
XDG_BASE_DIRS,
|
|
||||||
};
|
|
||||||
use pinnacle_api_defs::pinnacle::v0alpha1::pinnacle_service_server::PinnacleServiceServer;
|
|
||||||
use pinnacle_api_defs::pinnacle::{
|
|
||||||
input::v0alpha1::input_service_server::InputServiceServer,
|
|
||||||
output::v0alpha1::output_service_server::OutputServiceServer,
|
|
||||||
process::v0alpha1::process_service_server::ProcessServiceServer,
|
|
||||||
tag::v0alpha1::tag_service_server::TagServiceServer,
|
|
||||||
window::v0alpha1::window_service_server::WindowServiceServer,
|
|
||||||
};
|
};
|
||||||
use smithay::{
|
use smithay::{
|
||||||
desktop::{PopupManager, Space},
|
desktop::{PopupManager, Space},
|
||||||
|
|
Loading…
Reference in a new issue