aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorN-R-K <79544946+N-R-K@users.noreply.github.com>2021-10-07 02:37:34 +0200
committerGitHub <noreply@github.com>2021-10-07 02:37:34 +0200
commit6ce94e3e3b8cccab0a5cc23c7538ad19626c1c1d (patch)
treef925a23624f967dcc31c4759d29f2f65b3dae7fa /main.c
parente8d08ba67edf407884fa36f11c027cd7c0d4e46d (diff)
downloadnsxiv-6ce94e3e3b8cccab0a5cc23c7538ad19626c1c1d.tar.zst
add statusbar message upon key-hander activation (#98)
Currently when running the key-handler the statusbar shows a "Running key-handler..." message, but there's no indication of the prefix key being pressed. There's a slight functional benefit of this patch in the sense that users can visually tell if the key-handler is listening on input or if the key-handler has been aborted or not.
Diffstat (limited to 'main.c')
-rw-r--r--main.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/main.c b/main.c
index 220743b..f3eeb0a 100644
--- a/main.c
+++ b/main.c
@@ -469,6 +469,22 @@ Bool is_input_ev(Display *dpy, XEvent *ev, XPointer arg)
return ev->type == ButtonPress || ev->type == KeyPress;
}
+void handle_key_handler(bool init)
+{
+ extprefix = init;
+ if (win.bar.h == 0)
+ return;
+ if (init) {
+ close_info();
+ snprintf(win.bar.l.buf, win.bar.l.size, "Getting key handler input "
+ "(%s to abort)...", XKeysymToString(keyhandler_abort));
+ } else { /* abort */
+ open_info();
+ update_info();
+ }
+ win_draw(&win);
+}
+
void run_key_handler(const char *key, unsigned int mask)
{
pid_t pid;
@@ -588,7 +604,7 @@ void on_keypress(XKeyEvent *kev)
if (IsModifierKey(ksym))
return;
if (extprefix && ksym == keyhandler_abort && MODMASK(kev->state) == 0) {
- extprefix = False;
+ handle_key_handler(false);
} else if (extprefix) {
run_key_handler(XKeysymToString(ksym), kev->state & ~sh);
extprefix = False;