dwl-patches/patches/barpadding/barpadding.patch
2024-06-10 16:38:25 +03:00

63 lines
2.2 KiB
Diff

From 69af490e9ad6213463c043db736547bffddd77d2 Mon Sep 17 00:00:00 2001
From: sewn <sewn@disroot.org>
Date: Mon, 10 Jun 2024 16:33:52 +0300
Subject: [PATCH] add vertical and horizontal spacing to bar
https://dwm.suckless.org/patches/barpadding/
---
config.def.h | 2 ++
dwl.c | 10 +++++-----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/config.def.h b/config.def.h
index d0bb5bc..8dc2e85 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 pixman_color_t normbarfg = { 0xbbbb, 0xbbbb, 0xbbbb, 0xffff };
static pixman_color_t normbarbg = { 0x2222, 0x2222, 0x2222, 0xffff };
diff --git a/dwl.c b/dwl.c
index cd484bd..eec0dd7 100644
--- a/dwl.c
+++ b/dwl.c
@@ -572,8 +572,8 @@ arrangelayers(Monitor *m)
return;
if (m->showbar) {
- usable_area.height -= m->b.real_height;
- usable_area.y += topbar ? m->b.real_height : 0;
+ usable_area.height -= m->b.real_height + vertpad;
+ usable_area.y += topbar ? m->b.height + vertpad : 0;
}
/* Arrange exclusive surfaces from top->bottom */
@@ -1424,8 +1424,8 @@ drawbar(Monitor *m)
pixman_image_unref(pix);
wlr_scene_buffer_set_dest_size(m->scene_buffer,
m->b.real_width, m->b.real_height);
- wlr_scene_node_set_position(&m->scene_buffer->node, m->m.x,
- m->m.y + (topbar ? 0 : m->m.height - m->b.real_height));
+ wlr_scene_node_set_position(&m->scene_buffer->node, m->m.x + sidepad,
+ m->m.y + (topbar ? vertpad : m->m.height - m->b.real_height - vertpad));
wlr_scene_buffer_set_buffer(m->scene_buffer, &buf->base);
wlr_buffer_drop(&buf->base);
}
@@ -3007,7 +3007,7 @@ updatebar(Monitor *m)
char fontattrs[12];
wlr_output_transformed_resolution(m->wlr_output, &rw, &rh);
- m->b.width = rw;
+ m->b.width = rw - 2 * sidepad;
m->b.real_width = (int)((float)m->b.width / m->wlr_output->scale);
if (m->b.scale == m->wlr_output->scale && m->font)
--
2.45.0