[wiki] [sites] [dwm][patch][awesomebar] Don't highlight first window when not hovering over it || G-OD

From: <git_AT_suckless.org>
Date: Sat, 01 Apr 2023 14:10:04 +0200

commit 08911deaf2d7219e5514a41f8431bfc7e38be381
Author: G-OD <G-OD>
Date: Sat Apr 1 13:09:26 2023 +0100

    [dwm][patch][awesomebar] Don't highlight first window when not hovering over it

diff --git a/dwm.suckless.org/patches/awesomebar/dwm-awesomebarwithhover-20230431-6.4.diff b/dwm.suckless.org/patches/awesomebar/dwm-awesomebarwithhover-20230431-6.4.diff
index 3ef9434f..5fea2f37 100644
--- a/dwm.suckless.org/patches/awesomebar/dwm-awesomebarwithhover-20230431-6.4.diff
+++ b/dwm.suckless.org/patches/awesomebar/dwm-awesomebarwithhover-20230431-6.4.diff
_AT_@ -43,7 +43,7 @@ index 061ad66..82a3ed2 100644
          { ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
          { ClkClientWin, MODKEY, Button1, movemouse, {0} },
 diff --git a/dwm.c b/dwm.c
-index e5efb6a..a51f35e 100644
+index e5efb6a..8cb5171 100644
 --- a/dwm.c
 +++ b/dwm.c
 _AT_@ -50,6 +50,7 @@
_AT_@ -357,7 +357,7 @@ index e5efb6a..a51f35e 100644
          focus(NULL);
  }
  
-_AT_@ -1119,18 +1235,65 @@ monocle(Monitor *m)
+_AT_@ -1119,18 +1235,76 @@ monocle(Monitor *m)
  void
  motionnotify(XEvent *e)
  {
_AT_@ -406,30 +406,41 @@ index e5efb6a..a51f35e 100644
 + do
 + x += TEXTW(tags[i]);
 + while (ev->x >= x && ++i < LENGTH(tags));
-+ x += TEXTW(selmon->ltsymbol);
-+ if (c) {
-+ do {
-+ if (!ISVISIBLE(c))
-+ continue;
++ if (i < LENGTH(tags) || ev->x < x + TEXTW(selmon->ltsymbol) || ev->x > selmon->ww - TEXTW(stext) + lrpad - 2) {
++ if (selmon->hov) {
++ if (selmon->hov != selmon->sel)
++ XSetWindowBorder(dpy, selmon->hov->win, scheme[SchemeNorm][ColBorder].pixel);
 + else
-+ x +=(1.0 / (double)m->bt) * m->btw;
-+ } while (ev->x > x && (c = c->next));
++ XSetWindowBorder(dpy, selmon->hov->win, scheme[SchemeSel][ColBorder].pixel);
++ selmon->hov = NULL;
++ drawbar(m);
++ }
++ } else {
++ x += TEXTW(selmon->ltsymbol);
 + if (c) {
-+ if (selmon->hov) {
-+ if (selmon->hov != selmon->sel)
-+ XSetWindowBorder(dpy, selmon->hov->win, scheme[SchemeNorm][ColBorder].pixel);
++ do {
++ if (!ISVISIBLE(c))
++ continue;
 + else
-+ XSetWindowBorder(dpy, selmon->hov->win, scheme[SchemeSel][ColBorder].pixel);
++ x +=(1.0 / (double)m->bt) * m->btw;
++ } while (ev->x > x && (c = c->next));
++ if (c) {
++ if (selmon->hov) {
++ if (selmon->hov != selmon->sel)
++ XSetWindowBorder(dpy, selmon->hov->win, scheme[SchemeNorm][ColBorder].pixel);
++ else
++ XSetWindowBorder(dpy, selmon->hov->win, scheme[SchemeSel][ColBorder].pixel);
++ }
++ selmon->hov = c;
++ XSetWindowBorder(dpy, c->win, scheme[SchemeHov][ColBorder].pixel);
 + }
-+ selmon->hov = c;
-+ XSetWindowBorder(dpy, c->win, scheme[SchemeHov][ColBorder].pixel);
 + }
++ drawbar(m);
 + }
-+ drawbar(m);
  }
  
  void
-_AT_@ -1196,7 +1359,7 @@ movemouse(const Arg *arg)
+_AT_@ -1196,7 +1370,7 @@ movemouse(const Arg *arg)
  Client *
  nexttiled(Client *c)
  {
_AT_@ -438,7 +449,7 @@ index e5efb6a..a51f35e 100644
          return c;
  }
  
-_AT_@ -1249,6 +1412,16 @@ propertynotify(XEvent *e)
+_AT_@ -1249,6 +1423,16 @@ propertynotify(XEvent *e)
  void
  quit(const Arg *arg)
  {
_AT_@ -455,7 +466,7 @@ index e5efb6a..a51f35e 100644
          running = 0;
  }
  
-_AT_@ -1610,6 +1783,42 @@ seturgent(Client *c, int urg)
+_AT_@ -1610,6 +1794,42 @@ seturgent(Client *c, int urg)
          XFree(wmh);
  }
  
_AT_@ -498,7 +509,7 @@ index e5efb6a..a51f35e 100644
  void
  showhide(Client *c)
  {
-_AT_@ -1744,6 +1953,23 @@ toggleview(const Arg *arg)
+_AT_@ -1744,6 +1964,23 @@ toggleview(const Arg *arg)
          }
  }
  
_AT_@ -522,7 +533,7 @@ index e5efb6a..a51f35e 100644
  void
  unfocus(Client *c, int setfocus)
  {
-_AT_@ -1815,6 +2041,7 @@ updatebars(void)
+_AT_@ -1815,6 +2052,7 @@ updatebars(void)
                                  CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
                  XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
                  XMapRaised(dpy, m->barwin);
Received on Sat Apr 01 2023 - 14:10:04 CEST

This archive was generated by hypermail 2.3.0 : Sat Apr 01 2023 - 14:12:51 CEST