From 4cb4e9f8d4fde97dfb238813b3d4caeb9f578822 Mon Sep 17 00:00:00 2001 From: Sascha Kruse Date: Fri, 22 Feb 2013 19:53:47 +0000 Subject: [PATCH 1/4] watch focus event --- x.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/x.c b/x.c index 21265a6..0b5d624 100644 --- a/x.c +++ b/x.c @@ -443,6 +443,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; @@ -688,7 +692,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); @@ -704,6 +708,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); } /* From 783b2cc8217bdb9eca541fc756e679a2ee1eaa6d Mon Sep 17 00:00:00 2001 From: Sascha Kruse Date: Mon, 25 Feb 2013 14:43:48 +0100 Subject: [PATCH 2/4] fix segfault when no actions are specified --- dunstify.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dunstify.c b/dunstify.c index c2891ef..888a7eb 100644 --- a/dunstify.c +++ b/dunstify.c @@ -254,9 +254,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]); + } notify_notification_show(n, &err); From 2cbd163e41ebd4d1fb60687b39d49a99495aa047 Mon Sep 17 00:00:00 2001 From: Sascha Kruse Date: Mon, 25 Feb 2013 20:38:48 +0100 Subject: [PATCH 3/4] add dunstify to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) 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 From b26bab5a3a1afb98c6b10a77c93d197c9246cb7e Mon Sep 17 00:00:00 2001 From: Sascha Kruse Date: Mon, 25 Feb 2013 20:39:58 +0100 Subject: [PATCH 4/4] more dunstify integration into Makefile --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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