Set scale mode at startup via argument to -s option
This commit is contained in:
parent
43a04c4757
commit
997c8518c5
|
@ -82,7 +82,7 @@ of small previews is displayed, making it easy to choose an image to open.
|
|||
-q Be quiet, disable warnings
|
||||
-r Search given directories recursively for images
|
||||
-S DELAY Enable slideshow and set slideshow delay to DELAY seconds
|
||||
-s Fit images to window
|
||||
-s MODE Set scale mode to MODE ([d]own, [f]it, [w]idth, [h]eight)
|
||||
-t Start in thumbnail mode
|
||||
-v Print version information and exit
|
||||
-Z Same as `-z 100'
|
||||
|
|
16
options.c
16
options.c
|
@ -33,8 +33,8 @@ const options_t *options = (const options_t*) &_options;
|
|||
|
||||
void print_usage(void)
|
||||
{
|
||||
printf("usage: sxiv [-bcFfhioqrstvZ] [-G GAMMA] [-g GEOMETRY] [-n NUM] "
|
||||
"[-N NAME] [-S DELAY] [-z ZOOM] FILES...\n");
|
||||
printf("usage: sxiv [-bcFfhioqrtvZ] [-G GAMMA] [-g GEOMETRY] [-n NUM] "
|
||||
"[-N NAME] [-S DELAY] [-s MODE] [-z ZOOM] FILES...\n");
|
||||
}
|
||||
|
||||
void print_version(void)
|
||||
|
@ -45,7 +45,8 @@ void print_version(void)
|
|||
void parse_options(int argc, char **argv)
|
||||
{
|
||||
int n, opt;
|
||||
char *end;
|
||||
char *end, *s;
|
||||
const char *scalemodes = "dfwh";
|
||||
|
||||
_options.from_stdin = false;
|
||||
_options.to_stdout = false;
|
||||
|
@ -67,7 +68,7 @@ void parse_options(int argc, char **argv)
|
|||
_options.thumb_mode = false;
|
||||
_options.clean_cache = false;
|
||||
|
||||
while ((opt = getopt(argc, argv, "bcFfG:g:hin:N:oqrS:stvZz:")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "bcFfG:g:hin:N:oqrS:s:tvZz:")) != -1) {
|
||||
switch (opt) {
|
||||
case '?':
|
||||
print_usage();
|
||||
|
@ -130,7 +131,12 @@ void parse_options(int argc, char **argv)
|
|||
_options.slideshow = n;
|
||||
break;
|
||||
case 's':
|
||||
_options.scalemode = SCALE_FIT;
|
||||
s = strchr(scalemodes, optarg[0]);
|
||||
if (s == NULL || *s == '\0' || strlen(optarg) != 1) {
|
||||
fprintf(stderr, "sxiv: invalid argument for option -s: %s\n", optarg);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
_options.scalemode = s - scalemodes;
|
||||
break;
|
||||
case 't':
|
||||
_options.thumb_mode = true;
|
||||
|
|
14
sxiv.1
14
sxiv.1
|
@ -3,7 +3,7 @@
|
|||
sxiv \- Simple X Image Viewer
|
||||
.SH SYNOPSIS
|
||||
.B sxiv
|
||||
.RB [ \-bcFfhioqrstvZ ]
|
||||
.RB [ \-bcFfhioqrtvZ ]
|
||||
.RB [ \-G
|
||||
.IR GAMMA ]
|
||||
.RB [ \-g
|
||||
|
@ -14,6 +14,8 @@ sxiv \- Simple X Image Viewer
|
|||
.IR NUM ]
|
||||
.RB [ \-S
|
||||
.IR DELAY ]
|
||||
.RB [ \-s
|
||||
.IR MODE ]
|
||||
.RB [ \-z
|
||||
.IR ZOOM ]
|
||||
.IR FILE ...
|
||||
|
@ -50,8 +52,7 @@ Set image gamma to GAMMA (-32..32).
|
|||
.TP
|
||||
.BI "\-g " GEOMETRY
|
||||
Set window position and size. See section GEOMETRY SPECIFICATIONS of X(7) for
|
||||
more information on
|
||||
.IR GEOMETRY .
|
||||
more information on GEOMETRY argument.
|
||||
.TP
|
||||
.BI "\-N " NAME
|
||||
Set the resource name of sxiv's X window to NAME.
|
||||
|
@ -68,7 +69,7 @@ Read names of files to open from standard input.
|
|||
.B \-o
|
||||
Write list of all marked files to standard output when quitting. In combination
|
||||
with
|
||||
.I \-i
|
||||
.B \-i
|
||||
sxiv can be used as a visual filter/pipe.
|
||||
.TP
|
||||
.B \-q
|
||||
|
@ -80,8 +81,9 @@ Search the given directories recursively for images to view.
|
|||
.BI "\-S " DELAY
|
||||
Start in slideshow mode. Set the delay between images to DELAY seconds.
|
||||
.TP
|
||||
.B \-s
|
||||
Fit images to window.
|
||||
.BI "\-s " MODE
|
||||
Set scale mode according to MODE character. Supported modes are: [d]own,
|
||||
[f]it, [w]idth, [h]eight.
|
||||
.TP
|
||||
.B \-t
|
||||
Start in thumbnail mode.
|
||||
|
|
Loading…
Reference in New Issue