1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:47:34 +00:00

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
parent db11cfa2c5
commit 9906f41e01
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;
};