diff --git a/Userland/Libraries/LibGUI/Widget.h b/Userland/Libraries/LibGUI/Widget.h index d8074de3f5..b8c7979d2d 100644 --- a/Userland/Libraries/LibGUI/Widget.h +++ b/Userland/Libraries/LibGUI/Widget.h @@ -283,6 +283,9 @@ public: void set_accepts_emoji_input(bool b) { m_accepts_emoji_input = b; } bool accepts_emoji_input() const { return m_accepts_emoji_input; } + void set_accepts_command_palette(bool b) { m_accepts_command_palette = b; } + bool accepts_command_palette() const { return m_accepts_command_palette; } + virtual Gfx::IntRect children_clip_rect() const; AK::Variant> override_cursor() const { return m_override_cursor; } @@ -378,6 +381,7 @@ private: bool m_enabled { true }; bool m_updates_enabled { true }; bool m_accepts_emoji_input { false }; + bool m_accepts_command_palette { true }; bool m_shrink_to_fit { false }; bool m_default_font { true }; diff --git a/Userland/Libraries/LibGUI/WindowServerConnection.cpp b/Userland/Libraries/LibGUI/WindowServerConnection.cpp index 2cf836458a..26909be401 100644 --- a/Userland/Libraries/LibGUI/WindowServerConnection.cpp +++ b/Userland/Libraries/LibGUI/WindowServerConnection.cpp @@ -196,7 +196,8 @@ void WindowServerConnection::key_down(i32 window_id, u32 code_point, u32 key, u3 } // FIXME: This shortcut should be configurable. - if (!m_in_command_palette && modifiers == (Mod_Ctrl | Mod_Shift) && key == Key_A) { + bool focused_widget_accepts_command_palette = window->focused_widget() && window->focused_widget()->accepts_command_palette(); + if (focused_widget_accepts_command_palette && !m_in_command_palette && modifiers == (Mod_Ctrl | Mod_Shift) && key == Key_A) { auto command_palette = CommandPalette::construct(*window); TemporaryChange change { m_in_command_palette, true }; if (command_palette->exec() != GUI::Dialog::ExecOK)