mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-11 17:00:37 +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
Notes:
sideshowbarker
2024-07-18 11:24:32 +09:00
Author: https://github.com/SpencerCDixon Commit: https://github.com/SerenityOS/serenity/commit/cef2f55a8b9 Pull-request: https://github.com/SerenityOS/serenity/pull/8266 Reviewed-by: https://github.com/Mandar12 Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/linusg
2 changed files with 8 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2021, Spencer Dixon <spencercdixon@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -10,7 +11,6 @@
|
|||
#include <AK/Debug.h>
|
||||
#include <LibCore/ConfigFile.h>
|
||||
#include <LibCore/StandardPaths.h>
|
||||
#include <LibDesktop/AppFile.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/Button.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);
|
||||
|
||||
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()
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "WindowList.h"
|
||||
#include <LibDesktop/AppFile.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibGUI/Window.h>
|
||||
|
||||
|
@ -40,4 +41,6 @@ private:
|
|||
Gfx::IntSize m_applet_area_size;
|
||||
RefPtr<GUI::Frame> m_applet_area_container;
|
||||
RefPtr<GUI::Button> m_start_button;
|
||||
|
||||
RefPtr<Desktop::AppFile> m_assistant_app_file;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue