mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2025-10-27 10:14:16 +00:00
barpadding: bar 2024-06-10
This commit is contained in:
parent
6f1648cee8
commit
2c021f570f
@ -3,7 +3,7 @@
|
|||||||
Add vertical and horizontal space between the [bar](https://codeberg.org/dwl/dwl-patches/wiki/bar) and the edge of the screen.
|
Add vertical and horizontal space between the [bar](https://codeberg.org/dwl/dwl-patches/wiki/bar) and the edge of the screen.
|
||||||
|
|
||||||
### Download
|
### Download
|
||||||
- [2024-04-14](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/barpadding/barpadding.patch) (bar 2024-04-14)
|
- [2024-06-10](https://codeberg.org/dwl/dwl-patches/raw/branch/main/patches/barpadding/barpadding.patch) (bar 2024-06-10)
|
||||||
|
|
||||||
### Authors
|
### Authors
|
||||||
- [sewn](https://codeberg.org/sewn)
|
- [sewn](https://codeberg.org/sewn)
|
||||||
|
|||||||
@ -1,15 +1,16 @@
|
|||||||
From 7fe1a19287e1f40d90efd0c3b314c178cb27a571 Mon Sep 17 00:00:00 2001
|
From 69af490e9ad6213463c043db736547bffddd77d2 Mon Sep 17 00:00:00 2001
|
||||||
From: sewn <sewn@disroot.org>
|
From: sewn <sewn@disroot.org>
|
||||||
Date: Sun, 14 Apr 2024 08:02:56 +0300
|
Date: Mon, 10 Jun 2024 16:33:52 +0300
|
||||||
Subject: [PATCH] port barpadding patch to bar for dwl
|
Subject: [PATCH] add vertical and horizontal spacing to bar
|
||||||
|
|
||||||
|
https://dwm.suckless.org/patches/barpadding/
|
||||||
---
|
---
|
||||||
config.def.h | 2 ++
|
config.def.h | 2 ++
|
||||||
dwl.c | 13 ++++++++-----
|
dwl.c | 10 +++++-----
|
||||||
2 files changed, 10 insertions(+), 5 deletions(-)
|
2 files changed, 7 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
diff --git a/config.def.h b/config.def.h
|
diff --git a/config.def.h b/config.def.h
|
||||||
index 0be3ad0..423330b 100644
|
index d0bb5bc..8dc2e85 100644
|
||||||
--- a/config.def.h
|
--- a/config.def.h
|
||||||
+++ b/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
|
@@ -17,6 +17,8 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
|
||||||
@ -19,60 +20,43 @@ index 0be3ad0..423330b 100644
|
|||||||
+static const int vertpad = 10; /* vertical padding of bar */
|
+static const int vertpad = 10; /* vertical padding of bar */
|
||||||
+static const int sidepad = 10; /* horizontal padding of bar */
|
+static const int sidepad = 10; /* horizontal padding of bar */
|
||||||
static const char *fonts[] = {"monospace:size=10"};
|
static const char *fonts[] = {"monospace:size=10"};
|
||||||
static const char *fontattrs = "dpi=96";
|
|
||||||
static pixman_color_t normbarfg = { 0xbbbb, 0xbbbb, 0xbbbb, 0xffff };
|
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
|
diff --git a/dwl.c b/dwl.c
|
||||||
index 54273ae..b19d1a3 100644
|
index cd484bd..eec0dd7 100644
|
||||||
--- a/dwl.c
|
--- a/dwl.c
|
||||||
+++ b/dwl.c
|
+++ b/dwl.c
|
||||||
@@ -431,6 +431,7 @@ static struct wl_list mons;
|
@@ -572,8 +572,8 @@ arrangelayers(Monitor *m)
|
||||||
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;
|
return;
|
||||||
|
|
||||||
if (m->showbar) {
|
if (m->showbar) {
|
||||||
- usable_area.height -= m->b.height;
|
- usable_area.height -= m->b.real_height;
|
||||||
- usable_area.y += topbar ? m->b.height : 0;
|
- usable_area.y += topbar ? m->b.real_height : 0;
|
||||||
+ usable_area.height = usable_area.height - vertpad - m->b.height;
|
+ usable_area.height -= m->b.real_height + vertpad;
|
||||||
+ usable_area.y = topbar ? usable_area.y + m->b.height + vp : usable_area.y;
|
+ usable_area.y += topbar ? m->b.height + vertpad : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Arrange exclusive surfaces from top->bottom */
|
/* Arrange exclusive surfaces from top->bottom */
|
||||||
@@ -1419,8 +1420,8 @@ drawbar(Monitor *mon)
|
@@ -1424,8 +1424,8 @@ drawbar(Monitor *m)
|
||||||
}
|
|
||||||
|
|
||||||
pixman_image_unref(pix);
|
pixman_image_unref(pix);
|
||||||
- wlr_scene_node_set_position(&mon->scene_buffer->node, mon->m.x,
|
wlr_scene_buffer_set_dest_size(m->scene_buffer,
|
||||||
- mon->m.y + (topbar ? 0 : mon->m.height - mon->b.height));
|
m->b.real_width, m->b.real_height);
|
||||||
+ wlr_scene_node_set_position(&mon->scene_buffer->node, mon->m.x + sp,
|
- wlr_scene_node_set_position(&m->scene_buffer->node, m->m.x,
|
||||||
+ mon->m.y + vp + (topbar ? 0 : mon->m.height - mon->b.height));
|
- m->m.y + (topbar ? 0 : m->m.height - m->b.real_height));
|
||||||
wlr_scene_buffer_set_buffer(mon->scene_buffer, &buf->base);
|
+ 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);
|
wlr_buffer_drop(&buf->base);
|
||||||
}
|
}
|
||||||
@@ -2665,6 +2666,8 @@ setup(void)
|
@@ -3007,7 +3007,7 @@ updatebar(Monitor *m)
|
||||||
|
char fontattrs[12];
|
||||||
|
|
||||||
lrpad = font->height;
|
wlr_output_transformed_resolution(m->wlr_output, &rw, &rh);
|
||||||
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;
|
||||||
+ m->b.width = rw - 2 * sp;
|
+ m->b.width = rw - 2 * sidepad;
|
||||||
m->b.height = bh;
|
m->b.real_width = (int)((float)m->b.width / m->wlr_output->scale);
|
||||||
}
|
|
||||||
|
|
||||||
|
if (m->b.scale == m->wlr_output->scale && m->font)
|
||||||
--
|
--
|
||||||
2.44.0
|
2.45.0
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user