Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion metadata/panel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,24 @@
<option name="launchers" type="dynamic-list" type-hint="dict">
<_short>Launchers</_short>
<_long>Launchers</_long>
<entry prefix="launcher_" type="string" name="desktop">
<_short>Desktop file</_short>
<_long>Desktop file launcher</_long>
<default/>
</entry>
<entry prefix="launcher_cmd_" type="string" name="cmd">
<_short>Command</_short>
<_long>Command</_long>
<hint>file</hint>
<default/>
</entry>
<entry prefix="launcher_icon_" type="string" name="cmd">
<entry prefix="launcher_icon_" type="string" name="icon">
<_short>Icon</_short>
<default/>
</entry>
<entry prefix="launcher_label_" type="string" name="label">
<_short>Label</_short>
<default/>
</entry>
</option>
</group>
Expand Down
40 changes: 37 additions & 3 deletions src/panel/widgets/launchers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#include <gdk/gdkcairo.h>
#include <cassert>
#include <gtk-utils.hpp>
#include <gio/gdesktopappinfo.h>
#include <fcntl.h>
#include <unistd.h>

#include "wf-shell-app.hpp"

Expand Down Expand Up @@ -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<Glib::RefPtr<Gio::File>>(), ctx);
g_warning("Failed to launch application: %s", error->message);
g_error_free(error);
}
}

Expand Down
35 changes: 34 additions & 1 deletion src/panel/widgets/menu/item.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include <gtkmm/gestureclick.h>
#include <gtkmm/gesturelongpress.h>
#include <gio/gdesktopappinfo.h>
#include <fcntl.h>
#include <unistd.h>

#include "item.hpp"
#include "menu.hpp"
Expand Down Expand Up @@ -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<Glib::RefPtr<Gio::File>>(), 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();
}

Expand Down
6 changes: 5 additions & 1 deletion src/panel/widgets/window-list/toplevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down
Loading