From aaa67e2d28d74dac8592f9f3a8db6288929d19de Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 22 Aug 2017 22:29:47 +0200 Subject: Add experimental support for (remote) control via stdin --- src/keyevents.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/keyevents.c') diff --git a/src/keyevents.c b/src/keyevents.c index 861a7a7..f10ce43 100644 --- a/src/keyevents.c +++ b/src/keyevents.c @@ -266,6 +266,21 @@ void feh_event_invoke_action(winwidget winwid, unsigned char action) return; } +void feh_event_handle_stdin() +{ + char stdin_buf[2]; + if (read(STDIN_FILENO, &stdin_buf, 1) == -1) { + weprintf("reading a command from stdin failed"); + return; + } + stdin_buf[1] = '\0'; + + KeySym keysym = XStringToKeysym(stdin_buf); + + if (window_num) + feh_event_handle_generic(windows[0], 0, keysym, 0); +} + void feh_event_handle_keypress(XEvent * ev) { int state; -- cgit v1.2.3