From cadef4f05202df2c360773779a5f5b5d6d993df9 Mon Sep 17 00:00:00 2001 From: Moses Palmér Date: Sat, 7 May 2016 15:58:28 +0200 Subject: fbi: add --(no)interactive command line flag --- fbi.c | 2 ++ fbiconfig.c | 5 +++++ fbiconfig.h | 2 ++ 3 files changed, 9 insertions(+) diff --git a/fbi.c b/fbi.c index a2f7e34..cbccc0f 100644 --- a/fbi.c +++ b/fbi.c @@ -121,6 +121,7 @@ int read_ahead; int editable; int blend_msecs; int perfmon = 0; +int interactive = 0; /* font handling */ static char *fontname = NULL; @@ -1383,6 +1384,7 @@ int main(int argc, char *argv[]) h_steps = GET_SCROLL(); timeout = GET_TIMEOUT(); pcd_res = GET_PCD_RES(); + interactive = GET_INTERACTIVE(); fontname = cfg_get_str(O_FONT); filelist = cfg_get_str(O_FILE_LIST); diff --git a/fbiconfig.c b/fbiconfig.c index 6c2a4bc..524e3aa 100644 --- a/fbiconfig.c +++ b/fbiconfig.c @@ -171,6 +171,11 @@ struct cfg_cmdline fbi_cfg[] = { .option = { O_OUTPUT }, .needsarg = 1, .desc = "use drm output (try -info for a list)", + },{ + .cmdline = "interactive", + .option = { O_INTERACTIVE }, + .yesno = 1, + .desc = "allow keyboard interaction", },{ .letter = 'm', .cmdline = "mode", diff --git a/fbiconfig.h b/fbiconfig.h index e98a246..a2178a3 100644 --- a/fbiconfig.h +++ b/fbiconfig.h @@ -30,6 +30,7 @@ #define O_SCROLL O_OPTIONS, "scroll" #define O_TIMEOUT O_OPTIONS, "timeout" #define O_PCD_RES O_OPTIONS, "photocd-res" +#define O_INTERACTIVE O_OPTIONS, "interactive" #define O_DEVICE O_OPTIONS, "device" #define O_OUTPUT O_OPTIONS, "output" @@ -64,6 +65,7 @@ #define GET_SCROLL() cfg_get_int(O_SCROLL, 50) #define GET_TIMEOUT() cfg_get_int(O_TIMEOUT, 0) #define GET_PCD_RES() cfg_get_int(O_PCD_RES, 3) +#define GET_INTERACTIVE() cfg_get_bool(O_INTERACTIVE, 1) #define GET_OPENGL() cfg_get_bool(O_OPENGL, 0) #define GET_PAGEFLIP() cfg_get_bool(O_PAGEFLIP, 1) -- cgit From ba0ddce6c57aa3b94c77d20639954b1644f64a1d Mon Sep 17 00:00:00 2001 From: Moses Palmér Date: Sat, 7 May 2016 16:00:27 +0200 Subject: fbi: simply call sleep in svga_show unless interactive --- fbi.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fbi.c b/fbi.c index cbccc0f..d3eb97c 100644 --- a/fbi.c +++ b/fbi.c @@ -789,6 +789,12 @@ svga_show(struct flist *f, struct flist *prev, if (check_console_switch()) { continue; } + + if (!interactive) { + sleep(timeout); + return -1; + } + FD_ZERO(&set); FD_SET(0, &set); fdmax = 1; -- cgit From a27745ac6fc80c99b3bec53229897ded21fbea80 Mon Sep 17 00:00:00 2001 From: Moses Palmér Date: Sat, 7 May 2016 16:11:33 +0200 Subject: manual: update English manual page with --interactive --- fbi.man | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fbi.man b/fbi.man index 541d0c4..9a67ed8 100644 --- a/fbi.man +++ b/fbi.man @@ -126,6 +126,10 @@ is mapped to. .BI "-m" "\ videomode" ", --mode" "\ videomode" Name of the video mode to use (video mode must be listed in \fI/etc/fb.modes\fP). Default is not to change the video mode. +.TP +.B --(no)interactive +Allow interactively controlling the program from the keyboard. This requires +that \fIstdin\fP is a TTY. Default is to allow interactive control. \# \# .SH ENVIRONMENT -- cgit