X-Git-Url: https://git.sur5r.net/?p=i3%2Fi3;a=blobdiff_plain;f=i3-nagbar%2Fmain.c;fp=i3-nagbar%2Fmain.c;h=4ce7493961caf7ed5e35674cbc441843aed0d1eb;hp=e4628e303452feae75294e0de9208cc26ba5bc8e;hb=1847938d4eeba98260cc79ca45a11a134274c2ea;hpb=c54f5008395b10c046f380cc3069ff779e5d2877 diff --git a/i3-nagbar/main.c b/i3-nagbar/main.c index e4628e30..4ce74939 100644 --- a/i3-nagbar/main.c +++ b/i3-nagbar/main.c @@ -32,6 +32,9 @@ #include #include +#define SN_API_NOT_YET_FROZEN 1 +#include + #include "i3-nagbar.h" /** This is the equivalent of XC_left_ptr. I’m not sure why xcb doesn’t have a @@ -52,6 +55,7 @@ typedef struct { char *action; int16_t x; uint16_t width; + bool terminal; } button_t; static xcb_window_t win; @@ -99,10 +103,10 @@ void debuglog(char *fmt, ...) { } /* - * Starts the given application by passing it through a shell. We use double fork - * to avoid zombie processes. As the started application’s parent exits (immediately), - * the application is reparented to init (process-id 1), which correctly handles - * childs, so we don’t have to do it :-). + * Starts the given application by passing it through a shell. We use double + * fork to avoid zombie processes. As the started application’s parent exits + * (immediately), the application is reparented to init (process-id 1), which + * correctly handles children, so we don’t have to do it :-). * * The shell is determined by looking for the SHELL environment variable. If it * does not exist, /bin/sh is used. @@ -115,7 +119,7 @@ static void start_application(const char *command) { setsid(); if (fork() == 0) { /* This is the child */ - execl(_PATH_BSHELL, _PATH_BSHELL, "-c", command, (void *)NULL); + execl(_PATH_BSHELL, _PATH_BSHELL, "-c", command, NULL); /* not reached */ } exit(0); @@ -184,7 +188,11 @@ static void handle_button_release(xcb_connection_t *conn, xcb_button_release_eve } char *terminal_cmd; - sasprintf(&terminal_cmd, "i3-sensible-terminal -e %s", link_path); + if (button->terminal) { + sasprintf(&terminal_cmd, "i3-sensible-terminal -e %s", link_path); + } else { + terminal_cmd = sstrdup(link_path); + } printf("argv0 = %s\n", argv0); printf("terminal_cmd = %s\n", terminal_cmd); @@ -358,12 +366,13 @@ int main(int argc, char *argv[]) { {"version", no_argument, 0, 'v'}, {"font", required_argument, 0, 'f'}, {"button", required_argument, 0, 'b'}, + {"button-no-terminal", required_argument, 0, 'B'}, {"help", no_argument, 0, 'h'}, {"message", required_argument, 0, 'm'}, {"type", required_argument, 0, 't'}, {0, 0, 0, 0}}; - char *options_string = "b:f:m:t:vh"; + char *options_string = "b:B:f:m:t:vh"; prompt = i3string_from_utf8("Please do not run this program."); @@ -385,12 +394,14 @@ int main(int argc, char *argv[]) { break; case 'h': printf("i3-nagbar " I3_VERSION "\n"); - printf("i3-nagbar [-m ] [-b