diff options
-rw-r--r-- | applied/dwm-6.2-taggrid.diff | 253 | ||||
-rw-r--r-- | applied/dwm-bar-height-6.2.diff | 25 | ||||
-rw-r--r-- | cancelled/dwm-noborder-6.2.diff (renamed from applied/dwm-noborder-6.2.diff) | 0 | ||||
-rw-r--r-- | config.def.h | 61 | ||||
-rw-r--r-- | config.h | 61 | ||||
-rw-r--r-- | dwm.c | 148 |
6 files changed, 504 insertions, 44 deletions
diff --git a/applied/dwm-6.2-taggrid.diff b/applied/dwm-6.2-taggrid.diff new file mode 100644 index 0000000..f5ed115 --- /dev/null +++ b/applied/dwm-6.2-taggrid.diff @@ -0,0 +1,253 @@ +diff --git a/config.def.h b/config.def.h +index 1c0b587..2f8f34b 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -21,6 +21,22 @@ static const char *colors[][3] = { + /* tagging */ + static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; + ++/* 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 +@@ -94,6 +110,16 @@ static Key keys[] = { + TAGKEYS( XK_8, 7) + TAGKEYS( XK_9, 8) + { MODKEY|ShiftMask, XK_q, quit, {0} }, ++ ++ { MODKEY|ControlMask, XK_Up, switchtag, { .ui = SWITCHTAG_UP | SWITCHTAG_VIEW } }, ++ { MODKEY|ControlMask, XK_Down, switchtag, { .ui = SWITCHTAG_DOWN | SWITCHTAG_VIEW } }, ++ { MODKEY|ControlMask, XK_Right, switchtag, { .ui = SWITCHTAG_RIGHT | SWITCHTAG_VIEW } }, ++ { MODKEY|ControlMask, XK_Left, switchtag, { .ui = SWITCHTAG_LEFT | SWITCHTAG_VIEW } }, ++ ++ { MODKEY|Mod4Mask, XK_Up, switchtag, { .ui = SWITCHTAG_UP | SWITCHTAG_TAG | SWITCHTAG_VIEW } }, ++ { MODKEY|Mod4Mask, XK_Down, switchtag, { .ui = SWITCHTAG_DOWN | SWITCHTAG_TAG | SWITCHTAG_VIEW } }, ++ { MODKEY|Mod4Mask, XK_Right, switchtag, { .ui = SWITCHTAG_RIGHT | SWITCHTAG_TAG | SWITCHTAG_VIEW } }, ++ { MODKEY|Mod4Mask, XK_Left, switchtag, { .ui = SWITCHTAG_LEFT | SWITCHTAG_TAG | SWITCHTAG_VIEW } }, + }; + + /* button definitions */ +diff --git a/dwm.c b/dwm.c +index 4465af1..5c29232 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -163,6 +163,7 @@ static void detachstack(Client *c); + static Monitor *dirtomon(int dir); + static void drawbar(Monitor *m); + static void drawbars(void); ++static void drawtaggrid(Monitor *m, int *x_pos, unsigned int occ); + static void enternotify(XEvent *e); + static void expose(XEvent *e); + static void focus(Client *c); +@@ -206,6 +207,7 @@ static void seturgent(Client *c, int urg); + static void showhide(Client *c); + static void sigchld(int unused); + static void spawn(const Arg *arg); ++static void switchtag(const Arg *arg); + static void tag(const Arg *arg); + static void tagmon(const Arg *arg); + static void tile(Monitor *); +@@ -417,11 +419,13 @@ 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) { +@@ -431,13 +435,23 @@ 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)) { ++ if(i < LENGTH(tags) && (drawtagmask & DRAWCLASSICTAGS)) { + click = ClkTagBar; + arg.ui = 1 << i; +- } else if (ev->x < x + blw) ++ } 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 + blw + columns * bh / tagrows) + click = ClkLtSymbol; + else if (ev->x > selmon->ww - TEXTW(stext)) + click = ClkStatusText; +@@ -714,6 +728,7 @@ 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, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); +@@ -724,6 +739,9 @@ drawbar(Monitor *m) + urg & 1 << i); + x += w; + } ++ if (drawtagmask & DRAWTAGGRID) { ++ drawtaggrid(m,&x,occ); ++ } + w = blw = TEXTW(m->ltsymbol); + drw_setscheme(drw, scheme[SchemeNorm]); + x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); +@@ -750,6 +768,48 @@ drawbars(void) + for (m = mons; m; m = m->next) + drawbar(m); + } ++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 ? scheme[SchemeSel][ColBg].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 ? scheme[SchemeSel][ColFg].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 + enternotify(XEvent *e) +@@ -1627,6 +1687,81 @@ showhide(Client *c) + XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y); + } + } ++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 + sigchld(int unused) diff --git a/applied/dwm-bar-height-6.2.diff b/applied/dwm-bar-height-6.2.diff new file mode 100644 index 0000000..a576111 --- /dev/null +++ b/applied/dwm-bar-height-6.2.diff @@ -0,0 +1,25 @@ +diff --git a/config.def.h b/config.def.h +index 1c0b587..9814500 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -5,6 +5,7 @@ static const unsigned int borderpx = 1; /* border pixel of 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 user_bh = 0; /* 0 means that dwm will calculate bar height, >= 1 means dwm will user_bh as bar height */ + static const char *fonts[] = { "monospace:size=10" }; + static const char dmenufont[] = "monospace:size=10"; + static const char col_gray1[] = "#222222"; +diff --git a/dwm.c b/dwm.c +index 4465af1..2c27cb3 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -1545,7 +1545,7 @@ setup(void) + if (!drw_fontset_create(drw, fonts, LENGTH(fonts))) + die("no fonts could be loaded."); + lrpad = drw->fonts->h; +- bh = drw->fonts->h + 2; ++ bh = user_bh ? user_bh : drw->fonts->h + 2; + updategeom(); + /* init atoms */ + utf8string = XInternAtom(dpy, "UTF8_STRING", False); diff --git a/applied/dwm-noborder-6.2.diff b/cancelled/dwm-noborder-6.2.diff index f381eb8..f381eb8 100644 --- a/applied/dwm-noborder-6.2.diff +++ b/cancelled/dwm-noborder-6.2.diff diff --git a/config.def.h b/config.def.h index f418015..bd77733 100644 --- a/config.def.h +++ b/config.def.h @@ -2,10 +2,11 @@ /* appearance */ static const unsigned int borderpx = 3; /* border pixel of windows */ -static const unsigned int gappx = 0; /* gaps between windows */ -static const unsigned int snap = 32; /* snap pixel */ -static const int showbar = 0; /* 0 means no bar */ +static const unsigned int gappx = 10; /* gaps between windows */ +static const unsigned int snap = 24; /* snap pixel */ +static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ +static const int user_bh = 32; /* 0 means that dwm will calculate bar height, >= 1 means dwm will user_bh as bar height */ static const int focusonwheel = 0; static const char *fonts[] = { "monospace:size=10" }; static const char dmenufont[] = "monospace:size=10"; @@ -18,13 +19,29 @@ static const char *colors[][3] = { /* fg bg border */ [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, [SchemeSel] = { col_gray4, col_cyan, col_cyan }, - [SchemeTabActive] = { col_gray2, col_gray3, col_gray2 }, - [SchemeTabInactive] = { col_gray1, col_gray3, col_gray1 } + [SchemeTabActive] = { col_gray2, col_gray1, col_gray2 }, + [SchemeTabInactive] = { col_gray2, col_gray1, col_gray2 } }; /* tagging */ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; +/* 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 = 3; + static const Rule rules[] = { /* xprop(1): * WM_CLASS(STRING) = instance, class @@ -50,7 +67,7 @@ static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen win #define BARTAB_BORDERS 1 // 0 = off, 1 = on #define BARTAB_BOTTOMBORDER 1 // 0 = off, 1 = on #define BARTAB_TAGSINDICATOR 1 // 0 = off, 1 = on if >1 client/view tag, 2 = always on -#define BARTAB_TAGSPX 5 // # pixels for tag grid boxes +#define BARTAB_TAGSPX 6 // # pixels for tag grid boxes #define BARTAB_TAGSROWS 3 // # rows in tag grid (9 tags, e.g. 3x3) static void (*bartabmonfns[])(Monitor *) = { monocle /* , customlayoutfn */ }; static void (*bartabfloatfns[])(Monitor *) = { NULL /* , customlayoutfn */ }; @@ -81,6 +98,7 @@ static const Layout layouts[] = { /* commands */ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static const char *termcmd[] = { "alacritty", NULL }; +static const char *cooltermcmd[] = { "cool-retro-term", NULL }; static const char *dmenucmd[] = { "dmenu_run", "-i", "-m", "0", NULL }; static const char *dmpccmd[] = { "/home/jozan/.local/bin/dmpc", NULL }; static const char *dmkillcmd[] = { "/home/jozan/.local/bin/dmkill", NULL }; @@ -122,6 +140,7 @@ static Key keys[] = { /* modifier key function argument */ { MODKEY, XK_p, spawn, {.v = dmenucmd } }, { MODKEY, XK_Return, spawn, {.v = termcmd } }, + { MODKEY|ControlMask, XK_Return, spawn, {.v = termcmd } }, { MODKEY, XK_F1, spawn, {.v = filecmd } }, { MODKEY, XK_F2, spawn, {.v = editcmd } }, { MODKEY, XK_F3, spawn, {.v = browsercmd } }, @@ -170,8 +189,8 @@ static Key keys[] = { { MODKEY, XK_d, incnmaster, {.i = -1 } }, { MODKEY|ControlMask, XK_a, incnmaster, {.i = +1 } }, { MODKEY|ControlMask, XK_x, incnmaster, {.i = -1 } }, - { MODKEY|ShiftMask, XK_h, setmfact, {.f = -0.025} }, - { MODKEY|ShiftMask, XK_l, setmfact, {.f = +0.025} }, + { MODKEY|ControlMask, XK_minus, setmfact, {.f = -0.025} }, + { MODKEY|ControlMask, XK_equal, setmfact, {.f = +0.025} }, { MODKEY|ShiftMask, XK_j, movestack, {.i = +1 } }, { MODKEY|ShiftMask, XK_k, movestack, {.i = -1 } }, { MODKEY|ShiftMask, XK_Return, zoom, {0} }, @@ -189,19 +208,27 @@ static Key keys[] = { { MODKEY, XK_bracketright, focusmon, {.i = -1 } }, { MODKEY, XK_h, focusmon, {.i = +1 } }, { MODKEY, XK_l, focusmon, {.i = -1 } }, - { MODKEY|ControlMask, XK_bracketleft, tagmon, {.i = +1 } }, - { MODKEY|ControlMask, XK_bracketright, tagmon, {.i = -1 } }, - { MODKEY|ControlMask, XK_h, tagmon, {.i = +1 } }, - { MODKEY|ControlMask, XK_l, tagmon, {.i = -1 } }, - { MODKEY|ControlMask, XK_bracketleft, focusmon, {.i = +1 } }, - { MODKEY|ControlMask, XK_bracketright, focusmon, {.i = -1 } }, - { MODKEY|ControlMask, XK_h, focusmon, {.i = +1 } }, - { MODKEY|ControlMask, XK_l, focusmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_bracketleft, tagmon, {.i = +1 } }, + { MODKEY|ShiftMask, XK_bracketright, tagmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_h, tagmon, {.i = +1 } }, + { MODKEY|ShiftMask, XK_l, tagmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_bracketleft, focusmon, {.i = +1 } }, + { MODKEY|ShiftMask, XK_bracketright, focusmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_h, focusmon, {.i = +1 } }, + { MODKEY|ShiftMask, XK_l, focusmon, {.i = -1 } }, { MODKEY, XK_w, movemouse, {0} }, - { MODKEY|ShiftMask, XK_w, resizemouse, {0} }, + { MODKEY|ShiftMask, XK_w, resizemouse, {0} }, { 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) @@ -2,10 +2,11 @@ /* appearance */ static const unsigned int borderpx = 3; /* border pixel of windows */ -static const unsigned int gappx = 0; /* gaps between windows */ -static const unsigned int snap = 32; /* snap pixel */ -static const int showbar = 0; /* 0 means no bar */ +static const unsigned int gappx = 10; /* gaps between windows */ +static const unsigned int snap = 24; /* snap pixel */ +static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ +static const int user_bh = 32; /* 0 means that dwm will calculate bar height, >= 1 means dwm will user_bh as bar height */ static const int focusonwheel = 0; static const char *fonts[] = { "monospace:size=10" }; static const char dmenufont[] = "monospace:size=10"; @@ -18,13 +19,29 @@ static const char *colors[][3] = { /* fg bg border */ [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, [SchemeSel] = { col_gray4, col_cyan, col_cyan }, - [SchemeTabActive] = { col_gray2, col_gray3, col_gray2 }, - [SchemeTabInactive] = { col_gray1, col_gray3, col_gray1 } + [SchemeTabActive] = { col_gray2, col_gray1, col_gray2 }, + [SchemeTabInactive] = { col_gray2, col_gray1, col_gray2 } }; /* tagging */ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; +/* 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 = 3; + static const Rule rules[] = { /* xprop(1): * WM_CLASS(STRING) = instance, class @@ -50,7 +67,7 @@ static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen win #define BARTAB_BORDERS 1 // 0 = off, 1 = on #define BARTAB_BOTTOMBORDER 1 // 0 = off, 1 = on #define BARTAB_TAGSINDICATOR 1 // 0 = off, 1 = on if >1 client/view tag, 2 = always on -#define BARTAB_TAGSPX 5 // # pixels for tag grid boxes +#define BARTAB_TAGSPX 6 // # pixels for tag grid boxes #define BARTAB_TAGSROWS 3 // # rows in tag grid (9 tags, e.g. 3x3) static void (*bartabmonfns[])(Monitor *) = { monocle /* , customlayoutfn */ }; static void (*bartabfloatfns[])(Monitor *) = { NULL /* , customlayoutfn */ }; @@ -81,6 +98,7 @@ static const Layout layouts[] = { /* commands */ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static const char *termcmd[] = { "alacritty", NULL }; +static const char *cooltermcmd[] = { "cool-retro-term", NULL }; static const char *dmenucmd[] = { "dmenu_run", "-i", "-m", "0", NULL }; static const char *dmpccmd[] = { "/home/jozan/.local/bin/dmpc", NULL }; static const char *dmkillcmd[] = { "/home/jozan/.local/bin/dmkill", NULL }; @@ -122,6 +140,7 @@ static Key keys[] = { /* modifier key function argument */ { MODKEY, XK_p, spawn, {.v = dmenucmd } }, { MODKEY, XK_Return, spawn, {.v = termcmd } }, + { MODKEY|ControlMask, XK_Return, spawn, {.v = termcmd } }, { MODKEY, XK_F1, spawn, {.v = filecmd } }, { MODKEY, XK_F2, spawn, {.v = editcmd } }, { MODKEY, XK_F3, spawn, {.v = browsercmd } }, @@ -170,8 +189,8 @@ static Key keys[] = { { MODKEY, XK_d, incnmaster, {.i = -1 } }, { MODKEY|ControlMask, XK_a, incnmaster, {.i = +1 } }, { MODKEY|ControlMask, XK_x, incnmaster, {.i = -1 } }, - { MODKEY|ShiftMask, XK_h, setmfact, {.f = -0.025} }, - { MODKEY|ShiftMask, XK_l, setmfact, {.f = +0.025} }, + { MODKEY|ControlMask, XK_minus, setmfact, {.f = -0.025} }, + { MODKEY|ControlMask, XK_equal, setmfact, {.f = +0.025} }, { MODKEY|ShiftMask, XK_j, movestack, {.i = +1 } }, { MODKEY|ShiftMask, XK_k, movestack, {.i = -1 } }, { MODKEY|ShiftMask, XK_Return, zoom, {0} }, @@ -189,19 +208,27 @@ static Key keys[] = { { MODKEY, XK_bracketright, focusmon, {.i = -1 } }, { MODKEY, XK_h, focusmon, {.i = +1 } }, { MODKEY, XK_l, focusmon, {.i = -1 } }, - { MODKEY|ControlMask, XK_bracketleft, tagmon, {.i = +1 } }, - { MODKEY|ControlMask, XK_bracketright, tagmon, {.i = -1 } }, - { MODKEY|ControlMask, XK_h, tagmon, {.i = +1 } }, - { MODKEY|ControlMask, XK_l, tagmon, {.i = -1 } }, - { MODKEY|ControlMask, XK_bracketleft, focusmon, {.i = +1 } }, - { MODKEY|ControlMask, XK_bracketright, focusmon, {.i = -1 } }, - { MODKEY|ControlMask, XK_h, focusmon, {.i = +1 } }, - { MODKEY|ControlMask, XK_l, focusmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_bracketleft, tagmon, {.i = +1 } }, + { MODKEY|ShiftMask, XK_bracketright, tagmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_h, tagmon, {.i = +1 } }, + { MODKEY|ShiftMask, XK_l, tagmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_bracketleft, focusmon, {.i = +1 } }, + { MODKEY|ShiftMask, XK_bracketright, focusmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_h, focusmon, {.i = +1 } }, + { MODKEY|ShiftMask, XK_l, focusmon, {.i = -1 } }, { MODKEY, XK_w, movemouse, {0} }, - { MODKEY|ShiftMask, XK_w, resizemouse, {0} }, + { MODKEY|ShiftMask, XK_w, resizemouse, {0} }, { 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) @@ -172,6 +172,7 @@ static void detachstack(Client *c); static Monitor *dirtomon(int dir); static void drawbar(Monitor *m); static void drawbars(void); +static void drawtaggrid(Monitor *m, int *x_pos, unsigned int occ); static void expose(XEvent *e); static void focus(Client *c); static void focusin(XEvent *e); @@ -216,6 +217,7 @@ static void seturgent(Client *c, int urg); static void showhide(Client *c); static void sigchld(int unused); static void spawn(const Arg *arg); +static void switchtag(const Arg *arg); static void tag(const Arg *arg); static void tagmon(const Arg *arg); static void tagnextmon(const Arg *arg); @@ -560,11 +562,13 @@ 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 @@ -575,13 +579,23 @@ 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)) { + if(i < LENGTH(tags) && (drawtagmask & DRAWCLASSICTAGS)) { click = ClkTagBar; arg.ui = 1 << i; - } else if (ev->x < x + blw) + } else if((ev->x < x + columns * bh / tagrows) && (drawtagmask & DRAWTAGGRID) != 0) { + 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 + blw + columns * bh / tagrows) click = ClkLtSymbol; else if (ev->x > selmon->ww - (int)TEXTW(stext)) click = ClkStatusText; @@ -877,6 +891,7 @@ 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, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]); @@ -887,6 +902,9 @@ drawbar(Monitor *m) urg & 1 << i); x += w; } + if (drawtagmask & DRAWTAGGRID) { + drawtaggrid(m,&x,occ); + } w = blw = TEXTW(m->ltsymbol); drw_setscheme(drw, scheme[SchemeNorm]); x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); @@ -911,6 +929,48 @@ drawbars(void) for (m = mons; m; m = m->next) drawbar(m); } +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 ? scheme[SchemeSel][ColBg].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 ? scheme[SchemeSel][ColFg].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) @@ -1424,13 +1484,6 @@ resizeclient(Client *c, int x, int y, int w, int h) c->oldw = c->w; c->w = wc.width = w; c->oldh = c->h; c->h = wc.height = h; wc.border_width = c->bw; - if (((nexttiled(c->mon->clients) == c && !nexttiled(c->next)) - || &monocle == c->mon->lt[c->mon->sellt]->arrange) - && !c->isfullscreen && !c->isfloating) { - c->w = wc.width += c->bw * 2; - c->h = wc.height += c->bw * 2; - wc.border_width = 0; - } XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); configure(c); XSync(dpy, False); @@ -1704,7 +1757,7 @@ setup(void) if (!drw_fontset_create(drw, fonts, LENGTH(fonts))) die("no fonts could be loaded."); lrpad = drw->fonts->h; - bh = drw->fonts->h + 2; + bh = user_bh ? user_bh : drw->fonts->h + 2; updategeom(); /* init atoms */ utf8string = XInternAtom(dpy, "UTF8_STRING", False); @@ -1786,6 +1839,81 @@ showhide(Client *c) XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y); } } +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 sigchld(int unused) |