nsxiv2d4264a
Added option -b: disable bar
+18 −6
6 files changed
- M Makefile +1 −1
- M README.md +1 −0
- M options.c +6 −2
- M options.h +1 −0
- M sxiv.1 +4 −1
- M window.c +5 −2
| @@ -1,4 +1,4 @@ | |||
| 1 | − | VERSION = git-20120215 | |
| 1 | + | VERSION = git-20120216 | |
| 2 | 2 | ||
| 3 | 3 | CC = gcc | |
| 4 | 4 | CFLAGS = -ansi -Wall -pedantic -O2 | |
| @@ -60,6 +60,7 @@ of small previews is displayed, making it easy to choose an image to open. | |||
| 60 | 60 | ||
| 61 | 61 | sxiv supports the following command-line options: | |
| 62 | 62 | ||
| 63 | + | -b Do not show info bar on bottom of window | |
| 63 | 64 | -c Remove all orphaned cache files from thumbnail cache and exit | |
| 64 | 65 | -d Scale all images to 100%, but fit large images into window | |
| 65 | 66 | -F Use size-hints to make the window fixed/floating | |
| @@ -32,7 +32,7 @@ options_t _options; | |||
| 32 | 32 | const options_t *options = (const options_t*) &_options; | |
| 33 | 33 | ||
| 34 | 34 | void print_usage(void) { | |
| 35 | − | printf("usage: sxiv [-cdFfhpqrstvZ] [-g GEOMETRY] [-n NUM] " | |
| 35 | + | printf("usage: sxiv [-bcdFfhpqrstvZ] [-g GEOMETRY] [-n NUM] " | |
| 36 | 36 | "[-z ZOOM] FILES...\n"); | |
| 37 | 37 | } | |
| 38 | 38 | ||
| @@ -52,17 +52,21 @@ void parse_options(int argc, char **argv) { | |||
| 52 | 52 | ||
| 53 | 53 | _options.fixed_win = false; | |
| 54 | 54 | _options.fullscreen = false; | |
| 55 | + | _options.hide_bar = false; | |
| 55 | 56 | _options.geometry = NULL; | |
| 56 | 57 | ||
| 57 | 58 | _options.quiet = false; | |
| 58 | 59 | _options.thumb_mode = false; | |
| 59 | 60 | _options.clean_cache = false; | |
| 60 | 61 | ||
| 61 | − | while ((opt = getopt(argc, argv, "cdFfg:hn:pqrstvZz:")) != -1) { | |
| 62 | + | while ((opt = getopt(argc, argv, "bcdFfg:hn:pqrstvZz:")) != -1) { | |
| 62 | 63 | switch (opt) { | |
| 63 | 64 | case '?': | |
| 64 | 65 | print_usage(); | |
| 65 | 66 | exit(EXIT_FAILURE); | |
| 67 | + | case 'b': | |
| 68 | + | _options.hide_bar = true; | |
| 69 | + | break; | |
| 66 | 70 | case 'c': | |
| 67 | 71 | _options.clean_cache = true; | |
| 68 | 72 | break; | |
| @@ -38,6 +38,7 @@ typedef struct { | |||
| 38 | 38 | /* window: */ | |
| 39 | 39 | bool fixed_win; | |
| 40 | 40 | bool fullscreen; | |
| 41 | + | bool hide_bar; | |
| 41 | 42 | char *geometry; | |
| 42 | 43 | ||
| 43 | 44 | /* misc flags: */ | |
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | sxiv \- Simple (or small or suckless) X Image Viewer | |
| 4 | 4 | .SH SYNOPSIS | |
| 5 | 5 | .B sxiv | |
| 6 | − | .RB [ \-cdFfhpqrstvZ ] | |
| 6 | + | .RB [ \-bcdFfhpqrstvZ ] | |
| 7 | 7 | .RB [ \-g | |
| 8 | 8 | .IR GEOMETRY ] | |
| 9 | 9 | .RB [ \-n | |
| @@ -33,6 +33,9 @@ Please note, that the fullscreen mode requires an EWMH/NetWM compliant window | |||
| 33 | 33 | manager. | |
| 34 | 34 | .SH OPTIONS | |
| 35 | 35 | .TP | |
| 36 | + | .B \-b | |
| 37 | + | Do not show info bar on bottom of window. | |
| 38 | + | .TP | |
| 36 | 39 | .B \-c | |
| 37 | 40 | Remove all orphaned cache files from the thumbnail cache directory and exit. | |
| 38 | 41 | .TP | |
| @@ -121,6 +121,7 @@ void win_init(win_t *win) { | |||
| 121 | 121 | win->xwin = 0; | |
| 122 | 122 | win->pm = 0; | |
| 123 | 123 | win->fullscreen = false; | |
| 124 | + | win->barh = 0; | |
| 124 | 125 | win->lbar = NULL; | |
| 125 | 126 | win->rbar = NULL; | |
| 126 | 127 | ||
| @@ -209,8 +210,10 @@ void win_open(win_t *win) { | |||
| 209 | 210 | classhint.res_class = "sxiv"; | |
| 210 | 211 | XSetClassHint(e->dpy, win->xwin, &classhint); | |
| 211 | 212 | ||
| 212 | − | win->barh = font.ascent + font.descent + 2 * V_TEXT_PAD; | |
| 213 | − | win->h -= win->barh; | |
| 213 | + | if (!options->hide_bar) { | |
| 214 | + | win->barh = font.ascent + font.descent + 2 * V_TEXT_PAD; | |
| 215 | + | win->h -= win->barh; | |
| 216 | + | } | |
| 214 | 217 | ||
| 215 | 218 | if (options->fixed_win) | |
| 216 | 219 | win_set_sizehints(win); | |