diff --git a/metadata/panel.xml b/metadata/panel.xml index 99789871..97140299 100644 --- a/metadata/panel.xml +++ b/metadata/panel.xml @@ -167,16 +167,24 @@ diff --git a/src/panel/widgets/launchers.cpp b/src/panel/widgets/launchers.cpp index 7ec8f294..fd9528b7 100644 --- a/src/panel/widgets/launchers.cpp +++ b/src/panel/widgets/launchers.cpp @@ -8,6 +8,9 @@ #include #include #include +#include +#include +#include #include "wf-shell-app.hpp" @@ -75,10 +78,41 @@ void WfLauncherButton::update_icon() void WfLauncherButton::launch() { - if (app_info) + if (!app_info) + { + return; + } + + auto ctx = Gdk::Display::get_default()->get_app_launch_context(); + + int devnull = open("/dev/null", O_RDWR); + if (devnull < 0) + { + return; + } + + GError *error = nullptr; + + g_desktop_app_info_launch_uris_as_manager_with_fds( + app_info->gobj(), + nullptr, + G_APP_LAUNCH_CONTEXT(ctx->gobj()), + G_SPAWN_DEFAULT, + nullptr, + nullptr, + nullptr, + nullptr, + devnull, // stdin + devnull, // stdout + devnull, // stderr + &error); + + close(devnull); + + if (error) { - auto ctx = Gdk::Display::get_default()->get_app_launch_context(); - app_info->launch(std::vector>(), ctx); + g_warning("Failed to launch application: %s", error->message); + g_error_free(error); } } diff --git a/src/panel/widgets/menu/item.cpp b/src/panel/widgets/menu/item.cpp index 4994c7ad..24f8db09 100644 --- a/src/panel/widgets/menu/item.cpp +++ b/src/panel/widgets/menu/item.cpp @@ -1,5 +1,8 @@ #include #include +#include +#include +#include #include "item.hpp" #include "menu.hpp" @@ -160,7 +163,37 @@ WfMenuItem::~WfMenuItem() void WfMenuItem::on_click() { auto ctx = Gdk::Display::get_default()->get_app_launch_context(); - app_info->launch(std::vector>(), ctx); + + int devnull = open("/dev/null", O_RDWR); + if (devnull < 0) + { + return; + } + + GError *error = nullptr; + + g_desktop_app_info_launch_uris_as_manager_with_fds( + app_info->gobj(), + nullptr, + G_APP_LAUNCH_CONTEXT(ctx->gobj()), + G_SPAWN_DEFAULT, + nullptr, + nullptr, + nullptr, + nullptr, + devnull, // stdin + devnull, // stdout + devnull, // stderr + &error); + + close(devnull); + + if (error) + { + g_warning("Failed to launch application: %s", error->message); + g_error_free(error); + } + menu->hide_menu(); } diff --git a/src/panel/widgets/window-list/toplevel.cpp b/src/panel/widgets/window-list/toplevel.cpp index 14e0b627..620e2bbf 100644 --- a/src/panel/widgets/window-list/toplevel.cpp +++ b/src/panel/widgets/window-list/toplevel.cpp @@ -885,7 +885,11 @@ class WayfireToplevel::impl if (window_list->output->wo == output) { - window_list->append(button); + if (!button.get_parent()) + { + window_list->append(button); + } + send_rectangle_hints(); } }