mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2025-10-26 17:54:17 +00:00
bar: add barpadding
This commit is contained in:
parent
51ca832d5c
commit
8c1016d049
88
bar/barpadding.patch
Normal file
88
bar/barpadding.patch
Normal file
@ -0,0 +1,88 @@
|
||||
From b99ce4f7cb99729a9739af642a0e0fe00ea7ccf0 Mon Sep 17 00:00:00 2001
|
||||
From: sewn <sewn@disroot.org>
|
||||
Date: Tue, 19 Mar 2024 00:19:39 +0300
|
||||
Subject: [PATCH] port barpadding patch to bar for dwl
|
||||
|
||||
---
|
||||
config.def.h | 2 ++
|
||||
dwl.c | 16 ++++++++++------
|
||||
2 files changed, 12 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index bd008c9..62c95de 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -7,6 +7,8 @@
|
||||
static const int sloppyfocus = 1; /* focus follows mouse */
|
||||
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
+static const int vertpad = 10; /* vertical padding of bar */
|
||||
+static const int sidepad = 10; /* horizontal padding of bar */
|
||||
static const float rootcolor[] = COLOR(0x000000ff);
|
||||
static const float bordercolor[] = COLOR(0x444444ff);
|
||||
static const float focuscolor[] = COLOR(0x005577ff);
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 8341134..51ce9f0 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -433,6 +433,8 @@ static Monitor *selmon;
|
||||
|
||||
static struct fcft_font *font;
|
||||
static int bh;
|
||||
+static int vp;
|
||||
+static int sp;
|
||||
static int lrpad;
|
||||
static char stext[256];
|
||||
static struct wl_event_source *status_event_source;
|
||||
@@ -570,8 +572,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 */
|
||||
@@ -1018,7 +1020,7 @@ createmon(struct wl_listener *listener, void *data)
|
||||
|
||||
m->scene_buffer = wlr_scene_buffer_create(layers[LyrBottom], NULL);
|
||||
m->scene_buffer->point_accepts_input = bar_accepts_input;
|
||||
- m->b.width = m->wlr_output->width;
|
||||
+ m->b.width = m->wlr_output->width - 2 * sp;
|
||||
m->b.height = bh;
|
||||
m->showbar = showbar;
|
||||
|
||||
@@ -1501,8 +1503,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);
|
||||
}
|
||||
@@ -2756,6 +2758,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);
|
||||
@@ -3077,7 +3081,7 @@ updatemons(struct wl_listener *listener, void *data)
|
||||
|
||||
/* Update bar */
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
- m->b.width = m->wlr_output->width;
|
||||
+ m->b.width = m->wlr_output->width - 2 * sp;
|
||||
m->b.height = bh;
|
||||
drawbar(m);
|
||||
}
|
||||
--
|
||||
2.44.0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user