diff --git a/Userland/Libraries/LibDesktop/AppFile.cpp b/Userland/Libraries/LibDesktop/AppFile.cpp index 635682703d..70daecc5e2 100644 --- a/Userland/Libraries/LibDesktop/AppFile.cpp +++ b/Userland/Libraries/LibDesktop/AppFile.cpp @@ -69,6 +69,13 @@ bool AppFile::validate() const } ByteString AppFile::name() const +{ + auto name = m_config->read_entry("App", "Name").trim_whitespace().replace("&"sv, ""sv); + VERIFY(!name.is_empty()); + return name; +} + +ByteString AppFile::menu_name() const { auto name = m_config->read_entry("App", "Name").trim_whitespace(); VERIFY(!name.is_empty()); diff --git a/Userland/Libraries/LibDesktop/AppFile.h b/Userland/Libraries/LibDesktop/AppFile.h index 1e1216d97c..05299d4c26 100644 --- a/Userland/Libraries/LibDesktop/AppFile.h +++ b/Userland/Libraries/LibDesktop/AppFile.h @@ -30,6 +30,7 @@ public: ByteString filename() const { return m_config->filename(); } ByteString name() const; + ByteString menu_name() const; ByteString executable() const; ByteString category() const; ByteString description() const; diff --git a/Userland/Services/Taskbar/main.cpp b/Userland/Services/Taskbar/main.cpp index bb76a448b7..58a4250c05 100644 --- a/Userland/Services/Taskbar/main.cpp +++ b/Userland/Services/Taskbar/main.cpp @@ -78,6 +78,7 @@ ErrorOr serenity_main(Main::Arguments arguments) struct AppMetadata { ByteString executable; ByteString name; + ByteString menu_name; ByteString category; ByteString working_directory; GUI::Icon icon; @@ -99,7 +100,7 @@ ErrorOr> discover_apps_and_categories() if (af->exclude_from_system_menu()) return; if (access(af->executable().characters(), X_OK) == 0) { - g_apps.append({ af->executable(), af->name(), af->category(), af->working_directory(), af->icon(), af->run_in_terminal(), af->requires_root() }); + g_apps.append({ af->executable(), af->name(), af->menu_name(), af->category(), af->working_directory(), af->icon(), af->run_in_terminal(), af->requires_root() }); seen_app_categories.set(af->category()); } }); @@ -175,7 +176,7 @@ ErrorOr> build_system_menu(GUI::Window& window) } auto parent_menu = app_category_menus.get(app.category).value_or(system_menu.ptr()); - parent_menu->add_action(GUI::Action::create(app.name, icon, [app_identifier, &window](auto&) { + parent_menu->add_action(GUI::Action::create(app.menu_name, icon, [app_identifier, &window](auto&) { dbgln("Activated app with ID {}", app_identifier); auto& app = g_apps[app_identifier]; StringView executable;