Taskbar: Open 'Assistant' with Super+Space

This commit is contained in:
Spencer Dixon 2021-06-21 19:47:07 -04:00 committed by Andreas Kling
parent 4f11138e8e
commit cbe67ed665
Notes: sideshowbarker 2024-07-18 11:24:44 +09:00

View File

@ -329,7 +329,29 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event)
break;
}
case GUI::Event::WM_SuperSpaceKeyPressed: {
dbgln("super and space was pressed down");
auto af_path = String::formatted("{}/{}", Desktop::AppFile::APP_FILES_DIRECTORY, "Assistant.af");
auto af = Desktop::AppFile::open(af_path);
if (!af->is_valid()) {
warnln("invalid app file when trying to open Assistant");
return;
}
auto app_executable = af->executable();
pid_t pid = fork();
if (pid < 0) {
perror("fork");
} else if (pid == 0) {
if (chdir(Core::StandardPaths::home_directory().characters()) < 0) {
perror("chdir");
exit(1);
}
execl(app_executable.characters(), app_executable.characters(), nullptr);
perror("execl");
VERIFY_NOT_REACHED();
} else {
if (disown(pid) < 0)
perror("disown");
}
break;
}
default: