mirror of
				https://codeberg.org/dwl/dwl-patches.git
				synced 2025-10-31 12:04:23 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			63 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			63 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
| From 504fb68dc63072b7184273c658f572bca1688996 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 6024b7e..4d438ab 100644
 | |
| --- a/config.def.h
 | |
| +++ b/config.def.h
 | |
| @@ -9,6 +9,8 @@ static const int bypass_surface_visibility = 0;  /* 1 means idle inhibitors will
 | |
|  static const unsigned int borderpx         = 1;  /* border pixel of windows */
 | |
|  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 float rootcolor[]             = COLOR(0x000000ff);
 | |
|  /* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
 | |
| diff --git a/dwl.c b/dwl.c
 | |
| index 72b4abb..b26cb9c 100644
 | |
| --- a/dwl.c
 | |
| +++ b/dwl.c
 | |
| @@ -591,8 +591,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 */
 | |
| @@ -1491,8 +1491,8 @@ drawbar(Monitor *m)
 | |
|  	drwl_finish_drawing(m->drw);
 | |
|  	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);
 | |
|  }
 | |
| @@ -3067,7 +3067,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->drw)
 | |
| -- 
 | |
| 2.45.2
 | |
| 
 | 
