diff options
| -rw-r--r-- | config.h | 10 | ||||
| -rw-r--r-- | dwm.c | 57 |
2 files changed, 53 insertions, 14 deletions
@@ -6,12 +6,12 @@ static const unsigned int gappx = 12; /* gaps between windows */ static const unsigned int snap = 32; /* snap pixel */ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ -static const int focusonwheel = 0; -static const int usealtbar = 1; /* 1 means use non-dwm status bar */ +static const int user_bh = 22; /* 0 means that dwm will calculate bar height, >= 1 means dwm will user_bh as bar height */ +static const int usealtbar = 0; /* 1 means use non-dwm status bar */ static const char *altbarclass = "Polybar";/* Alternate bar class name */ static const char *alttrayname = "tray"; /* Polybar tray instance name */ static const char *altbarcmd = ""; /* Alternate bar launch command */ -static const char *fonts[] = { "FiraCode-Regular:size=10" }; +static const char *fonts[] = { "FiraCode-Regular:size=10", "fontawesome:size=10" }; static const char dmenufont[] = "FiraCode-Regular:size=10"; static const char col_gray1[] = "#282828"; static const char col_gray2[] = "#928374"; @@ -25,7 +25,7 @@ static const char *colors[][3] = { }; /* tagging */ -static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; +static const char *tags[] = { "1", "", "", "", "", "", "7", "8", "9" }; static const Rule rules[] = { /* xprop(1): @@ -36,7 +36,7 @@ static const Rule rules[] = { { "Pcmanfm", NULL, NULL, 0, 1, -1 }, { "discord", NULL, NULL, 0, 1, -1 }, { "mpv", NULL, NULL, 0, 1, -1 }, - { "Firefox", NULL, NULL, 1 << 8, 0, -1 }, + { "Firefox", NULL, NULL, 0, 0, -1 }, }; /* layout(s) */ @@ -166,6 +166,7 @@ static void detachstack(Client *c); static Monitor *dirtomon(int dir); static void drawbar(Monitor *m); static void drawbars(void); +static void enternotify(XEvent *e); static void expose(XEvent *e); static void focus(Client *c); static void focusin(XEvent *e); @@ -185,6 +186,7 @@ static void managetray(Window win, XWindowAttributes *wa); static void mappingnotify(XEvent *e); static void maprequest(XEvent *e); static void monocle(Monitor *m); +static void motionnotify(XEvent *e); static void movemouse(const Arg *arg); static Client *nexttiled(Client *c); static void pop(Client *); @@ -259,11 +261,13 @@ static void (*handler[LASTEvent]) (XEvent *) = { [ConfigureRequest] = configurerequest, [ConfigureNotify] = configurenotify, [DestroyNotify] = destroynotify, + [EnterNotify] = enternotify, [Expose] = expose, [FocusIn] = focusin, [KeyPress] = keypress, [MappingNotify] = mappingnotify, [MapRequest] = maprequest, + [MotionNotify] = motionnotify, [PropertyNotify] = propertynotify, [UnmapNotify] = unmapnotify }; @@ -432,8 +436,7 @@ buttonpress(XEvent *e) click = ClkRootWin; /* focus monitor if necessary */ - if ((m = wintomon(ev->window)) && m != selmon - && (focusonwheel || (ev->button != Button4 && ev->button != Button5))) { + if ((m = wintomon(ev->window)) && m != selmon) { unfocus(selmon->sel, 1); selmon = m; focus(NULL); @@ -453,8 +456,8 @@ buttonpress(XEvent *e) else click = ClkWinTitle; } else if ((c = wintoclient(ev->window))) { - if (focusonwheel || (ev->button != Button4 && ev->button != Button5)) - focus(c); + focus(c); + restack(selmon); XAllowEvents(dpy, ReplayPointer, CurrentTime); click = ClkClientWin; } @@ -740,10 +743,9 @@ drawbar(Monitor *m) drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i); if (occ & 1 << i) - drw_rect(drw, x + boxw, 0, w - ( 2 * boxw + 1), boxw, - m == selmon && selmon->sel && selmon->sel->tags & 1 << i, - urg & 1 << i); - + drw_rect(drw, x + boxs, boxs, boxw, boxw, + m == selmon && selmon->sel && selmon->sel->tags & 1 << i, + urg & 1 << i); x += w; } w = blw = TEXTW(m->ltsymbol); @@ -774,6 +776,25 @@ drawbars(void) } void +enternotify(XEvent *e) +{ + Client *c; + Monitor *m; + XCrossingEvent *ev = &e->xcrossing; + + if ((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root) + return; + c = wintoclient(ev->window); + m = c ? c->mon : wintomon(ev->window); + if (m != selmon) { + unfocus(selmon->sel, 1); + selmon = m; + } else if (!c || c == selmon->sel) + return; + focus(c); +} + +void expose(XEvent *e) { Monitor *m; @@ -1162,6 +1183,23 @@ monocle(Monitor *m) } void +motionnotify(XEvent *e) +{ + static Monitor *mon = NULL; + Monitor *m; + XMotionEvent *ev = &e->xmotion; + + if (ev->window != root) + return; + if ((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) { + unfocus(selmon->sel, 1); + selmon = m; + focus(NULL); + } + mon = m; +} + +void movemouse(const Arg *arg) { int x, y, ocx, ocy, nx, ny; @@ -1622,7 +1660,8 @@ setup(void) if (!drw_fontset_create(drw, fonts, LENGTH(fonts))) die("no fonts could be loaded."); lrpad = drw->fonts->h; - bh = usealtbar ? 0 : drw->fonts->h + 2; + bh = user_bh ? user_bh : drw->fonts->h + 2; + //bh = usealtbar ? 0 : drw->fonts->h + 2; updategeom(); /* init atoms */ utf8string = XInternAtom(dpy, "UTF8_STRING", False); |
