summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libmdock/mdock-item.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/libmdock/mdock-item.c b/libmdock/mdock-item.c
index 150af74..68cfb80 100644
--- a/libmdock/mdock-item.c
+++ b/libmdock/mdock-item.c
@@ -323,14 +323,20 @@ void mdock_item_set_desktop_app_info(MDockItem *self, GDesktopAppInfo *app_info)
void mdock_item_launch_files(MDockItem *self, GList *files)
{
g_return_if_fail(self->priv->appinfo);
+ GAppInfo *appinfo = G_APP_INFO(self->priv->appinfo);
+ GdkAppLaunchContext *launch_context = gdk_app_launch_context_new();
GError *error = NULL;
- g_debug("Launching '%s'", g_app_info_get_commandline(G_APP_INFO(self->priv->appinfo)));
- if (!g_app_info_launch(G_APP_INFO(self->priv->appinfo), files, NULL, &error)) {
+ gdk_app_launch_context_set_display(launch_context, gtk_widget_get_display(GTK_WIDGET(self)));
+ gdk_app_launch_context_set_timestamp(launch_context, gtk_get_current_event_time());
+
+ g_debug("Launching '%s'", g_app_info_get_commandline(appinfo));
+
+ if (!g_app_info_launch(appinfo, files, G_APP_LAUNCH_CONTEXT(launch_context), &error)) {
GtkWidget *msg;
g_warning("Cannot launch '%s': %s",
- g_app_info_get_display_name(G_APP_INFO(self->priv->appinfo)),
+ g_app_info_get_display_name(appinfo),
error->message);
msg = gtk_message_dialog_new(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(self))),
@@ -338,7 +344,7 @@ void mdock_item_launch_files(MDockItem *self, GList *files)
GTK_MESSAGE_WARNING,
GTK_BUTTONS_OK,
"Cannot launch '%s': %s",
- g_app_info_get_display_name(G_APP_INFO(self->priv->appinfo)),
+ g_app_info_get_display_name(appinfo),
error->message);
g_signal_connect_swapped(msg, "response",