From eb8c2bde90729b98a0f2cb8cc322baf44f6e6085 Mon Sep 17 00:00:00 2001 From: demostanis Date: Fri, 14 Oct 2022 20:38:17 +0200 Subject: [PATCH] LibGUI: Don't show the command palette action in the command palette --- Userland/Libraries/LibGUI/CommandPalette.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibGUI/CommandPalette.cpp b/Userland/Libraries/LibGUI/CommandPalette.cpp index df0ccdcc61..56799988e9 100644 --- a/Userland/Libraries/LibGUI/CommandPalette.cpp +++ b/Userland/Libraries/LibGUI/CommandPalette.cpp @@ -247,13 +247,17 @@ void CommandPalette::collect_actions(GUI::Window& parent_window) }); }; + Function should_show_action = [&](GUI::Action* action) { + return action && action->is_enabled() && action->shortcut() != Shortcut(Mod_Ctrl | Mod_Shift, Key_A); + }; + Function collect_actions_from_menu = [&](Menu& menu) { for (auto menu_item : menu.items()) { if (menu_item.submenu()) collect_actions_from_menu(*menu_item.submenu()); - auto const* action = menu_item.action(); - if (action && action->is_enabled()) + auto* action = menu_item.action(); + if (should_show_action(action)) actions.set(*action); } }; @@ -271,7 +275,7 @@ void CommandPalette::collect_actions(GUI::Window& parent_window) if (!parent_window.is_modal()) { for (auto const& it : GUI::Application::the()->global_shortcut_actions({})) { - if (it.value->is_enabled()) + if (should_show_action(it.value)) actions.set(*it.value); } }