From 2d4264af286db2a746d600139a12472841c2677d Mon Sep 17 00:00:00 2001 From: Bert Münnich Date: Thu, 16 Feb 2012 23:20:27 +0100 Subject: Added option -b: disable bar --- Makefile | 2 +- README.md | 1 + options.c | 8 ++++++-- options.h | 1 + sxiv.1 | 5 ++++- window.c | 7 +++++-- 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 0991f6c..c6f632f 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION = git-20120215 +VERSION = git-20120216 CC = gcc CFLAGS = -ansi -Wall -pedantic -O2 diff --git a/README.md b/README.md index b651044..5950ad1 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ of small previews is displayed, making it easy to choose an image to open. sxiv supports the following command-line options: + -b Do not show info bar on bottom of window -c Remove all orphaned cache files from thumbnail cache and exit -d Scale all images to 100%, but fit large images into window -F Use size-hints to make the window fixed/floating diff --git a/options.c b/options.c index 474eaf4..deec097 100644 --- a/options.c +++ b/options.c @@ -32,7 +32,7 @@ options_t _options; const options_t *options = (const options_t*) &_options; void print_usage(void) { - printf("usage: sxiv [-cdFfhpqrstvZ] [-g GEOMETRY] [-n NUM] " + printf("usage: sxiv [-bcdFfhpqrstvZ] [-g GEOMETRY] [-n NUM] " "[-z ZOOM] FILES...\n"); } @@ -52,17 +52,21 @@ void parse_options(int argc, char **argv) { _options.fixed_win = false; _options.fullscreen = false; + _options.hide_bar = false; _options.geometry = NULL; _options.quiet = false; _options.thumb_mode = false; _options.clean_cache = false; - while ((opt = getopt(argc, argv, "cdFfg:hn:pqrstvZz:")) != -1) { + while ((opt = getopt(argc, argv, "bcdFfg:hn:pqrstvZz:")) != -1) { switch (opt) { case '?': print_usage(); exit(EXIT_FAILURE); + case 'b': + _options.hide_bar = true; + break; case 'c': _options.clean_cache = true; break; diff --git a/options.h b/options.h index ae0476d..aa93a0c 100644 --- a/options.h +++ b/options.h @@ -38,6 +38,7 @@ typedef struct { /* window: */ bool fixed_win; bool fullscreen; + bool hide_bar; char *geometry; /* misc flags: */ diff --git a/sxiv.1 b/sxiv.1 index f9d7331..29188fa 100644 --- a/sxiv.1 +++ b/sxiv.1 @@ -3,7 +3,7 @@ sxiv \- Simple (or small or suckless) X Image Viewer .SH SYNOPSIS .B sxiv -.RB [ \-cdFfhpqrstvZ ] +.RB [ \-bcdFfhpqrstvZ ] .RB [ \-g .IR GEOMETRY ] .RB [ \-n @@ -33,6 +33,9 @@ Please note, that the fullscreen mode requires an EWMH/NetWM compliant window manager. .SH OPTIONS .TP +.B \-b +Do not show info bar on bottom of window. +.TP .B \-c Remove all orphaned cache files from the thumbnail cache directory and exit. .TP diff --git a/window.c b/window.c index 673852c..f66703e 100644 --- a/window.c +++ b/window.c @@ -121,6 +121,7 @@ void win_init(win_t *win) { win->xwin = 0; win->pm = 0; win->fullscreen = false; + win->barh = 0; win->lbar = NULL; win->rbar = NULL; @@ -209,8 +210,10 @@ void win_open(win_t *win) { classhint.res_class = "sxiv"; XSetClassHint(e->dpy, win->xwin, &classhint); - win->barh = font.ascent + font.descent + 2 * V_TEXT_PAD; - win->h -= win->barh; + if (!options->hide_bar) { + win->barh = font.ascent + font.descent + 2 * V_TEXT_PAD; + win->h -= win->barh; + } if (options->fixed_win) win_set_sizehints(win); -- cgit v1.2.3-54-g00ecf