aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakob.stendahl <jakob.stendahl@infomedia.dk>2024-07-14 10:21:23 +0200
committerjakob.stendahl <jakob.stendahl@infomedia.dk>2024-07-14 10:21:23 +0200
commit36d8ff00dd1d0f60d0a2afca519de979c67f1dce (patch)
treef4c5583492fbd1397f6039a2ea3d22337e55654b
parenta25836508d8b87c7f3f84ace2ca4c4d554b2dac3 (diff)
downloadsimple-notification-daemon-36d8ff00dd1d0f60d0a2afca519de979c67f1dce.tar.gz
simple-notification-daemon-36d8ff00dd1d0f60d0a2afca519de979c67f1dce.zip
Add some more options for navigating
-rw-r--r--snotif.h1
-rw-r--r--snotifc.c21
2 files changed, 22 insertions, 0 deletions
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;