add -txp/--text-padding option

This commit is contained in:
speedie 2023-03-29 21:37:48 +02:00
parent 93ce81f05f
commit dea326e173
7 changed files with 13 additions and 1 deletions

View file

@ -226,6 +226,9 @@ You may use long, descriptive arguments or the shorter arguments.
`-ig, --image-gaps gaps `
: Set image gaps to gaps
`-txp, --text-padding padding `
: Set text padding to padding
`-lp, --vertical-padding padding `
: Set the vertical padding

View file

@ -5,6 +5,7 @@
!! Fonts
spmenu.font: Noto Sans Mono 8
spmenu.textpadding: 0
!! Colors
spmenu.col_itemnormfg: #bbbbbb

View file

@ -176,6 +176,8 @@ readargs(int argc, char *argv[])
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], "-txp") || (!strcmp(argv[i], "--text-padding"))) { // text padding
textpadding = 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
@ -416,6 +418,7 @@ usage(void)
"spmenu -w, --embed <window id> Embed spmenu inside <window id>\n"
"spmenu -H, --hist-file <hist file> Specify a path to save the history to\n"
"spmenu -ig, --image-gaps <gaps> Set image gaps to <gaps>\n"
"spmenu -txp, --text-padding <padding> Set text padding to <padding>\n"
"spmenu -lp, --vertical-padding <padding> Set the vertical padding\n"
"spmenu -hp, --horizontal-padding <padding> Set the horizontal padding\n"
"spmenu -la, --left-arrow-symbol <symbol> Set the left arrow to <symbol>\n"

View file

@ -98,6 +98,7 @@ ResourcePref resources[] = {
{ "menuposition", INTEGER, &menuposition },
{ "menupaddingv", INTEGER, &menupaddingv },
{ "menupaddingh", INTEGER, &menupaddingh },
{ "textpadding", INTEGER, &textpadding },
{ "indentitems", INTEGER, &indentitems },
{ "accuratewidth", INTEGER, &accuratewidth },
{ "alpha", INTEGER, &alpha },

View file

@ -36,6 +36,7 @@ static int borderwidth = 2; /* Width of the border */
/* Font options */
static char font[] = "Noto Sans Mono 8"; /* Font to draw text and Pango markup with. */
static int textpadding = 0; /* Text padding (lrpad) */
/* Symbol options */
static char *leftarrow = "<"; /* Left arrow, used to indicate you can move to the left */

View file

@ -243,6 +243,9 @@ Specify a path to save the history to
\f[V]-ig, --image-gaps gaps\f[R]
Set image gaps to gaps
.TP
\f[V]-txp, --text-padding padding\f[R]
Set text padding to padding
.TP
\f[V]-lp, --vertical-padding padding\f[R]
Set the vertical padding
.TP

View file

@ -739,7 +739,7 @@ main(int argc, char *argv[])
if (!drw_font_create(drw, fonts, LENGTH(fonts)))
die("no fonts could be loaded.");
lrpad = drw->font->h;
lrpad = drw->font->h + textpadding;
prepare_window_size();
#ifdef __OpenBSD__