From 2ee1bbc7450a125d7804878f77dd8b08309a10e7 Mon Sep 17 00:00:00 2001 From: speedie Date: Sun, 19 Mar 2023 15:00:32 +0100 Subject: [PATCH] add support for overriding minimum width through config --- docs/docs.md | 1 + docs/example.Xresources | 2 +- libs/argv.c | 3 +++ options.h | 2 +- spmenu.1 | 2 ++ 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/docs.md b/docs/docs.md index 17f571c..86a5a1a 100644 --- a/docs/docs.md +++ b/docs/docs.md @@ -32,6 +32,7 @@ Miscellanious: - spmenu -l, --lines line - Set line count to stdin - spmenu -mh, --lineheight height - Set spmenu line height to height +- spmenu -mw, --min-width width - Set minimum width to width - spmenu -g, --columns grid - Set the number of grids to grid - spmenu -gc, --generate-cache - Generate image cache - spmenu -ngc, --no-generate-cache - Don't generate image cache diff --git a/docs/example.Xresources b/docs/example.Xresources index fb4dc9c..2db97b7 100644 --- a/docs/example.Xresources +++ b/docs/example.Xresources @@ -79,7 +79,7 @@ spmenu.casesensitive: 0 spmenu.menuposition: 1 spmenu.menupaddingv: 0 spmenu.menupaddingh: 0 -spmenu.minwidth: 500 +spmenu.minwidth: 1000 !! General spmenu.class: spmenu diff --git a/libs/argv.c b/libs/argv.c index 5b42bfc..28b9b62 100644 --- a/libs/argv.c +++ b/libs/argv.c @@ -162,6 +162,8 @@ readargs(int argc, char *argv[]) } else if (!strcmp(argv[i], "-mh") || (!strcmp(argv[i], "--lineheight"))) { // line height lineheight += atoi(argv[++i]); if (columns == 0) columns = 1; + } else if (!strcmp(argv[i], "-mw") || (!strcmp(argv[i], "--min-width"))) { // line height + minwidth = atoi(argv[++i]); } else if (!strcmp(argv[i], "-lp") || (!strcmp(argv[i], "--vertical-padding"))) { // vertical padding menupaddingv = atoi(argv[++i]); } else if (!strcmp(argv[i], "-hp") || (!strcmp(argv[i], "--horizontal-padding"))) { // horizontal padding @@ -335,6 +337,7 @@ usage(void) "- Arguments -\n" "spmenu -l, --lines Set line count to stdin\n" "spmenu -mh, --lineheight Set spmenu line height to \n" + "spmenu -mw, --min-width Set minimum width to \n" "spmenu -g, --columns Set the number of grids to \n" "spmenu -gc, --generate-cache Generate image cache\n" "spmenu -ngc, --no-generate-cache Don't generate image cache\n" diff --git a/options.h b/options.h index 4919b02..48092bb 100644 --- a/options.h +++ b/options.h @@ -15,7 +15,7 @@ static int alpha = 1; /* Enable alpha */ static int menuposition = 1; /* Position of the menu (0: Bottom, 1: Top, 2: Center */ static int menupaddingv = 0; /* Vertical padding of bar (in pixels) */ static int menupaddingh = 0; /* Horizontal padding of bar (in pixels) */ -static int minwidth = 500; /* Minimum width */ +static int minwidth = 1000; /* Minimum width */ static int managed = 0; /* Let your window manager manage spmenu? */ /* Image options */ diff --git a/spmenu.1 b/spmenu.1 index 2f394f9..bd17a82 100644 --- a/spmenu.1 +++ b/spmenu.1 @@ -54,6 +54,8 @@ spmenu -l, \[en]lines line - Set line count to stdin .IP \[bu] 2 spmenu -mh, \[en]lineheight height - Set spmenu line height to height .IP \[bu] 2 +spmenu -mw, \[en]min-width width - Set minimum width to width +.IP \[bu] 2 spmenu -g, \[en]columns grid - Set the number of grids to grid .IP \[bu] 2 spmenu -gc, \[en]generate-cache - Generate image cache