Added option -b: disable bar

This commit is contained in:
Bert Münnich 2012-02-16 23:20:27 +01:00
parent b418df7afc
commit 2d4264af28
6 changed files with 18 additions and 6 deletions

View File

@ -1,4 +1,4 @@
VERSION = git-20120215 VERSION = git-20120216
CC = gcc CC = gcc
CFLAGS = -ansi -Wall -pedantic -O2 CFLAGS = -ansi -Wall -pedantic -O2

View File

@ -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: 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 -c Remove all orphaned cache files from thumbnail cache and exit
-d Scale all images to 100%, but fit large images into window -d Scale all images to 100%, but fit large images into window
-F Use size-hints to make the window fixed/floating -F Use size-hints to make the window fixed/floating

View File

@ -32,7 +32,7 @@ options_t _options;
const options_t *options = (const options_t*) &_options; const options_t *options = (const options_t*) &_options;
void print_usage(void) { void print_usage(void) {
printf("usage: sxiv [-cdFfhpqrstvZ] [-g GEOMETRY] [-n NUM] " printf("usage: sxiv [-bcdFfhpqrstvZ] [-g GEOMETRY] [-n NUM] "
"[-z ZOOM] FILES...\n"); "[-z ZOOM] FILES...\n");
} }
@ -52,17 +52,21 @@ void parse_options(int argc, char **argv) {
_options.fixed_win = false; _options.fixed_win = false;
_options.fullscreen = false; _options.fullscreen = false;
_options.hide_bar = false;
_options.geometry = NULL; _options.geometry = NULL;
_options.quiet = false; _options.quiet = false;
_options.thumb_mode = false; _options.thumb_mode = false;
_options.clean_cache = 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) { switch (opt) {
case '?': case '?':
print_usage(); print_usage();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
case 'b':
_options.hide_bar = true;
break;
case 'c': case 'c':
_options.clean_cache = true; _options.clean_cache = true;
break; break;

View File

@ -38,6 +38,7 @@ typedef struct {
/* window: */ /* window: */
bool fixed_win; bool fixed_win;
bool fullscreen; bool fullscreen;
bool hide_bar;
char *geometry; char *geometry;
/* misc flags: */ /* misc flags: */

5
sxiv.1
View File

@ -3,7 +3,7 @@
sxiv \- Simple (or small or suckless) X Image Viewer sxiv \- Simple (or small or suckless) X Image Viewer
.SH SYNOPSIS .SH SYNOPSIS
.B sxiv .B sxiv
.RB [ \-cdFfhpqrstvZ ] .RB [ \-bcdFfhpqrstvZ ]
.RB [ \-g .RB [ \-g
.IR GEOMETRY ] .IR GEOMETRY ]
.RB [ \-n .RB [ \-n
@ -33,6 +33,9 @@ Please note, that the fullscreen mode requires an EWMH/NetWM compliant window
manager. manager.
.SH OPTIONS .SH OPTIONS
.TP .TP
.B \-b
Do not show info bar on bottom of window.
.TP
.B \-c .B \-c
Remove all orphaned cache files from the thumbnail cache directory and exit. Remove all orphaned cache files from the thumbnail cache directory and exit.
.TP .TP

View File

@ -121,6 +121,7 @@ void win_init(win_t *win) {
win->xwin = 0; win->xwin = 0;
win->pm = 0; win->pm = 0;
win->fullscreen = false; win->fullscreen = false;
win->barh = 0;
win->lbar = NULL; win->lbar = NULL;
win->rbar = NULL; win->rbar = NULL;
@ -209,8 +210,10 @@ void win_open(win_t *win) {
classhint.res_class = "sxiv"; classhint.res_class = "sxiv";
XSetClassHint(e->dpy, win->xwin, &classhint); XSetClassHint(e->dpy, win->xwin, &classhint);
win->barh = font.ascent + font.descent + 2 * V_TEXT_PAD; if (!options->hide_bar) {
win->h -= win->barh; win->barh = font.ascent + font.descent + 2 * V_TEXT_PAD;
win->h -= win->barh;
}
if (options->fixed_win) if (options->fixed_win)
win_set_sizehints(win); win_set_sizehints(win);