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
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:
-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

View File

@ -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;

View File

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

5
sxiv.1
View File

@ -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

View File

@ -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);