Keymap+WindowServer: Add context menu to keymap applet

Adding a context menu which lists configured keymaps and allows
setting the active keymap
This commit is contained in:
Timur Sultanov 2022-04-03 02:06:35 +03:00 committed by Andreas Kling
commit 9906f41e01
Notes: sideshowbarker 2024-07-17 08:41:57 +09:00
11 changed files with 126 additions and 27 deletions

View file

@ -0,0 +1,34 @@
/*
* Copyright (c) 2022, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibCore/FileWatcher.h>
#include <LibGUI/ActionGroup.h>
#include <LibGUI/Label.h>
#include <LibGUI/Menu.h>
#include <LibGUI/Window.h>
enum class ClearBackground {
No,
Yes
};
class KeymapStatusWidget : public GUI::Label {
C_OBJECT(KeymapStatusWidget);
virtual void mousedown_event(GUI::MouseEvent& event) override;
void set_current_keymap(String const& keymap, ClearBackground clear_background = ClearBackground::Yes);
private:
RefPtr<GUI::Menu> m_context_menu;
String m_current_keymap;
ErrorOr<void> refresh_menu();
GUI::ActionGroup m_keymaps_group;
};