diff options
author | jakob.stendahl <jakob.stendahl@infomedia.dk> | 2024-07-14 10:21:23 +0200 |
---|---|---|
committer | jakob.stendahl <jakob.stendahl@infomedia.dk> | 2024-07-14 10:21:23 +0200 |
commit | 36d8ff00dd1d0f60d0a2afca519de979c67f1dce (patch) | |
tree | f4c5583492fbd1397f6039a2ea3d22337e55654b | |
parent | a25836508d8b87c7f3f84ace2ca4c4d554b2dac3 (diff) | |
download | simple-notification-daemon-36d8ff00dd1d0f60d0a2afca519de979c67f1dce.tar.gz simple-notification-daemon-36d8ff00dd1d0f60d0a2afca519de979c67f1dce.zip |
Add some more options for navigating
-rw-r--r-- | snotif.h | 1 | ||||
-rw-r--r-- | snotifc.c | 21 |
2 files changed, 22 insertions, 0 deletions
@@ -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 @@ -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; |