From e1b4f73d4a1d389c072a778218c923dc6ef4165d Mon Sep 17 00:00:00 2001 From: Xory Date: Sun, 15 Mar 2026 19:00:37 +0200 Subject: [PATCH] numerous changes --- config.h | 23 ++++++++++++----------- dwl.c | 27 +++++++++++++++++++++++++++ dwl.c.orig | 50 ++++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 81 insertions(+), 19 deletions(-) diff --git a/config.h b/config.h index cbe4033..dff09be 100644 --- a/config.h +++ b/config.h @@ -6,22 +6,22 @@ /* appearance */ 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 int smartgaps = 0; /* 1 means no outer gap when there is only one window */ +static const int smartgaps = 1; /* 1 means no outer gap when there is only one window */ static int gaps = 1; /* 1 means gaps between windows are added */ -static const unsigned int gappx = 10; /* gap pixel between windows */ -static const unsigned int borderpx = 1; /* border pixel of windows */ +static const unsigned int gappx = 25; /* gap pixel between windows */ +static const unsigned int borderpx = 2; /* border pixel of windows */ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ -static const char *fonts[] = {"monospace:size=10"}; -static const float rootcolor[] = COLOR(0x000000ff); -static const float unfocuseddim[] = COLOR(0x00000088); +static const char *fonts[] = {"Inconsolata Nerd Font:size=11"}; +static const float rootcolor[] = COLOR(0xcdd6f4ff); +static const float unfocuseddim[] = COLOR(0x00000077); /* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */ static const float fullscreen_bg[] = {0.0f, 0.0f, 0.0f, 1.0f}; /* You can also use glsl colors */ static uint32_t colors[][3] = { /* fg bg border */ - [SchemeNorm] = { 0xbbbbbbff, 0x222222ff, 0x444444ff }, - [SchemeSel] = { 0xeeeeeeff, 0x005577ff, 0x005577ff }, - [SchemeUrg] = { 0, 0, 0x770000ff }, + [SchemeNorm] = { 0xcdd6f4ff, 0x1e1e2eff, 0x1e1e2eff }, + [SchemeSel] = { 0x11111bff, 0xb4befeff, 0xb4befeff }, + [SchemeUrg] = { 0, 0, 0xfe8ba8ff }, }; /* tagging */ @@ -32,7 +32,8 @@ static int log_level = WLR_ERROR; /* Autostart */ static const char *const autostart[] = { - "wbg", "/path/to/your/image", NULL, + "wbg", "/home/xory/wallpaper.png", NULL, + "dunst", NULL, NULL /* terminate */ }; @@ -135,7 +136,7 @@ static const int cursor_timeout = 5; /* commands */ static const char *termcmd[] = { "kitty", NULL }; -static const char *menucmd[] = { "rofi", "-show", "drun", NULL }; +static const char *menucmd[] = { "wofi", "--conf", "/home/xory/.config/wofi/config/config", "--style", "/home/xory/.config/wofi/src/mocha/style.css", "-show", "drun", NULL }; static const Key keys[] = { /* Note that Shift changes certain key codes: 2 -> at, etc. */ diff --git a/dwl.c b/dwl.c index fd3d839..908c724 100644 --- a/dwl.c +++ b/dwl.c @@ -389,6 +389,7 @@ static void urgent(struct wl_listener *listener, void *data); static void view(const Arg *arg); static void virtualkeyboard(struct wl_listener *listener, void *data); static void virtualpointer(struct wl_listener *listener, void *data); +static void warpcursor(const Client *c); static Monitor *xytomon(double x, double y); static void xytonode(double x, double y, struct wlr_surface **psurface, Client **pc, LayerSurface **pl, double *nx, double *ny); @@ -602,6 +603,7 @@ arrange(Monitor *m) m->lt[m->sellt]->arrange(m); motionnotify(0, NULL, 0, 0, 0, 0); checkidleinhibitor(NULL); + warpcursor(focustop(selmon)); } void @@ -1704,6 +1706,10 @@ focusclient(Client *c, int lift) if (locked) return; + /* Warp cursor to center of client if it is outside */ + if (lift) + warpcursor(c); + /* Raise client in stacking order if requested */ if (c && lift) wlr_scene_node_raise_to_top(&c->scene->node); @@ -3477,6 +3483,27 @@ virtualpointer(struct wl_listener *listener, void *data) handlecursoractivity(); } +void +warpcursor(const Client *c) { + if (cursor_mode != CurNormal) { + return; + } + if (!c && selmon) { + wlr_cursor_warp_closest(cursor, + NULL, + selmon->w.x + selmon->w.width / 2.0 , + selmon->w.y + selmon->w.height / 2.0); + } + else if ( c && (cursor->x < c->geom.x || + cursor->x > c->geom.x + c->geom.width || + cursor->y < c->geom.y || + cursor->y > c->geom.y + c->geom.height)) + wlr_cursor_warp_closest(cursor, + NULL, + c->geom.x + c->geom.width / 2.0, + c->geom.y + c->geom.height / 2.0); +} + Monitor * xytomon(double x, double y) { diff --git a/dwl.c.orig b/dwl.c.orig index f07329f..fd3d839 100644 --- a/dwl.c.orig +++ b/dwl.c.orig @@ -1,6 +1,3 @@ -tr* - * See LICENSE file for copyright and license details. - */ #include #include #include @@ -117,6 +114,7 @@ typedef struct { Monitor *mon; struct wlr_scene_tree *scene; struct wlr_scene_rect *border[4]; /* top, bottom, left, right */ + struct wlr_scene_rect *dimmer; struct wlr_scene_tree *scene_surface; struct wl_list link; struct wl_list flink; @@ -146,7 +144,7 @@ typedef struct { #endif unsigned int bw; uint32_t tags; - int isfloating, isurgent, isfullscreen; + int isfloating, isurgent, isfullscreen, neverdim; uint32_t resize; /* configure serial of a pending resize */ } Client; @@ -254,6 +252,7 @@ typedef struct { const char *title; uint32_t tags; int isfloating; + int neverdim; int monitor; } Rule; @@ -456,6 +455,7 @@ static struct wlr_output_layout *output_layout; static struct wlr_box sgeom; static struct wl_list mons; static Monitor *selmon; +static int DIMOPT = 1; static char stext[256]; static struct wl_event_source *status_event_source; @@ -553,6 +553,7 @@ applyrules(Client *c) if ((!r->title || strstr(title, r->title)) && (!r->id || strstr(appid, r->id))) { c->isfloating = r->isfloating; + c->neverdim = r-> neverdim; newtags |= r->tags; i = 0; wl_list_for_each(m, &mons, link) { @@ -1725,8 +1726,10 @@ focusclient(Client *c, int lift) /* Don't change border color if there is an exclusive focus or we are * handling a drag operation */ - if (!exclusive_focus && !seat->drag) + if (!exclusive_focus && !seat->drag) { client_set_border_color(c, (float[])COLOR(colors[SchemeSel][ColBorder])); + client_set_dimmer_state(c, 0); + } } /* Deactivate old client if focus is changing */ @@ -1745,6 +1748,7 @@ focusclient(Client *c, int lift) } else if (old_c && !client_is_unmanaged(old_c) && (!c || !client_wants_focus(c))) { client_set_border_color(old_c, (float[])COLOR(colors[SchemeNorm][ColBorder])); client_activate_surface(old, 0); + client_set_dimmer_state(old_c, 1); } } drawbars(); @@ -2071,8 +2075,7 @@ void mapnotify(struct wl_listener *listener, void *data) { /* Called when the surface is mapped, or ready to display on-screen. */ - Client *p = NULL; - Client *w, *c = wl_container_of(listener, c, map); + Client *p, *w, *d, *c = wl_container_of(listener, c, map); Monitor *m; int i; @@ -2106,6 +2109,10 @@ mapnotify(struct wl_listener *listener, void *data) c->border[i]->node.data = c; } + c->dimmer = wlr_scene_rect_create(c->scene, 0, 0, unfocuseddim); + c->dimmer->node.data = c; + client_set_dimmer_state(c, 1); + /* Initialize client geometry with room for border */ client_set_tiled(c, WLR_EDGE_TOP | WLR_EDGE_BOTTOM | WLR_EDGE_LEFT | WLR_EDGE_RIGHT); c->geom.width += 2 * c->bw; @@ -2124,6 +2131,10 @@ mapnotify(struct wl_listener *listener, void *data) setmon(c, p->mon, p->tags); } else { applyrules(c); + d = focustop(selmon); + if (d) { + client_set_dimmer_state(d, 0); + } } drawbars(); @@ -2555,7 +2566,7 @@ resize(Client *c, struct wlr_box geo, int interact) c->geom = geo; applybounds(c, bbox); - /* Update scene-graph, including borders */ + /* Update scene-graph, including borders and dimmer*/ wlr_scene_node_set_position(&c->scene->node, c->geom.x, c->geom.y); wlr_scene_node_set_position(&c->scene_surface->node, c->bw, c->bw); wlr_scene_rect_set_size(c->border[0], c->geom.width, c->bw); @@ -2565,6 +2576,8 @@ resize(Client *c, struct wlr_box geo, int interact) wlr_scene_node_set_position(&c->border[1]->node, 0, c->geom.height - c->bw); wlr_scene_node_set_position(&c->border[2]->node, 0, c->bw); wlr_scene_node_set_position(&c->border[3]->node, c->geom.width - c->bw, c->bw); + wlr_scene_rect_set_size(c->dimmer, c->geom.width - 2*c->bw, c-> geom.height - 2*c->bw); + wlr_scene_node_set_position(&c->dimmer->node, c->bw, c->bw); /* this is a no-op if size hasn't changed */ c->resize = client_set_size(c, c->geom.width - 2 * c->bw, @@ -3137,6 +3150,27 @@ togglebar(const Arg *arg) drawbars(); } +void toggledimming(const Arg *arg) +{ + Client *c; + DIMOPT ^= 1; + wl_list_for_each(c, &clients, link) + { + client_set_dimmer_state(c, 1); + } + c = focustop(selmon); + if (c) + client_set_dimmer_state(c, 0); +} + +void +toggledimmingclient(const Arg *arg) +{ + Client *sel = focustop(selmon); + if (sel) + sel -> neverdim ^= 1; +} + void togglefloating(const Arg *arg) {