diff --git a/.gitignore b/.gitignore index 1ef5270..ee2a189 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ vgcore.* config.h dunst.1 org.knopwob.dunst.service +dunstify diff --git a/Makefile b/Makefile index b91f293..a7aca72 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ SRC = x.c \ notification.c OBJ = ${SRC:.c=.o} -all: doc options dunst service +all: doc options dunst service dunstify options: @echo dunst build options: @@ -50,6 +50,7 @@ clean: @rm -f dunst.1 @rm -f org.knopwob.dunst.service @rm -f core + @rm -f dunstify doc: dunst.1 dunst.1: README.pod diff --git a/dunstify.c b/dunstify.c index db17b4e..8db4234 100644 --- a/dunstify.c +++ b/dunstify.c @@ -285,9 +285,10 @@ int main(int argc, char *argv[]) l = g_main_loop_new(NULL, false); g_signal_connect(n, "closed", G_CALLBACK(closed), NULL); - for (int i = 0; action_strs[i]; i++) { - add_action(n, action_strs[i]); - } + if (action_strs) + for (int i = 0; action_strs[i]; i++) { + add_action(n, action_strs[i]); + } if (hint_strs) for (int i = 0; hint_strs[i]; i++) { diff --git a/x.c b/x.c index c072da0..907c4f5 100644 --- a/x.c +++ b/x.c @@ -506,6 +506,10 @@ gboolean x_mainloop_fd_dispatch(GSource * source, GSourceFunc callback, context_menu(); } break; + case FocusIn: + case FocusOut: + printf("Focus Event\n"); + wake_up(); } } return true; @@ -751,7 +755,7 @@ void x_win_setup(void) wa.background_pixmap = ParentRelative; wa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask | - ButtonPressMask; + ButtonPressMask | FocusChangeMask; screen_info scr; x_screen_info(&scr); @@ -767,6 +771,9 @@ void x_win_setup(void) setopacity(xctx.win, (unsigned long)((100 - settings.transparency) * (0xffffffff / 100))); + + long root_event_mask = FocusChangeMask; + XSelectInput(xctx.dpy, root, root_event_mask); } /*