mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:47:45 +00:00
Assistant+Taskbar: Use AppFile::spawn() utility
This commit is contained in:
parent
ae20c178b9
commit
b9d1ef99de
2 changed files with 2 additions and 22 deletions
|
@ -121,7 +121,6 @@ public:
|
||||||
|
|
||||||
void search(String const& query)
|
void search(String const& query)
|
||||||
{
|
{
|
||||||
|
|
||||||
m_app_provider.query(query, [=, this](auto results) {
|
m_app_provider.query(query, [=, this](auto results) {
|
||||||
recv_results(query, results);
|
recv_results(query, results);
|
||||||
});
|
});
|
||||||
|
|
|
@ -331,27 +331,8 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event)
|
||||||
case GUI::Event::WM_SuperSpaceKeyPressed: {
|
case GUI::Event::WM_SuperSpaceKeyPressed: {
|
||||||
auto af_path = String::formatted("{}/{}", Desktop::AppFile::APP_FILES_DIRECTORY, "Assistant.af");
|
auto af_path = String::formatted("{}/{}", Desktop::AppFile::APP_FILES_DIRECTORY, "Assistant.af");
|
||||||
auto af = Desktop::AppFile::open(af_path);
|
auto af = Desktop::AppFile::open(af_path);
|
||||||
if (!af->is_valid()) {
|
if (!af->spawn())
|
||||||
warnln("invalid app file when trying to open Assistant");
|
warnln("failed to spawn 'Assistant' when requested via Super+Space");
|
||||||
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;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue