diff --git a/Userland/Services/Taskbar/TaskbarWindow.cpp b/Userland/Services/Taskbar/TaskbarWindow.cpp index 50a2ae7be6c..aaa095b9217 100644 --- a/Userland/Services/Taskbar/TaskbarWindow.cpp +++ b/Userland/Services/Taskbar/TaskbarWindow.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2018-2021, Andreas Kling + * Copyright (c) 2021, Spencer Dixon * * SPDX-License-Identifier: BSD-2-Clause */ @@ -10,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -87,6 +87,9 @@ TaskbarWindow::TaskbarWindow(NonnullRefPtr start_menu) m_applet_area_container->set_frame_shadow(Gfx::FrameShadow::Sunken); main_widget.add(); + + auto af_path = String::formatted("{}/{}", Desktop::AppFile::APP_FILES_DIRECTORY, "Assistant.af"); + m_assistant_app_file = Desktop::AppFile::open(af_path); } TaskbarWindow::~TaskbarWindow() @@ -329,9 +332,7 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event) break; } 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->spawn()) + if (!m_assistant_app_file->spawn()) warnln("failed to spawn 'Assistant' when requested via Super+Space"); break; } diff --git a/Userland/Services/Taskbar/TaskbarWindow.h b/Userland/Services/Taskbar/TaskbarWindow.h index d6c170718ce..3ba5a367959 100644 --- a/Userland/Services/Taskbar/TaskbarWindow.h +++ b/Userland/Services/Taskbar/TaskbarWindow.h @@ -7,6 +7,7 @@ #pragma once #include "WindowList.h" +#include #include #include @@ -40,4 +41,6 @@ private: Gfx::IntSize m_applet_area_size; RefPtr m_applet_area_container; RefPtr m_start_button; + + RefPtr m_assistant_app_file; };