Skip to content
Open
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
31 changes: 20 additions & 11 deletions metadata/panel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,17 +167,26 @@ If full_span is off, both sides of the panel will take the same amount of space,
<option name="launchers" type="dynamic-list" type-hint="dict">
<_short>Launchers</_short>
<_long>Launchers</_long>
<entry prefix="launcher_cmd_" type="string" name="cmd">
<_short>Command</_short>
<_long>Command</_long>
<hint>file</hint>
</entry>
<entry prefix="launcher_icon_" type="string" name="cmd">
<_short>Icon</_short>
</entry>
<entry prefix="launcher_label_" type="string" name="label">
<_short>Label</_short>
</entry>

<entry prefix="launcher_" type="string" name="desktop">
<_short>Desktop file</_short>
<_long>Desktop file launcher</_long>
<default></default>
</entry>
<entry prefix="launcher_cmd_" type="string" name="cmd">
<_short>Command</_short>
<_long>Command</_long>
<hint>file</hint>
<default></default>
</entry>
<entry prefix="launcher_icon_" type="string" name="icon">
<_short>Icon</_short>
<default></default>
</entry>
<entry prefix="launcher_label_" type="string" name="label">
<_short>Label</_short>
<default></default>
</entry>
</option>
</group>
<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 @@ -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<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 @@ -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();
}
}
Expand Down
Loading