-
Notifications
You must be signed in to change notification settings - Fork 30
/
dmenu-barpadding-5.3.diff
59 lines (54 loc) · 2 KB
/
dmenu-barpadding-5.3.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
From dfc9dd2553999b10dc45d4d678452b5e5324dc90 Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Sun, 20 Mar 2022 15:26:13 +0100
Subject: [PATCH] Adding barpadding patch for dmenu
---
config.def.h | 3 +++
dmenu.c | 7 ++++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/config.def.h b/config.def.h
index 1edb647..4251c09 100644
--- a/config.def.h
+++ b/config.def.h
@@ -2,6 +2,9 @@
/* Default settings; can be overriden by command line. */
static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */
+static const int vertpad = 10; /* vertical padding of bar */
+static const int sidepad = 10; /* horizontal padding of bar */
+
/* -fn option overrides fonts[0]; default X11 font or font set */
static const char *fonts[] = {
"monospace:size=10"
diff --git a/dmenu.c b/dmenu.c
index 40f93e0..f75c480 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -38,6 +38,8 @@ static char *embed;
static int bh, mw, mh;
static int inputw = 0, promptw;
static int lrpad; /* sum of left and right padding */
+static int vp; /* vertical padding for bar */
+static int sp; /* side padding for bar */
static size_t cursor;
static struct item *items = NULL;
static struct item *matches, *matchend;
@@ -684,7 +686,7 @@ setup(void)
swa.override_redirect = True;
swa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask;
- win = XCreateWindow(dpy, root, x, y, mw, mh, 0,
+ win = XCreateWindow(dpy, root, x + sp, y + vp, mw - 2 * sp, mh, 0,
CopyFromParent, CopyFromParent, CopyFromParent,
CWOverrideRedirect | CWBackPixel | CWEventMask, &swa);
XSetClassHint(dpy, win, &ch);
@@ -777,6 +779,9 @@ main(int argc, char *argv[])
die("no fonts could be loaded.");
lrpad = drw->fonts->h;
+ sp = sidepad;
+ vp = (topbar == 1) ? vertpad : - vertpad;
+
#ifdef __OpenBSD__
if (pledge("stdio rpath", NULL) == -1)
die("pledge");
--
2.45.2