mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2025-09-09 04:34:50 +00:00
Update bar/barpadding.patch
This commit is contained in:
parent
1b5cab4793
commit
01dea0b720
@ -1,87 +1,35 @@
|
||||
From 537bd7c485c1fb370d7a73f979ee140dab9c078e Mon Sep 17 00:00:00 2001
|
||||
From: sewn <sewn@disroot.org>
|
||||
Date: Mon, 25 Mar 2024 00:15:01 +0300
|
||||
Subject: [PATCH] port barpadding patch to bar for dwl
|
||||
From 4c642bc276a44c694663af118d690503c5884382 Mon Sep 17 00:00:00 2001
|
||||
From: oak <oak@petrifiedoak.com>
|
||||
Date: Fri, 5 Apr 2024 12:55:51 +0200
|
||||
Subject: [PATCH] barheight actually added
|
||||
|
||||
---
|
||||
config.def.h | 3 +++
|
||||
dwl.c | 14 +++++++++-----
|
||||
2 files changed, 12 insertions(+), 5 deletions(-)
|
||||
config.def.h | 1 +
|
||||
dwl.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index bd008c9..a2cf167 100644
|
||||
index 8fb2d68..dd7e7ce 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -7,6 +7,7 @@
|
||||
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 float rootcolor[] = COLOR(0x000000ff);
|
||||
static const float bordercolor[] = COLOR(0x444444ff);
|
||||
static const float focuscolor[] = COLOR(0x005577ff);
|
||||
@@ -17,6 +18,8 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
|
||||
@@ -17,6 +17,7 @@ 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 int user_bh = 0; /* 0 means that dwl will calculate bar height, >= 1 means dwl will use user_bh as bar height */
|
||||
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 976fefb..6650fdc 100644
|
||||
index 056718d..4247f4c 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -434,6 +434,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;
|
||||
@@ -571,8 +573,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 */
|
||||
@@ -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);
|
||||
}
|
||||
@@ -2747,6 +2749,8 @@ setup(void)
|
||||
@@ -2745,7 +2745,7 @@ setup(void)
|
||||
die("Could not load font");
|
||||
|
||||
lrpad = font->height;
|
||||
bh = font->height + 2;
|
||||
+ sp = sidepad;
|
||||
+ vp = (topbar == 1) ? vertpad : - vertpad;
|
||||
- bh = font->height + 2;
|
||||
+ bh = user_bh ? user_bh : font->height + 2;
|
||||
|
||||
status_event_source = wl_event_loop_add_fd(wl_display_get_event_loop(dpy),
|
||||
STDIN_FILENO, WL_EVENT_READABLE, status_in, NULL);
|
||||
@@ -3087,7 +3091,7 @@ updatebardims(Monitor *m)
|
||||
{
|
||||
int rw, rh;
|
||||
wlr_output_transformed_resolution(m->wlr_output, &rw, &rh);
|
||||
- m->b.width = rw;
|
||||
+ m->b.width = rw - 2 * sp;
|
||||
m->b.height = bh;
|
||||
}
|
||||
|
||||
--
|
||||
2.44.0
|
||||
|
||||
STDIN_FILENO, WL_EVENT_READABLE, status_in, NULL);
|
Loading…
x
Reference in New Issue
Block a user