1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:17:44 +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

@ -53,7 +53,7 @@ void KeymapSwitcher::refresh()
on_keymap_change(current_keymap);
if (m_keymaps.find(current_keymap).is_end()) {
setkeymap(m_keymaps.first());
set_keymap(m_keymaps.first());
}
}
@ -75,7 +75,7 @@ void KeymapSwitcher::next_keymap()
if (it.is_end()) {
auto first_keymap = m_keymaps.first();
dbgln("Cannot find current keymap in the keymap list - setting first available ({})", first_keymap);
setkeymap(first_keymap);
set_keymap(first_keymap);
} else {
it++;
@ -84,7 +84,7 @@ void KeymapSwitcher::next_keymap()
}
dbgln("Setting system keymap to: {}", *it);
setkeymap(*it);
set_keymap(*it);
}
}
@ -100,7 +100,7 @@ String KeymapSwitcher::get_current_keymap() const
return keymap_object.get("keymap"sv).to_string();
}
void KeymapSwitcher::setkeymap(const AK::String& keymap)
void KeymapSwitcher::set_keymap(const AK::String& keymap)
{
if (Core::Process::spawn("/bin/keymap"sv, Array { "-m", keymap.characters() }).is_error())
dbgln("Failed to call /bin/keymap, error: {} ({})", errno, strerror(errno));