mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2025-09-08 12:14:50 +00:00

Eliminated wiki. Individual patches have a README.md explanation in their own subdirectory. Simplified submission of new patches and maintenance of existing patches. Instructions page (README.md autodisplayed) is now at https://codeberg.org/dwl/dwl-patches/
79 lines
2.5 KiB
Diff
79 lines
2.5 KiB
Diff
From 7fe1a19287e1f40d90efd0c3b314c178cb27a571 Mon Sep 17 00:00:00 2001
|
|
From: sewn <sewn@disroot.org>
|
|
Date: Sun, 14 Apr 2024 08:02:56 +0300
|
|
Subject: [PATCH] port barpadding patch to bar for dwl
|
|
|
|
---
|
|
config.def.h | 2 ++
|
|
dwl.c | 13 ++++++++-----
|
|
2 files changed, 10 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/config.def.h b/config.def.h
|
|
index 0be3ad0..423330b 100644
|
|
--- a/config.def.h
|
|
+++ b/config.def.h
|
|
@@ -17,6 +17,8 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
|
|
/* bar */
|
|
static const int showbar = 1; /* 0 means no bar */
|
|
static const int topbar = 1; /* 0 means bottom bar */
|
|
+static const int vertpad = 10; /* vertical padding of bar */
|
|
+static const int sidepad = 10; /* horizontal padding of bar */
|
|
static const char *fonts[] = {"monospace:size=10"};
|
|
static const char *fontattrs = "dpi=96";
|
|
static pixman_color_t normbarfg = { 0xbbbb, 0xbbbb, 0xbbbb, 0xffff };
|
|
diff --git a/dwl.c b/dwl.c
|
|
index 54273ae..b19d1a3 100644
|
|
--- a/dwl.c
|
|
+++ b/dwl.c
|
|
@@ -431,6 +431,7 @@ static struct wl_list mons;
|
|
static Monitor *selmon;
|
|
|
|
static struct fcft_font *font;
|
|
+static int vp, sp;
|
|
static int bh;
|
|
static int lrpad;
|
|
static char stext[256];
|
|
@@ -569,8 +570,8 @@ arrangelayers(Monitor *m)
|
|
return;
|
|
|
|
if (m->showbar) {
|
|
- usable_area.height -= m->b.height;
|
|
- usable_area.y += topbar ? m->b.height : 0;
|
|
+ usable_area.height = usable_area.height - vertpad - m->b.height;
|
|
+ usable_area.y = topbar ? usable_area.y + m->b.height + vp : usable_area.y;
|
|
}
|
|
|
|
/* Arrange exclusive surfaces from top->bottom */
|
|
@@ -1419,8 +1420,8 @@ drawbar(Monitor *mon)
|
|
}
|
|
|
|
pixman_image_unref(pix);
|
|
- wlr_scene_node_set_position(&mon->scene_buffer->node, mon->m.x,
|
|
- mon->m.y + (topbar ? 0 : mon->m.height - mon->b.height));
|
|
+ wlr_scene_node_set_position(&mon->scene_buffer->node, mon->m.x + sp,
|
|
+ mon->m.y + vp + (topbar ? 0 : mon->m.height - mon->b.height));
|
|
wlr_scene_buffer_set_buffer(mon->scene_buffer, &buf->base);
|
|
wlr_buffer_drop(&buf->base);
|
|
}
|
|
@@ -2665,6 +2666,8 @@ setup(void)
|
|
|
|
lrpad = font->height;
|
|
bh = font->height + 2;
|
|
+ sp = sidepad;
|
|
+ vp = (topbar == 1) ? vertpad : - vertpad;
|
|
|
|
status_event_source = wl_event_loop_add_fd(wl_display_get_event_loop(dpy),
|
|
STDIN_FILENO, WL_EVENT_READABLE, status_in, NULL);
|
|
@@ -3004,7 +3007,7 @@ updatebardims(Monitor *m)
|
|
{
|
|
int rw, rh;
|
|
wlr_output_effective_resolution(m->wlr_output, &rw, &rh);
|
|
- m->b.width = rw;
|
|
+ m->b.width = rw - 2 * sp;
|
|
m->b.height = bh;
|
|
}
|
|
|
|
--
|
|
2.44.0
|
|
|