1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:37:44 +00:00

Assistant+Taskbar: Use AppFile::spawn() utility

This commit is contained in:
Spencer Dixon 2021-06-21 20:27:02 -04:00 committed by Andreas Kling
parent ae20c178b9
commit b9d1ef99de
2 changed files with 2 additions and 22 deletions

View file

@ -121,7 +121,6 @@ public:
void search(String const& query)
{
m_app_provider.query(query, [=, this](auto results) {
recv_results(query, results);
});

View file

@ -331,27 +331,8 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event)
case GUI::Event::WM_SuperSpaceKeyPressed: {
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");
}
if (!af->spawn())
warnln("failed to spawn 'Assistant' when requested via Super+Space");
break;
}
default: