diff options
| -rw-r--r-- | config.h | 84 | ||||
| -rw-r--r-- | drw.o | bin | 0 -> 11504 bytes | |||
| -rwxr-xr-x | dwm | bin | 0 -> 81528 bytes | |||
| -rw-r--r-- | dwm.c | 116 | ||||
| -rw-r--r-- | dwm.o | bin | 0 -> 71360 bytes | |||
| -rw-r--r-- | util.o | bin | 0 -> 2496 bytes |
6 files changed, 167 insertions, 33 deletions
@@ -1,14 +1,19 @@ /* See LICENSE file for copyright and license details. */ +/* Constants */ +#define TERMINAL "st" +#define BROWSER "srch" + /* appearance */ static const unsigned int borderpx = 3; /* border pixel of windows */ static const unsigned int snap = 16; /* snap pixel */ +static const unsigned int minwsz = 20; /* Minimum height of a client for smfact */ static const int swallowfloating = 1; -static const int showbar = 1; /* 0 means no bar */ +static const int showbar = 0; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ -static const char *fonts[] = { "Inconsolata:size=12" }; -static const char dmenufont[] = "Inconsolata:size=12"; -static const char col_gray1[] = "#222222"; +static const char *fonts[] = { "BigBlueTerm437NerdFontMono-Regular:pixelsize=12:autohint=true, fontawesome:size=16" }; +static const char dmenufont[] = "BigBlueTerm437NerdFontMono-Regular:pixelsize=12:autohint=true, fontawesome:size=16"; +static const char col_gray1[] = "#000000"; static const char col_gray2[] = "#000000"; static const char col_gray3[] = "#bbbbbb"; static const char col_gray4[] = "#eeeeee"; @@ -20,9 +25,9 @@ static const char *colors[][3] = { [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, [SchemeSel] = { col_gray4, col_cyan, col_cyan }, [SchemeStatus] = { col_gray3, col_gray1, "#000000" }, // Statusbar right {text,background,not used but cannot be empty} - [SchemeTagsSel] = { col_cyan, col_gray1, "#000000" }, // Tagbar left selected {text,background,not used but cannot be empty} - [SchemeTagsNorm] = { col_gray3, col_gray1, "#000000" }, // Tagbar left unselected {text,background,not used but cannot be empty} - [SchemeInfoSel] = { col_gray1, col_cyan, "#000000" }, // infobar middle selected {text,background,not used but cannot be empty} + [SchemeTagsSel] = { col_gray3, col_cyan, "#000000" }, // Tagbar left selected {text,background,not used but cannot be empty} + [SchemeTagsNorm] = { col_cyan, col_gray1, "#000000" }, // Tagbar left unselected {text,background,not used but cannot be empty} + [SchemeInfoSel] = { col_gray3, col_cyan, "#000000" }, // infobar middle selected {text,background,not used but cannot be empty} [SchemeInfoNorm] = { col_cyan, col_gray1, "#000000" }, // infobar middle unselected {text,background,not used but cannot be empty} }; @@ -36,7 +41,6 @@ static const Rule rules[] = { */ /* class instance title tags mask isfloating isterminal noswallow monitor */ { "Thunar", "thunar", NULL, 0, 1, 0, 0, -1 }, - { "Firefox", NULL, NULL, 1 << 8, 0, 0, 0, -1 }, { "steam", "steamwebhelper", NULL, 0, 1, 0, 0, -1 }, { "Steam", "Steam", NULL, 0, 1, 0, 0, -1 }, { "steam", "steamwebhelper", "Steam", 0, 0, 0, 0, -1 }, @@ -47,16 +51,18 @@ static const Rule rules[] = { { "qBittorrent", "qbittorrent", NULL, 0, 0, 0, 0, -1 }, { "St", "st", NULL, 0, 0, 1, 1, -1 }, { "stfloat", "st", NULL, 0, 1, 1, 1, -1 }, - { "Mpv", NULL, NULL, 0, 1, 0, 0, -1 }, + { "mpv", NULL, NULL, 0, 1, 0, 0, -1 }, + { "Nsxiv", NULL, NULL, 0, 1, 0, 0, -1 }, { "scrcpy", NULL, NULL, 0, 1, 0, 0, -1 }, { "Pamac-manager", "pamac-manager",NULL, 0, 1, 0, 0, -1 }, - { "Floorp", "Alert", NULL, 0, 1, 0, 0, -1 }, - { "Floorp", "Places", "Library", 0, 1, 0, 0, -1 }, +// { "Floorp", "Alert", NULL, 0, 1, 0, 0, -1 }, +// { "Floorp", "Places", "Library", 0, 1, 0, 0, -1 }, { NULL, NULL, "Event Tester", 0, 0, 0, 1, -1 }, }; /* layout(s) */ static const float mfact = 0.50; /* factor of master area size [0.05..0.95] */ +static const float smfact = 0.00; /* factor of tiled clients [0.00..0.95] */ static const int nmaster = 1; /* number of clients in master area */ static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */ static const int lockfullscreen = 0; /* 1 will force focus on the fullscreen window */ @@ -82,21 +88,25 @@ static const Layout layouts[] = { /* commands */ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; -static const char *termcmd[] = { "st", NULL }; -static const char *floattermcmd[] = { "st", "-c", "stfloat", NULL }; +static const char *termcmd[] = { TERMINAL, NULL }; +#include <X11/XF86keysym.h> static const Key keys[] = { /* modifier key function argument */ { MODKEY, XK_d, spawn, {.v = dmenucmd } }, { MODKEY, XK_space, spawn, {.v = termcmd } }, - { Mod1Mask, XK_space, spawn, {.v = floattermcmd } }, + { MODKEY|ShiftMask, XK_space, spawn, SHCMD(TERMINAL" -e su") }, + { Mod1Mask, XK_space, spawn, SHCMD(TERMINAL" -c stfloat") }, + { Mod1Mask|ShiftMask, XK_space, spawn, SHCMD(TERMINAL" -c stfloat -e su") }, { MODKEY, XK_b, togglebar, {0} }, { MODKEY, XK_j, focusstack, {.i = +1 } }, { MODKEY, XK_k, focusstack, {.i = -1 } }, - { MODKEY, XK_i, incnmaster, {.i = +1 } }, - { MODKEY, XK_u, incnmaster, {.i = -1 } }, + { MODKEY, XK_u, incnmaster, {.i = +1 } }, + { MODKEY, XK_i, incnmaster, {.i = -1 } }, { MODKEY|ControlMask, XK_h, setmfact, {.f = -0.05} }, { MODKEY|ControlMask, XK_l, setmfact, {.f = +0.05} }, + { MODKEY|ControlMask, XK_k, setsmfact, {.f = +0.05} }, + { MODKEY|ControlMask, XK_j, setsmfact, {.f = -0.05} }, { MODKEY, XK_h, viewprev, {0} }, { MODKEY, XK_l, viewnext, {0} }, { MODKEY|ShiftMask, XK_h, tagtoprev, {0} }, @@ -110,26 +120,48 @@ static const Key keys[] = { { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, // { MODKEY, XK_Return, setlayout, {0} }, { MODKEY|ShiftMask, XK_f, togglefloating, {0} }, - { MODKEY, XK_0, view, {.ui = ~0 } }, - { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, + { MODKEY, XK_f, togglefullscr, {0} }, + { MODKEY, XK_grave, view, {.ui = ~0 } }, + { MODKEY|ShiftMask, XK_grave, tag, {.ui = ~0 } }, { MODKEY, XK_comma, focusmon, {.i = -1 } }, { MODKEY, XK_period, focusmon, {.i = +1 } }, { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, - { MODKEY, XK_e, spawn, SHCMD("thunar") }, - { MODKEY, XK_w, spawn, SHCMD("floorp") }, - { Mod1Mask, XK_Escape, spawn, SHCMD("st -c stfloat -e htop") }, - { ControlMask, XK_F1, spawn, SHCMD("amixer sset Master 5%-") }, - { ControlMask, XK_F2, spawn, SHCMD("amixer sset Master 5%+") }, - TAGKEYS( XK_1, 0) TAGKEYS( XK_2, 1) TAGKEYS( XK_3, 2) TAGKEYS( XK_4, 3) TAGKEYS( XK_5, 4) - { MODKEY|ShiftMask, XK_Delete, quit, {0} }, - { MODKEY|ShiftMask, XK_r, quit, {1} }, + + { MODKEY|ShiftMask, XK_End, quit, {0} }, + { MODKEY|ShiftMask, XK_r, quit, {1} }, + { MODKEY, XK_e, spawn, SHCMD(TERMINAL" -e mc --nosubshell") }, + { MODKEY|ShiftMask, XK_e, spawn, SHCMD(TERMINAL" -c stfloat -e su -c 'mc --nosubshell'") }, + { MODKEY, XK_m, spawn, SHCMD(TERMINAL" -e neomutt") }, + { MODKEY, XK_n, spawn, SHCMD(TERMINAL" -e newsboat") }, + { MODKEY, XK_Escape, spawn, SHCMD(TERMINAL" -e gotop") }, + { Mod1Mask, XK_Escape, spawn, SHCMD(TERMINAL" -c stfloat -e gotop") }, + { MODKEY, XK_x, spawn, SHCMD("xkill") }, + { MODKEY, XK_s, spawn, SHCMD("steam") }, + { MODKEY|ShiftMask, XK_s, spawn, SHCMD("pkill -9 steam") }, + { Mod1Mask|ControlMask, XK_Delete, spawn, SHCMD("slock") }, + { MODKEY, XK_w, spawn, SHCMD(BROWSER) }, + { 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("amixer sset Master 5%+") }, + { 0, XF86XK_AudioLowerVolume, spawn, SHCMD("amixer sset Master 5%-") }, + { 0, XF86XK_AudioMute, spawn, SHCMD("amixer sset Capture Toggle") }, + { 0, XF86XK_MonBrightnessUp, spawn, SHCMD("xbacklight -inc 10") }, + { 0, XF86XK_MonBrightnessDown, spawn, SHCMD("xbacklight -dec 10") }, + { MODKEY, XK_Print, spawn, SHCMD("maimpick") }, + + { MODKEY, XK_Down, moveresize, {.v = "0x 25y 0w 0h" } }, + { MODKEY, XK_Up, moveresize, {.v = "0x -25y 0w 0h" } }, + { MODKEY, XK_Right, moveresize, {.v = "25x 0y 0w 0h" } }, + { MODKEY, XK_Left, moveresize, {.v = "-25x 0y 0w 0h" } }, + { MODKEY|ShiftMask, XK_Down, moveresize, {.v = "0x 0y 0w 25h" } }, + { MODKEY|ShiftMask, XK_Up, moveresize, {.v = "0x 0y 0w -25h" } }, + { MODKEY|ShiftMask, XK_Right, moveresize, {.v = "0x 0y 25w 0h" } }, + { MODKEY|ShiftMask, XK_Left, moveresize, {.v = "0x 0y -25w 0h" } }, }; /* button definitions */ Binary files differBinary files differ@@ -76,6 +76,7 @@ typedef union { int i; unsigned int ui; float f; + float sf; const void *v; } Arg; @@ -121,6 +122,7 @@ typedef struct { struct Monitor { char ltsymbol[16]; float mfact; + float smfact; int nmaster; int num; int by; /* bar geometry */ @@ -192,6 +194,7 @@ static void mappingnotify(XEvent *e); static void maprequest(XEvent *e); static void monocle(Monitor *m); static void motionnotify(XEvent *e); +static void moveresize(const Arg *arg); static void movemouse(const Arg *arg); static unsigned int nexttag(void); static unsigned int prevtag(void); @@ -217,6 +220,7 @@ static void setfocus(Client *c); static void setfullscreen(Client *c, int fullscreen); static void setlayout(const Arg *arg); static void setmfact(const Arg *arg); +static void setsmfact(const Arg *arg); static void setup(void); static void seturgent(Client *c, int urg); static void showhide(Client *c); @@ -228,6 +232,7 @@ static void tagmon(const Arg *arg); static void tile(Monitor *m); static void togglebar(const Arg *arg); static void togglefloating(const Arg *arg); +static void togglefullscr(const Arg *arg); static void toggletag(const Arg *arg); static void toggleview(const Arg *arg); static void unfocus(Client *c, int setfocus); @@ -714,6 +719,7 @@ createmon(void) m = ecalloc(1, sizeof(Monitor)); m->tagset[0] = m->tagset[1] = 1; m->mfact = mfact; + m->smfact = smfact; m->nmaster = nmaster; m->showbar = showbar; m->topbar = topbar; @@ -1309,6 +1315,71 @@ movemouse(const Arg *arg) } } +void +moveresize(const Arg *arg) { + Client *c; + c = selmon->sel; + int x, y, w, h, nx, ny, nw, nh, ox, oy, ow, oh; + char xAbs, yAbs, wAbs, hAbs; + int msx, msy, dx, dy, nmx, nmy; + unsigned int dui; + Window dummy; + + if (!c || !arg) + return; + if (selmon->lt[selmon->sellt]->arrange && !c->isfloating) + return; + if (sscanf((char *)arg->v, "%d%c %d%c %d%c %d%c", &x, &xAbs, &y, &yAbs, &w, &wAbs, &h, &hAbs) != 8) + return; + + nw = c->w + w; + if (wAbs == 'W') + nw = w < selmon->mw - 2 * c->bw ? w : selmon->mw - 2 * c->bw; + + nh = c->h + h; + if (hAbs == 'H') + nh = h < selmon->mh - 2 * c->bw ? h : selmon->mh - 2 * c->bw; + + nx = c->x + x; + if (xAbs == 'X') { + if (x < selmon->mx) + nx = selmon->mx; + else if (x > selmon->mx + selmon->mw) + nx = selmon->mx + selmon->mw - nw - 2 * c->bw; + else + nx = x; + } + + ny = c->y + y; + if (yAbs == 'Y') { + if (y < selmon->my) + ny = selmon->my; + else if (y > selmon->my + selmon->mh) + ny = selmon->my + selmon->mh - nh - 2 * c->bw; + else + ny = y; + } + + ox = c->x; + oy = c->y; + ow = c->w; + oh = c->h; + + XRaiseWindow(dpy, c->win); + Bool xqp = XQueryPointer(dpy, root, &dummy, &dummy, &msx, &msy, &dx, &dy, &dui); + resize(c, nx, ny, nw, nh, True); + + /* move cursor along with the window to avoid problems */ + if (xqp && ox <= msx && (ox + ow) >= msx && oy <= msy && (oy + oh) >= msy) + { + nmx = c->x - ox + c->w - ow; + nmy = c->y - oy + c->h - oh; + /* make sure the cursor stays inside the window */ + if ((msx + nmx) > c->x && (msy + nmy) > c->y) + XWarpPointer(dpy, None, None, 0, 0, 0, 0, nmx, nmy); + } +} + unsigned int nexttag(void) { @@ -1502,8 +1573,6 @@ resizemouse(const Arg *arg) handler[ev.type](&ev); break; case MotionNotify: -// nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1); -// nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1); nw = MAX(ocw + (ev.xmotion.x - x), 1); nh = MAX(och + (ev.xmotion.y - y), 1); if (c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww @@ -1710,6 +1779,19 @@ setmfact(const Arg *arg) } void +setsmfact(const Arg *arg) { + float sf; + + if(!arg || !selmon->lt[selmon->sellt]->arrange) + return; + sf = arg->sf < 1.0 ? arg->sf + selmon->smfact : arg->sf - 1.0; + if(sf < 0 || sf > 0.9) + return; + selmon->smfact = sf; + arrange(selmon); +} + +void setup(void) { int i; @@ -1879,7 +1961,7 @@ tagmon(const Arg *arg) void tile(Monitor *m) { - unsigned int i, n, h, mw, my, ty; + unsigned int i, n, h, smh, mw, my, ty; Client *c; for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); @@ -1897,10 +1979,23 @@ tile(Monitor *m) if (my + HEIGHT(c) < m->wh) my += HEIGHT(c); } else { - h = (m->wh - ty) / (n - i); - resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0); - if (ty + HEIGHT(c) < m->wh) - ty += HEIGHT(c); + smh = m->mh * m->smfact; + if(!(nexttiled(c->next))) + h = (m->wh - ty) / (n - i); + else + h = (m->wh - smh - ty) / (n - i); + if(h < minwsz) { + c->isfloating = True; + XRaiseWindow(dpy, c->win); + resize(c, m->mx + (m->mw / 2 - WIDTH(c) / 2), m->my + (m->mh / 2 - HEIGHT(c) / 2), m->ww - mw - (2*c->bw), h - (2*c->bw), 0); + ty -= HEIGHT(c); + } + else + resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0); + if(!(nexttiled(c->next))) + ty += HEIGHT(c) + smh; + else + ty += HEIGHT(c); } } @@ -1928,6 +2023,13 @@ togglefloating(const Arg *arg) } void +togglefullscr(const Arg *arg) +{ + if(selmon->sel) + setfullscreen(selmon->sel, !selmon->sel->isfullscreen); +} + +void toggletag(const Arg *arg) { unsigned int newtags; Binary files differBinary files differ |
