#include <xcb/randr.h>
#include <xcb/xcb_cursor.h>
+#define SN_API_NOT_YET_FROZEN 1
+#include <libsn/sn-launchee.h>
+
#include "i3-nagbar.h"
/** This is the equivalent of XC_left_ptr. I’m not sure why xcb doesn’t have a
char *action;
int16_t x;
uint16_t width;
+ bool terminal;
} button_t;
static xcb_window_t win;
}
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);
{"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.");
break;
case 'h':
printf("i3-nagbar " I3_VERSION "\n");
- printf("i3-nagbar [-m <message>] [-b <button> <action>] [-t warning|error] [-f <font>] [-v]\n");
+ printf("i3-nagbar [-m <message>] [-b <button> <action>] [-B <button> <action>] [-t warning|error] [-f <font>] [-v]\n");
return 0;
case 'b':
+ case 'B':
buttons = srealloc(buttons, sizeof(button_t) * (buttoncnt + 1));
buttons[buttoncnt].label = i3string_from_utf8(optarg);
buttons[buttoncnt].action = argv[optind];
+ buttons[buttoncnt].terminal = (o == 'b');
printf("button with label *%s* and action *%s*\n",
i3string_as_utf8(buttons[buttoncnt].label),
buttons[buttoncnt].action);
#include "atoms.xmacro"
#undef xmacro
+ /* Init startup notification. */
+ SnDisplay *sndisplay = sn_xcb_display_new(conn, NULL, NULL);
+ SnLauncheeContext *sncontext = sn_launchee_context_new_from_environment(sndisplay, screens);
+ sn_display_unref(sndisplay);
+
root_screen = xcb_aux_get_screen(conn, screens);
root = root_screen->root;
XCB_EVENT_MASK_BUTTON_PRESS |
XCB_EVENT_MASK_BUTTON_RELEASE,
cursor});
+ if (sncontext) {
+ sn_launchee_context_setup_window(sncontext, win);
+ }
/* Map the window (make it visible) */
xcb_map_window(conn, win);
/* Initialize the drawable bar */
draw_util_surface_init(conn, &bar, win, get_visualtype(root_screen), win_pos.width, win_pos.height);
+ /* Startup complete. */
+ if (sncontext) {
+ sn_launchee_context_complete(sncontext);
+ sn_launchee_context_unref(sncontext);
+ }
+
/* Grab the keyboard to get all input */
xcb_flush(conn);