feat(shortcuts): add option to disable the default super key action
This commit is contained in:
parent
2705479ccb
commit
df43c94683
2 changed files with 11 additions and 6 deletions
|
|
@ -54,6 +54,7 @@ impl Default for Page {
|
||||||
fl!("super-key", "launcher"),
|
fl!("super-key", "launcher"),
|
||||||
fl!("super-key", "workspaces"),
|
fl!("super-key", "workspaces"),
|
||||||
fl!("super-key", "applications"),
|
fl!("super-key", "applications"),
|
||||||
|
fl!("super-key", "disable"),
|
||||||
],
|
],
|
||||||
super_key_active: super_key_active_config(),
|
super_key_active: super_key_active_config(),
|
||||||
comp_config,
|
comp_config,
|
||||||
|
|
@ -68,9 +69,10 @@ impl Page {
|
||||||
match message {
|
match message {
|
||||||
Message::SuperKey(id) => {
|
Message::SuperKey(id) => {
|
||||||
let action = match id {
|
let action = match id {
|
||||||
0 => shortcuts::action::System::Launcher,
|
0 => Some(shortcuts::action::System::Launcher),
|
||||||
1 => shortcuts::action::System::WorkspaceOverview,
|
1 => Some(shortcuts::action::System::WorkspaceOverview),
|
||||||
2 => shortcuts::action::System::AppLibrary,
|
2 => Some(shortcuts::action::System::AppLibrary),
|
||||||
|
3 => None,
|
||||||
_ => return,
|
_ => return,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -131,6 +133,7 @@ pub fn super_key_action() -> Section<crate::pages::Message> {
|
||||||
let _launcher = descriptions.insert(fl!("super-key", "launcher"));
|
let _launcher = descriptions.insert(fl!("super-key", "launcher"));
|
||||||
let _workspaces = descriptions.insert(fl!("super-key", "workspaces"));
|
let _workspaces = descriptions.insert(fl!("super-key", "workspaces"));
|
||||||
let _applications = descriptions.insert(fl!("super-key", "applications"));
|
let _applications = descriptions.insert(fl!("super-key", "applications"));
|
||||||
|
let _disable = descriptions.insert(fl!("super-key", "disable"));
|
||||||
|
|
||||||
Section::default()
|
Section::default()
|
||||||
.descriptions(descriptions)
|
.descriptions(descriptions)
|
||||||
|
|
@ -240,16 +243,17 @@ fn super_key_active_config() -> Option<usize> {
|
||||||
new_id
|
new_id
|
||||||
}
|
}
|
||||||
|
|
||||||
fn super_key_set(action: shortcuts::action::System) {
|
fn super_key_set(action: Option<shortcuts::action::System>) {
|
||||||
let Ok(config) = shortcuts::context() else {
|
let Ok(config) = shortcuts::context() else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut shortcuts = config.get::<Shortcuts>("custom").unwrap_or_default();
|
let mut shortcuts = config.get::<Shortcuts>("custom").unwrap_or_default();
|
||||||
|
let action = action.map(Action::System).unwrap_or(Action::Disable);
|
||||||
|
|
||||||
shortcuts.0.insert(
|
shortcuts.0.insert(
|
||||||
Binding::new(shortcuts::Modifiers::new().logo(), None),
|
Binding::new(shortcuts::Modifiers::new().logo(), None),
|
||||||
Action::System(action),
|
action,
|
||||||
);
|
);
|
||||||
|
|
||||||
_ = config.set("custom", &shortcuts);
|
_ = config.set("custom", &shortcuts);
|
||||||
|
|
|
||||||
|
|
@ -173,10 +173,11 @@ dock = Dock
|
||||||
window-management = Window management
|
window-management = Window management
|
||||||
.desc = Super key action, window control options, and additional window tiling options.
|
.desc = Super key action, window control options, and additional window tiling options.
|
||||||
|
|
||||||
super-key = Super key
|
super-key = Super key action
|
||||||
.launcher = Open Launcher
|
.launcher = Open Launcher
|
||||||
.workspaces = Open Workspaces
|
.workspaces = Open Workspaces
|
||||||
.applications = Open Applications
|
.applications = Open Applications
|
||||||
|
.disable = Disable
|
||||||
|
|
||||||
window-controls = Window Controls
|
window-controls = Window Controls
|
||||||
.maximize = Show maximize button
|
.maximize = Show maximize button
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue