feat(workspaces): add workspace wrapping toggle

This commit is contained in:
Oleksiy Buell 2026-04-20 09:14:37 -04:00 committed by GitHub
parent d0fa882596
commit c06b184ecf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 30 additions and 0 deletions

View file

@ -20,6 +20,7 @@ pub enum Message {
SetActionOnTyping(usize),
SetWorkspaceMode(WorkspaceMode),
SetWorkspaceLayout(WorkspaceLayout),
SetWorkspaceWraparound(bool),
SetShowName(bool),
SetShowNumber(bool),
Surface(surface::Action),
@ -87,6 +88,7 @@ impl page::Page<crate::pages::Message> for Page {
sections.insert(action_on_typing()),
sections.insert(multi_behavior()),
sections.insert(workspace_orientation()),
sections.insert(workspace_navigation()),
])
}
@ -125,6 +127,10 @@ impl Page {
into_active_selection(&self.comp_workspace_config.action_on_typing);
self.save_comp_config();
}
Message::SetWorkspaceWraparound(value) => {
self.comp_workspace_config.workspace_wraparound = value;
self.save_comp_config();
}
Message::SetShowName(value) => {
self.show_workspace_name = value;
if let Err(err) = self.config.set("show_workspace_name", value) {
@ -250,3 +256,24 @@ fn workspace_orientation() -> Section<crate::pages::Message> {
.map(crate::pages::Message::DesktopWorkspaces)
})
}
fn workspace_navigation() -> Section<crate::pages::Message> {
crate::slab!(descriptions {
description = fl!("workspaces-navigation", "wraparound");
});
Section::default()
.title(fl!("workspaces-navigation"))
.descriptions(descriptions)
.view::<Page>(move |_binder, page, section| {
let descriptions = &section.descriptions;
settings::section()
.title(&section.title)
.add(settings::item::builder(&descriptions[description]).toggler(
page.comp_workspace_config.workspace_wraparound,
Message::SetWorkspaceWraparound,
))
.apply(Element::from)
.map(crate::pages::Message::DesktopWorkspaces)
})
}

View file

@ -521,6 +521,9 @@ workspaces-orientation = Workspaces orientation
hot-corner = Hot Corner
.top-left-corner = Enable top-left hot corner for Workspaces
workspaces-navigation = Navigation
.wraparound = Move between first and last workspace using keyboard shortcuts and gestures
## Displays
-requires-restart = Requires restart