From 0bbf1f65da8b94c519daa7a66792ba2c007dc80e Mon Sep 17 00:00:00 2001 From: korei999 Date: Wed, 29 Nov 2023 22:14:29 +0200 Subject: [PATCH] apply alwayscenter patch --- config.def.h | 12 ++++-------- dwl.c | 6 +++++- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/config.def.h b/config.def.h index cbe4b74..bf41336 100644 --- a/config.def.h +++ b/config.def.h @@ -10,10 +10,6 @@ static const int numlock = 1; static const int capslock = 0; static const int smartborders = 1; static const unsigned int borderpx = 3; /* border pixel of windows */ -static const unsigned int gappih = 0; /* horiz inner gap between windows */ -static const unsigned int gappiv = 0; /* vert inner gap between windows */ -static const unsigned int gappoh = 0; /* horiz outer gap between windows and screen edge */ -static const unsigned int gappov = 0; /* vert outer gap between windows and screen edge */ static const float bordercolor[] = COLOR(0x00000000); static const float focuscolor[] = COLOR(0x7aa6daff); static const float urgentcolor[] = COLOR(0xd54e53ff); @@ -21,7 +17,7 @@ static const float stickycolor[] = COLOR(0x8abeb7ff); static const float mixedcolor[] = COLOR(0xb5bd68ff); /* To conform the xdg-protocol, set the alpha to zero to restore the old behavior */ static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 0.0}; -static const float default_opacity = 1.00; +static const int center_relative_to_monitor = 1; /* 0 means center floating relative to the window area */ static const char *const autostart[] = { "/home/korei/.config/dwl/dwlinit.sh", NULL, @@ -34,10 +30,10 @@ static const char *const autostart[] = { static int log_level = WLR_ERROR; typedef enum { - VIEW_L = -1, - VIEW_R = 1, + VIEW_L = -1, + VIEW_R = 1, SHIFT_L = -2, - SHIFT_R = 2, + SHIFT_R = 2, } RotateTags; /* keyboard layout change notification for status bar */ diff --git a/dwl.c b/dwl.c index 16eedfc..4d342e5 100644 --- a/dwl.c +++ b/dwl.c @@ -1830,8 +1830,9 @@ mapnotify(struct wl_listener *listener, void *data) { /* Called when the surface is mapped, or ready to display on-screen. */ Client *p, *w, *c = wl_container_of(listener, c, map); - Monitor *m; + Monitor *m = selmon; int i; + struct wlr_box b = center_relative_to_monitor ? m->m : m->w; /* Create scene tree for this client and its border */ c->scene = client_surface(c)->data = wlr_scene_tree_create(layers[LyrTile]); @@ -1870,6 +1871,9 @@ mapnotify(struct wl_listener *listener, void *data) wl_list_insert(&clients, &c->link); wl_list_insert(&fstack, &c->flink); + c->geom.x = (b.width - c->geom.width) / 2 + b.x; + c->geom.y = (b.height - c->geom.height) / 2 + b.y; + /* Set initial monitor, tags, floating status, and focus: * we always consider floating, clients that have parent and thus * we set the same tags and monitor than its parent, if not