diff options
| author | Dana Jansens <danakj@orodu.net> | 2008-03-01 00:18:33 -0500 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2008-03-01 00:18:33 -0500 |
| commit | 94c60ba74e1efef25f86dbc8d000b33756de79ad (patch) | |
| tree | c76ef5f2dc332ec2a638ec56c3ab712386d4d528 /openbox/actions | |
| parent | a1908e076736e1a618bd305c5963dbfecaa30497 (diff) | |
pass the targeted window's PID (if available) and WINDOW_ID to the environment of the Execute action
Diffstat (limited to 'openbox/actions')
| -rw-r--r-- | openbox/actions/execute.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/openbox/actions/execute.c b/openbox/actions/execute.c index fd9625c5..69690faa 100644 --- a/openbox/actions/execute.c +++ b/openbox/actions/execute.c @@ -1,6 +1,7 @@ #include "openbox/actions.h" #include "openbox/event.h" #include "openbox/startupnotify.h" +#include "openbox/client.h" #include "openbox/prompt.h" #include "openbox/screen.h" #include "obt/paths.h" @@ -155,6 +156,26 @@ static gboolean run_func(ObActionsData *data, gpointer options) screen_desktop); } + if (data->client && data->client->pid) { + gchar *pid; + + pid = g_strdup_printf("%u", data->client->pid); + setenv("PID", pid, TRUE); + g_free(pid); + } + else + unsetenv("PID"); + + if (data->client) { + gchar *wid; + + wid = g_strdup_printf("%u", data->client->window); + setenv("WINDOW_ID", wid, TRUE); + g_free(wid); + } + else + unsetenv("WINDOW_ID"); + if (!g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, NULL, &e)) @@ -168,6 +189,9 @@ static gboolean run_func(ObActionsData *data, gpointer options) if (o->sn) unsetenv("DESKTOP_STARTUP_ID"); + unsetenv("PID"); + unsetenv("WINDOW_ID"); + g_free(program); g_strfreev(argv); } |
