diff options
author | Joe <rbo@gmx.us> | 2024-12-30 09:39:02 +0100 |
---|---|---|
committer | Joe <rbo@gmx.us> | 2024-12-30 09:39:02 +0100 |
commit | 94cc7dc0c5fda2ab6f9271979c79af150262e4c8 (patch) | |
tree | fb109fdd1fd834f03b0d31585743db958633c1b4 | |
parent | up (diff) | |
download | dwm-94cc7dc0c5fda2ab6f9271979c79af150262e4c8.tar.gz dwm-94cc7dc0c5fda2ab6f9271979c79af150262e4c8.tar.bz2 dwm-94cc7dc0c5fda2ab6f9271979c79af150262e4c8.tar.xz dwm-94cc7dc0c5fda2ab6f9271979c79af150262e4c8.tar.zst dwm-94cc7dc0c5fda2ab6f9271979c79af150262e4c8.zip |
reverted taggrid
-rw-r--r-- | config.def.h | 26 | ||||
-rw-r--r-- | dwm.c | 143 |
2 files changed, 3 insertions, 166 deletions
diff --git a/config.def.h b/config.def.h index ef03bc8..827e5e9 100644 --- a/config.def.h +++ b/config.def.h @@ -10,7 +10,7 @@ static const unsigned int systrayonleft = 0; /* 0: systray in the right corne static const unsigned int systrayspacing = 2; /* systray spacing */ static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/ static const int showsystray = 1; /* 0 means no systray */ -static const int showbar = 0; /* 0 means no bar */ +static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ static const int user_bh = 24; /* 0 means that dwm will calculate bar height, >= 1 means dwm will user_bh as bar height */ static const int focusonwheel = 0; @@ -65,22 +65,6 @@ static const char *tagsel[][2] = { { "#ebdbb2", "#83a598" }, }; -/* grid of tags */ -#define DRAWCLASSICTAGS 1 << 0 -#define DRAWTAGGRID 1 << 1 - -#define SWITCHTAG_UP 1 << 0 -#define SWITCHTAG_DOWN 1 << 1 -#define SWITCHTAG_LEFT 1 << 2 -#define SWITCHTAG_RIGHT 1 << 3 -#define SWITCHTAG_TOGGLETAG 1 << 4 -#define SWITCHTAG_TAG 1 << 5 -#define SWITCHTAG_VIEW 1 << 6 -#define SWITCHTAG_TOGGLEVIEW 1 << 7 - -static const unsigned int drawtagmask = DRAWTAGGRID; /* | DRAWCLASSICTAGS to show classic row of tags */ -static const int tagrows = 2; - static const Rule rules[] = { /* xprop(1): * WM_CLASS(STRING) = instance, class @@ -291,14 +275,6 @@ static const Key keys[] = { { MODKEY, XK_minus, setgaps, {.i = -1 } }, { MODKEY, XK_equal, setgaps, {.i = +1 } }, { MODKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } }, - { MODKEY|ControlMask, XK_k, switchtag, { .ui = SWITCHTAG_UP | SWITCHTAG_VIEW } }, - { MODKEY|ControlMask, XK_j, switchtag, { .ui = SWITCHTAG_DOWN | SWITCHTAG_VIEW } }, - { MODKEY|ControlMask, XK_l, switchtag, { .ui = SWITCHTAG_RIGHT | SWITCHTAG_VIEW } }, - { MODKEY|ControlMask, XK_h, switchtag, { .ui = SWITCHTAG_LEFT | SWITCHTAG_VIEW } }, - { MODKEY|METAKEY, XK_k, switchtag, { .ui = SWITCHTAG_UP | SWITCHTAG_TAG | SWITCHTAG_VIEW } }, - { MODKEY|METAKEY, XK_j, switchtag, { .ui = SWITCHTAG_DOWN | SWITCHTAG_TAG | SWITCHTAG_VIEW } }, - { MODKEY|METAKEY, XK_l, switchtag, { .ui = SWITCHTAG_RIGHT | SWITCHTAG_TAG | SWITCHTAG_VIEW } }, - { MODKEY|METAKEY, XK_h, switchtag, { .ui = SWITCHTAG_LEFT | SWITCHTAG_TAG | SWITCHTAG_VIEW } }, TAGKEYS( XK_1, 0) TAGKEYS( XK_2, 1) TAGKEYS( XK_3, 2) @@ -210,7 +210,6 @@ static void dmenuspawn(const Arg *arg); static void drawbar(Monitor *m); static void drawbars(void); static int drawstatusbar(Monitor *m, int bh, char* text); -static void drawtaggrid(Monitor *m, int *x_pos, unsigned int occ); static void expose(XEvent *e); static Client *findbefore(Client *c); static void focus(Client *c); @@ -265,7 +264,6 @@ static void sighup(int unused); static void sigterm(int unused); static void spawn(const Arg *arg); static Monitor *systraytomon(Monitor *m); -static void switchtag(const Arg *arg); static void tag(const Arg *arg); static void tagmon(const Arg *arg); static void tagnextmon(const Arg *arg); @@ -602,13 +600,11 @@ void buttonpress(XEvent *e) { unsigned int i, x, click; - unsigned int columns; Arg arg = {0}; Client *c; Monitor *m; XButtonPressedEvent *ev = &e->xbutton; - columns = LENGTH(tags) / tagrows + ((LENGTH(tags) % tagrows > 0) ? 1 : 0); click = ClkRootWin; /* focus monitor if necessary */ if ((m = wintomon(ev->window)) && m != selmon @@ -619,23 +615,13 @@ buttonpress(XEvent *e) } if (ev->window == selmon->barwin) { i = x = 0; - if (drawtagmask & DRAWCLASSICTAGS) do x += TEXTW(tags[i]); while (ev->x >= x && ++i < LENGTH(tags)); - if(i < LENGTH(tags) && (drawtagmask & DRAWCLASSICTAGS)) { + if (i < LENGTH(tags)) { click = ClkTagBar; arg.ui = 1 << i; - } else if(ev->x < x + columns * bh / tagrows && (drawtagmask & DRAWTAGGRID)) { - click = ClkTagBar; - i = (ev->x - x) / (bh / tagrows); - i = i + columns * (ev->y / (bh / tagrows)); - if (i >= LENGTH(tags)) { - i = LENGTH(tags) - 1; - } - arg.ui = 1 << i; - } - else if (ev->x < x + TEXTW(selmon->ltsymbol) + columns * bh / tagrows) + } else if (ev->x < x + TEXTW(selmon->ltsymbol)) click = ClkLtSymbol; else click = ClkStatusText; @@ -1163,7 +1149,6 @@ drawbar(Monitor *m) urg |= c->tags; } x = 0; - if (drawtagmask & DRAWCLASSICTAGS) for (i = 0; i < LENGTH(tags); i++) { w = TEXTW(tags[i]); drw_setscheme(drw, (m->tagset[m->seltags] & 1 << i ? tagscheme[i] : scheme[SchemeNorm])); @@ -1174,9 +1159,6 @@ drawbar(Monitor *m) urg & 1 << i); x += w; } - if (drawtagmask & DRAWTAGGRID) { - drawtaggrid(m,&x,occ); - } w = TEXTW(m->ltsymbol); drw_setscheme(drw, scheme[SchemeNorm]); x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); @@ -1307,50 +1289,6 @@ drawstatusbar(Monitor *m, int bh, char* stext) { } void -drawtaggrid(Monitor *m, int *x_pos, unsigned int occ) -{ - unsigned int x, y, h, max_x, columns; - int invert, i,j, k; - - h = bh / tagrows; - x = max_x = *x_pos; - y = 0; - columns = LENGTH(tags) / tagrows + ((LENGTH(tags) % tagrows > 0) ? 1 : 0); - - /* Firstly we will fill the borders of squares */ - - XSetForeground(drw->dpy, drw->gc, scheme[SchemeNorm][ColBorder].pixel); - XFillRectangle(dpy, drw->drawable, drw->gc, x, y, h*columns + 1, bh); - - /* We will draw LENGTH(tags) squares in tagraws raws. */ - for(j = 0, i= 0; j < tagrows; j++) { - x = *x_pos; - for (k = 0; k < columns && i < LENGTH(tags); k++, i++) { - invert = m->tagset[m->seltags] & 1 << i ? 0 : 1; - - /* Select active color for current square */ - XSetForeground(drw->dpy, drw->gc, !invert ? tagscheme[i][1].pixel : - scheme[SchemeNorm][ColFg].pixel); - XFillRectangle(dpy, drw->drawable, drw->gc, x+1, y+1, h-1, h-1); - - /* Mark square if tag has client */ - if (occ & 1 << i) { - XSetForeground(drw->dpy, drw->gc, !invert ? tagscheme[i][0].pixel : - scheme[SchemeNorm][ColBg].pixel); - XFillRectangle(dpy, drw->drawable, drw->gc, x + 1, y + 1, - h / 2, h / 2); - } - x += h; - if (x > max_x) { - max_x = x; - } - } - y += h; - } - *x_pos = max_x + 1; -} - -void expose(XEvent *e) { Monitor *m; @@ -2743,83 +2681,6 @@ spawn(const Arg *arg) } void -switchtag(const Arg *arg) -{ - unsigned int columns; - unsigned int new_tagset = 0; - unsigned int pos, i; - int col, row; - Arg new_arg; - - columns = LENGTH(tags) / tagrows + ((LENGTH(tags) % tagrows > 0) ? 1 : 0); - - for (i = 0; i < LENGTH(tags); ++i) { - if (!(selmon->tagset[selmon->seltags] & 1 << i)) { - continue; - } - pos = i; - row = pos / columns; - col = pos % columns; - if (arg->ui & SWITCHTAG_UP) { /* UP */ - row --; - if (row < 0) { - row = tagrows - 1; - } - do { - pos = row * columns + col; - row --; - } while (pos >= LENGTH(tags)); - } - if (arg->ui & SWITCHTAG_DOWN) { /* DOWN */ - row ++; - if (row >= tagrows) { - row = 0; - } - pos = row * columns + col; - if (pos >= LENGTH(tags)) { - row = 0; - } - pos = row * columns + col; - } - if (arg->ui & SWITCHTAG_LEFT) { /* LEFT */ - col --; - if (col < 0) { - col = columns - 1; - } - do { - pos = row * columns + col; - col --; - } while (pos >= LENGTH(tags)); - } - if (arg->ui & SWITCHTAG_RIGHT) { /* RIGHT */ - col ++; - if (col >= columns) { - col = 0; - } - pos = row * columns + col; - if (pos >= LENGTH(tags)) { - col = 0; - pos = row * columns + col; - } - } - new_tagset |= 1 << pos; - } - new_arg.ui = new_tagset; - if (arg->ui & SWITCHTAG_TOGGLETAG) { - toggletag(&new_arg); - } - if (arg->ui & SWITCHTAG_TAG) { - tag(&new_arg); - } - if (arg->ui & SWITCHTAG_VIEW) { - view (&new_arg); - } - if (arg->ui & SWITCHTAG_TOGGLEVIEW) { - toggleview(&new_arg); - } -} - -void tag(const Arg *arg) { if (selmon->sel && arg->ui & TAGMASK) { |