diff --git a/metadata/panel.xml b/metadata/panel.xml index 6da3f7202..a208147f4 100644 --- a/metadata/panel.xml +++ b/metadata/panel.xml @@ -167,17 +167,26 @@ If full_span is off, both sides of the panel will take the same amount of space, diff --git a/src/panel/widgets/launchers.cpp b/src/panel/widgets/launchers.cpp index 7ec8f2940..fd9528b77 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 46beb5973..86bf10b89 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" @@ -152,7 +155,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 7d114287d..4262e717a 100644 --- a/src/panel/widgets/window-list/toplevel.cpp +++ b/src/panel/widgets/window-list/toplevel.cpp @@ -847,7 +847,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(); } }