1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 10:08:10 +00:00

Taskbar+WindowServer: Adding to Quick Launch via windows :^)

You can now add applications to Quick Launch via the context
menu option of their windows. Clicking it creates an event with the
stored PID of the process that created the window. The Taskbar receives
the event and tells the QuickLaunchWidget to add the PID, which then
gets the executable using /sys/kernel/processes. It also looks for an
AppFile using the name from the process object and if there is one, it
uses that, since it should contain a better formatted name.
This commit is contained in:
david072 2023-11-04 19:58:14 +01:00 committed by Andreas Kling
parent 4386182be1
commit 70f7c10ab9
11 changed files with 105 additions and 0 deletions

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2023, David Ganz <david.g.ganz@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -743,6 +744,13 @@ void Window::ensure_window_menu()
m_window_menu->add_item(make<MenuItem>(*m_window_menu, MenuItem::Type::Separator));
}
auto add_to_quick_launch_item = make<MenuItem>(*m_window_menu, (unsigned)WindowMenuAction::AddToQuickLaunch, "&Add to Quick Launch");
m_window_menu_add_to_quick_launch_item = add_to_quick_launch_item.ptr();
m_window_menu_add_to_quick_launch_item->set_icon(&pin_icon());
m_window_menu->add_item(move(add_to_quick_launch_item));
m_window_menu->add_item(make<MenuItem>(*m_window_menu, MenuItem::Type::Separator));
auto close_item = make<MenuItem>(*m_window_menu, (unsigned)WindowMenuAction::Close, "&Close");
m_window_menu_close_item = close_item.ptr();
m_window_menu_close_item->set_icon(&close_icon());
@ -792,6 +800,11 @@ void Window::handle_window_menu_action(WindowMenuAction action)
WindowManager::the().set_always_on_top(*this, new_is_checked);
break;
}
case WindowMenuAction::AddToQuickLaunch: {
if (m_process_id.has_value())
WindowManager::the().on_add_to_quick_launch(m_process_id.value());
break;
}
}
}