From 36d8ff00dd1d0f60d0a2afca519de979c67f1dce Mon Sep 17 00:00:00 2001 From: "jakob.stendahl" Date: Sun, 14 Jul 2024 10:21:23 +0200 Subject: Add some more options for navigating --- snotif.h | 1 + snotifc.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/snotif.h b/snotif.h index 16c8667..5fe1d15 100644 --- a/snotif.h +++ b/snotif.h @@ -17,6 +17,7 @@ // Curses related constants #define CPAIR_SEL 132 #define CPAIR_B 4 +#define CTRL(c) ((c) & 037) // Extended struct from the specification at: // https://specifications.freedesktop.org/notification-spec/latest/ar01s09.html diff --git a/snotifc.c b/snotifc.c index 2261755..ac1ba84 100644 --- a/snotifc.c +++ b/snotifc.c @@ -508,6 +508,18 @@ void curses_handle_input(DBusConnection* conn, int ch, int* start, int* selected (*start) = 0; clear(); break; + case CTRL('d'): + (*selected) += ((LINES - 1) / 2); + (*start) += ((LINES - 1) / 2); + if ((*selected) >= notifs->element_count) + (*selected) = notifs->element_count - 1; + if ((*start) >= notifs->element_count - LINES + 1) { + (*start) = notifs->element_count - LINES + 1; + } + if ((*start) < 0) + (*start) = 0; + clear(); + break; case KEY_PPAGE: (*selected) -= (LINES - 1); (*start) -= (LINES - 1); @@ -517,6 +529,15 @@ void curses_handle_input(DBusConnection* conn, int ch, int* start, int* selected (*start) = 0; clear(); break; + case CTRL('u'): + (*selected) -= ((LINES - 1) / 2); + (*start) -= ((LINES - 1) / 2); + if ((*selected) < 0) + (*selected) = 0; + if ((*start) < 0) + (*start) = 0; + clear(); + break; case 'G': (*selected) = notifs->element_count - 1; (*start) = notifs->element_count - LINES + 1; -- cgit v1.2.3