Krolyxon
Commit 2d4264a

Branches

Refs →

nsxiv2d4264a

Added option -b: disable bar

Author
Bert Münnich
Date
2012-02-16 23:20 +0100
Parent
b418df7
Commit
2d4264af286db2a746d600139a12472841c2677d

+18 −6

6 files changed

  1. M Makefile +1 −1
  2. M README.md +1 −0
  3. M options.c +6 −2
  4. M options.h +1 −0
  5. M sxiv.1 +4 −1
  6. M window.c +5 −2
M Makefile View
@@ -1,4 +1,4 @@
1−VERSION = git-20120215
1+VERSION = git-20120216
22
33 CC = gcc
44 CFLAGS = -ansi -Wall -pedantic -O2
M README.md View
@@ -60,6 +60,7 @@ of small previews is displayed, making it easy to choose an image to open.
6060
6161 sxiv supports the following command-line options:
6262
63+ -b Do not show info bar on bottom of window
6364 -c Remove all orphaned cache files from thumbnail cache and exit
6465 -d Scale all images to 100%, but fit large images into window
6566 -F Use size-hints to make the window fixed/floating
M options.c View
@@ -32,7 +32,7 @@ options_t _options;
3232 const options_t *options = (const options_t*) &_options;
3333
3434 void print_usage(void) {
35− printf("usage: sxiv [-cdFfhpqrstvZ] [-g GEOMETRY] [-n NUM] "
35+ printf("usage: sxiv [-bcdFfhpqrstvZ] [-g GEOMETRY] [-n NUM] "
3636 "[-z ZOOM] FILES...\n");
3737 }
3838
@@ -52,17 +52,21 @@ void parse_options(int argc, char **argv) {
5252
5353 _options.fixed_win = false;
5454 _options.fullscreen = false;
55+ _options.hide_bar = false;
5556 _options.geometry = NULL;
5657
5758 _options.quiet = false;
5859 _options.thumb_mode = false;
5960 _options.clean_cache = false;
6061
61− while ((opt = getopt(argc, argv, "cdFfg:hn:pqrstvZz:")) != -1) {
62+ while ((opt = getopt(argc, argv, "bcdFfg:hn:pqrstvZz:")) != -1) {
6263 switch (opt) {
6364 case '?':
6465 print_usage();
6566 exit(EXIT_FAILURE);
67+ case 'b':
68+ _options.hide_bar = true;
69+ break;
6670 case 'c':
6771 _options.clean_cache = true;
6872 break;
M options.h View
@@ -38,6 +38,7 @@ typedef struct {
3838 /* window: */
3939 bool fixed_win;
4040 bool fullscreen;
41+ bool hide_bar;
4142 char *geometry;
4243
4344 /* misc flags: */
M sxiv.1 View
@@ -3,7 +3,7 @@
33 sxiv \- Simple (or small or suckless) X Image Viewer
44 .SH SYNOPSIS
55 .B sxiv
6−.RB [ \-cdFfhpqrstvZ ]
6+.RB [ \-bcdFfhpqrstvZ ]
77 .RB [ \-g
88 .IR GEOMETRY ]
99 .RB [ \-n
@@ -33,6 +33,9 @@ Please note, that the fullscreen mode requires an EWMH/NetWM compliant window
3333 manager.
3434 .SH OPTIONS
3535 .TP
36+.B \-b
37+Do not show info bar on bottom of window.
38+.TP
3639 .B \-c
3740 Remove all orphaned cache files from the thumbnail cache directory and exit.
3841 .TP
M window.c View
@@ -121,6 +121,7 @@ void win_init(win_t *win) {
121121 win->xwin = 0;
122122 win->pm = 0;
123123 win->fullscreen = false;
124+ win->barh = 0;
124125 win->lbar = NULL;
125126 win->rbar = NULL;
126127
@@ -209,8 +210,10 @@ void win_open(win_t *win) {
209210 classhint.res_class = "sxiv";
210211 XSetClassHint(e->dpy, win->xwin, &classhint);
211212
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+ }
214217
215218 if (options->fixed_win)
216219 win_set_sizehints(win);