mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:57:35 +00:00
Taskbar: Move 'Assistant' Desktop::AppFile to member for quicker access
We care about showing 'Assistant' app as fast as possible when the hotkey is pressed. In order to do that, we can parse the `.af` file ahead of time and have it ready to use.
This commit is contained in:
parent
b9d1ef99de
commit
cef2f55a8b
2 changed files with 8 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||||
|
* Copyright (c) 2021, Spencer Dixon <spencercdixon@gmail.com>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -10,7 +11,6 @@
|
||||||
#include <AK/Debug.h>
|
#include <AK/Debug.h>
|
||||||
#include <LibCore/ConfigFile.h>
|
#include <LibCore/ConfigFile.h>
|
||||||
#include <LibCore/StandardPaths.h>
|
#include <LibCore/StandardPaths.h>
|
||||||
#include <LibDesktop/AppFile.h>
|
|
||||||
#include <LibGUI/BoxLayout.h>
|
#include <LibGUI/BoxLayout.h>
|
||||||
#include <LibGUI/Button.h>
|
#include <LibGUI/Button.h>
|
||||||
#include <LibGUI/Desktop.h>
|
#include <LibGUI/Desktop.h>
|
||||||
|
@ -87,6 +87,9 @@ TaskbarWindow::TaskbarWindow(NonnullRefPtr<GUI::Menu> start_menu)
|
||||||
m_applet_area_container->set_frame_shadow(Gfx::FrameShadow::Sunken);
|
m_applet_area_container->set_frame_shadow(Gfx::FrameShadow::Sunken);
|
||||||
|
|
||||||
main_widget.add<Taskbar::ClockWidget>();
|
main_widget.add<Taskbar::ClockWidget>();
|
||||||
|
|
||||||
|
auto af_path = String::formatted("{}/{}", Desktop::AppFile::APP_FILES_DIRECTORY, "Assistant.af");
|
||||||
|
m_assistant_app_file = Desktop::AppFile::open(af_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskbarWindow::~TaskbarWindow()
|
TaskbarWindow::~TaskbarWindow()
|
||||||
|
@ -329,9 +332,7 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GUI::Event::WM_SuperSpaceKeyPressed: {
|
case GUI::Event::WM_SuperSpaceKeyPressed: {
|
||||||
auto af_path = String::formatted("{}/{}", Desktop::AppFile::APP_FILES_DIRECTORY, "Assistant.af");
|
if (!m_assistant_app_file->spawn())
|
||||||
auto af = Desktop::AppFile::open(af_path);
|
|
||||||
if (!af->spawn())
|
|
||||||
warnln("failed to spawn 'Assistant' when requested via Super+Space");
|
warnln("failed to spawn 'Assistant' when requested via Super+Space");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "WindowList.h"
|
#include "WindowList.h"
|
||||||
|
#include <LibDesktop/AppFile.h>
|
||||||
#include <LibGUI/Widget.h>
|
#include <LibGUI/Widget.h>
|
||||||
#include <LibGUI/Window.h>
|
#include <LibGUI/Window.h>
|
||||||
|
|
||||||
|
@ -40,4 +41,6 @@ private:
|
||||||
Gfx::IntSize m_applet_area_size;
|
Gfx::IntSize m_applet_area_size;
|
||||||
RefPtr<GUI::Frame> m_applet_area_container;
|
RefPtr<GUI::Frame> m_applet_area_container;
|
||||||
RefPtr<GUI::Button> m_start_button;
|
RefPtr<GUI::Button> m_start_button;
|
||||||
|
|
||||||
|
RefPtr<Desktop::AppFile> m_assistant_app_file;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue