mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 07:57:49 +00:00
KeyboardPreferenceLoader: Use Core::Process::spawn() to set keymap
This commit is contained in:
parent
ceffca9a75
commit
0af3e37f5d
1 changed files with 2 additions and 6 deletions
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <LibCore/ConfigFile.h>
|
#include <LibCore/ConfigFile.h>
|
||||||
#include <LibCore/DeprecatedFile.h>
|
#include <LibCore/DeprecatedFile.h>
|
||||||
|
#include <LibCore/Process.h>
|
||||||
#include <LibCore/System.h>
|
#include <LibCore/System.h>
|
||||||
#include <LibMain/Main.h>
|
#include <LibMain/Main.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -30,12 +31,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
||||||
if (keymaps_vector.size() == 0)
|
if (keymaps_vector.size() == 0)
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
pid_t child_pid;
|
TRY(Core::Process::spawn("/bin/keymap"sv, Array { "-m", keymaps_vector.first().characters() }, {}, Core::Process::KeepAsChild::Yes));
|
||||||
char const* argv[] = { "/bin/keymap", "-m", keymaps_vector.first().characters(), nullptr };
|
|
||||||
if ((errno = posix_spawn(&child_pid, "/bin/keymap", nullptr, nullptr, const_cast<char**>(argv), environ))) {
|
|
||||||
perror("posix_spawn");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool enable_num_lock = keyboard_settings_config->read_bool_entry("StartupEnable", "NumLock", true);
|
bool enable_num_lock = keyboard_settings_config->read_bool_entry("StartupEnable", "NumLock", true);
|
||||||
auto keyboard_device = TRY(Core::DeprecatedFile::open("/dev/input/keyboard/0", Core::OpenMode::ReadOnly));
|
auto keyboard_device = TRY(Core::DeprecatedFile::open("/dev/input/keyboard/0", Core::OpenMode::ReadOnly));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue