Skip to content

Commit

Permalink
ratpoison: add 0010-Notification-on-urgency-flag.patch, relbump
Browse files Browse the repository at this point in the history
  • Loading branch information
sighook committed May 12, 2024
1 parent f727904 commit 68647ce
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 2 deletions.
1 change: 1 addition & 0 deletions ratpoison/.md5sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ a8da2c3fa7027924308ff32015c39e17 0006-Fix-don-t-draw-help-window-beyond-screen-
4e5e803df9eae0683cec89182e6c46cf 0007-Fix-draw-the-license-text-centered-on-multi-screen-s.patch
be4ad9e2d3afbe4f1b7e7ce336b05a3b 0008-Fix-exclude-degenerate-case-from-frame-overlap.patch
21b1fb165c64945114bbfb2dfa76e425 0009-ratpoison.mdoc.1-add-missing-infofmt-description-and.patch
886d58ca00f8f776c8124cad5a2f78a4 0010-Notification-on-urgency-flag.patch
63afedddd7897bb248cf6eea2b7f560e genratpoison-re.pl
de38668b1fa3d65821c1da2e35c52cd3 ratpoison-re.pl.diff
92 changes: 92 additions & 0 deletions ratpoison/0010-Notification-on-urgency-flag.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
From 809f81ba75cb8e0b134f9dacfb027c7a9ec6d292 Mon Sep 17 00:00:00 2001
From: Alexandr Savca <[email protected]>
Date: Sun, 12 May 2024 18:46:35 +0300
Subject: [PATCH] Notification on urgency flag

Slightly modified original patch by Eoin McLoughlin (see below).

Original message:
I was in IRC briefly last night enquiring about getting notifications
for non-visible windows which want the user's attention (bells in
xterms, message notifications in pidgin, that sort of thing)

I've attached a simple patch which adds functionality for detecting when
windows want attention, and displays a message showing the name and id
of the window. This is done by means of sending an echo command (which,
admittedly may not be the correct way to do this) to ratpoison.

I'm finding it quite useful so far, as I've previously missed urgent
windows due to a C-t Q or similar.

Eoin McLoughlin.

Reference:
https://lists.nongnu.org/archive/html/ratpoison-devel/2009-11/msg00004.htm
https://lists.nongnu.org/archive/html/ratpoison-devel/2009-11/msg00005.htm
---
src/events.c | 14 ++++++++++++++
src/manage.c | 10 ++++++++++
src/manage.h | 1 +
3 files changed, 25 insertions(+)

diff --git a/src/events.c b/src/events.c
index 4808d29..8031d3d 100644
--- a/src/events.c
+++ b/src/events.c
@@ -632,6 +632,20 @@ property_notify (XEvent *ev)
win->transient = XGetTransientForHint (dpy, win->w, &win->transient_for);
break;

+ case XA_WM_HINTS:
+ PRINT_DEBUG (("Additional hints\n"));
+
+ if (has_urgency_flag (win))
+ {
+ rp_group *g = groups_find_group_by_window (win);
+ rp_window_elem *elem = group_find_window (&g->mapped_windows, win);
+ char* commandStr = xsprintf ("echo Window %i (%s) in group %i wants attention",
+ elem->number, win->wm_name, g->number);
+ command (0, commandStr);
+ free (commandStr);
+ }
+ break;
+
default:
PRINT_DEBUG (("Unhandled property notify event: %ld\n", ev->xproperty.atom));
break;
diff --git a/src/manage.c b/src/manage.c
index 78be591..9cc428f 100644
--- a/src/manage.c
+++ b/src/manage.c
@@ -173,6 +173,16 @@ update_normal_hints (rp_window *win)
#endif
}

+/* Return non-zero if window hints have urgency flag set */
+int
+has_urgency_flag (rp_window *win)
+{
+ XWMHints *hints = XGetWMHints (dpy, win->w);
+ int has_urgency = (hints->flags & XUrgencyHint) == XUrgencyHint;
+
+ XFree (hints);
+ return has_urgency;
+}

static char *
get_wmname (Window w)
diff --git a/src/manage.h b/src/manage.h
index 8001e09..ed80179 100644
--- a/src/manage.h
+++ b/src/manage.h
@@ -32,6 +32,7 @@ void scanwins (void);
void unmanage (rp_window *w);
int update_window_name (rp_window *win);
void update_normal_hints (rp_window *win);
+int has_urgency_flag (rp_window *win);
void rename_current_window (void);
void set_state (rp_window *win, int state);
long get_state (rp_window *win);
--
2.45.0

5 changes: 3 additions & 2 deletions ratpoison/Pkgfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

name=ratpoison
version=1.4.9-db94d49
release=3
release=4
source="0001-obeyresizehints-option-to-dis-obey-ICCCM-window-resi.patch
0002-fix-dedicate-frame.patch
0003-fix-edge-case-for-find_frame_-left-right-up-down-fun.patch
Expand All @@ -14,6 +14,7 @@ source="0001-obeyresizehints-option-to-dis-obey-ICCCM-window-resi.patch
0007-Fix-draw-the-license-text-centered-on-multi-screen-s.patch
0008-Fix-exclude-degenerate-case-from-frame-overlap.patch
0009-ratpoison.mdoc.1-add-missing-infofmt-description-and.patch
0010-Notification-on-urgency-flag.patch

ratpoison-re.pl.diff
genratpoison-re.pl"
Expand Down Expand Up @@ -41,7 +42,7 @@ build() {
# patches included in this package
git checkout ${version#*-}

for p in $SRC/000*.patch; do
for p in $SRC/00*.patch; do
patch -p1 -i $p
done

Expand Down

0 comments on commit 68647ce

Please sign in to comment.