aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikita Langer <nikitalanger@icloud.com>2026-07-13 18:48:05 +0200
committerNikita Langer <nikitalanger@icloud.com>2026-07-13 18:48:05 +0200
commit9e4d85298b8006919b093e67ff0ec6cc18ea93d7 (patch)
tree26f8a7a9d8b86ea754d0b9f95b439a6a289bf730
parent25bdca748a152441a0e4d7b1aee84d5edb3aac61 (diff)
downloaddmenu-9e4d85298b8006919b093e67ff0ec6cc18ea93d7.tar.gz
dmenu-9e4d85298b8006919b093e67ff0ec6cc18ea93d7.tar.bz2
dmenu-9e4d85298b8006919b093e67ff0ec6cc18ea93d7.tar.xz
dmenu-9e4d85298b8006919b093e67ff0ec6cc18ea93d7.zip
dmenu padding wie dmw-bar-patchHEADmaster
-rw-r--r--config.def.h6
-rw-r--r--dmenu.110
-rw-r--r--dmenu.c18
-rw-r--r--patches/README.md1
4 files changed, 26 insertions, 9 deletions
diff --git a/config.def.h b/config.def.h
index 9beffbc..9673152 100644
--- a/config.def.h
+++ b/config.def.h
@@ -14,8 +14,10 @@
static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */
static int draw_input = 1; /* -noi option; if 0, the input will not be drawn by default */
static int centered = 0; /* -c option; centers dmenu on screen */
-static int min_width = 500; /* minimum width when centered */
-static const float menu_height_ratio = 4.0f; /* This is the ratio used in the original calculation */
+ int vertpad = 0; /* vertical padding of bar */
+ int sidepad = 0; /* horizontal padding of bar */
+static int min_width = 500; /* minimum width when centered */
+static const float menu_height_ratio = 4.0f;/* This is the ratio used in the original calculation */
static const unsigned int alpha = 0xee; /* Amount of opacity. 0xff is opaque */
/* -fn option overrides fonts[0]; default X11 font or font set */
static char font[] = "JetBrains Mono Nerd Font Propo:size=10";
diff --git a/dmenu.1 b/dmenu.1
index d672902..f7650b1 100644
--- a/dmenu.1
+++ b/dmenu.1
@@ -36,6 +36,10 @@ dmenu \- dynamic menu
.IR windowid ]
.RB [ \-it
.IR text ]
+.RB [ \-sp
+.IR sidepad ]
+.RB [ \-vp
+.IR vertpad ]
.P
.BR dmenu_run " ..."
.SH DESCRIPTION
@@ -127,6 +131,12 @@ embed into windowid.
.TP
.BI \-it " text".
start with initial text input.
+.TP
+.BI \-sp " sidepad".
+change horizontal padding around dmenu.
+.TP
+.BI \-vp " vertpad".
+change vertical padding around dmenu.
.SH USAGE
dmenu is completely controlled by the keyboard. Items are selected using the
arrow keys, page up, page down, home, and end.
diff --git a/dmenu.c b/dmenu.c
index 6565563..346039d 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -1061,9 +1061,9 @@ setup(void)
x = info[i].x_org + ((info[i].width - mw) / 2);
y = info[i].y_org + ((info[i].height - mh) / menu_height_ratio);
} else {
- x = info[i].x_org + dmx;
- y = info[i].y_org + (topbar ? dmy : info[i].height - mh - dmy);
- mw = (dmw>0 ? dmw : info[i].width);;
+ x = info[i].x_org + dmx + sidepad;
+ y = info[i].y_org + (topbar ? dmy : info[i].height - mh - dmy) + vertpad;
+ mw = (dmw>0 ? dmw : info[i].width) - 2 * sidepad;;
}
XFree(info);
@@ -1079,9 +1079,9 @@ setup(void)
x = (wa.width - mw) / 2;
y = (wa.height - mh) / 2;
} else {
- x = dmx;
- y = topbar ? dmy : wa.height - mh - dmy;
- mw = (dmw>0 ? dmw : wa.width);
+ x = dmx + sidepad;
+ y = topbar ? dmy : wa.height - mh - dmy + vertpad;
+ mw = (dmw>0 ? dmw : wa.width) - 2 * sidepad;
}
}
promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0;
@@ -1127,7 +1127,7 @@ usage(void)
{
die("usage: dmenu [-bfiv] [-noi] [-l lines] [-p prompt] [-fn font] [-m monitor]\n"
" [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n"
- " [-x xoffset] [-y yoffset] [-z width]\n"
+ " [-x xoffset] [-y yoffset] [-z width] [-vp vertpad] [-sp sidepad]\n"
" [-it text]\n", stderr);
}
@@ -1196,6 +1196,10 @@ main(int argc, char *argv[])
dmy = atoi(argv[++i]);
else if (!strcmp(argv[i], "-z")) /* make dmenu this wide */
dmw = atoi(argv[++i]);
+ else if (!strcmp(argv[i], "-vp")) /* vertical padding */
+ vertpad = atoi(argv[++i]);
+ else if (!strcmp(argv[i], "-sp")) /* horizontal padding */
+ sidepad = atoi(argv[++i]);
else if (!strcmp(argv[i], "-bw"))
border_width = atoi(argv[++i]); /* border width */
else if (!strcmp(argv[i], "-it")) { /* embedding window id */
diff --git a/patches/README.md b/patches/README.md
index f25581b..a0717c2 100644
--- a/patches/README.md
+++ b/patches/README.md
@@ -1,2 +1,3 @@
# eigen
- vi-mode integration für gridnav
+- padding um dmenu wie dwm-bar-patch