20 Commits

Author SHA1 Message Date
jon
12b83c13ba Adding three column patch 2020-10-05 18:37:46 -05:00
jon
b05b22ae95 Changed increment/decrement keybinds, adding dmenu launcher 2020-10-05 18:22:25 -05:00
jon
5cab3cf6c1 Added mpc play/pause keybindings 2020-09-20 10:49:03 -05:00
jon
b313ef7f43 Added shortcut to launch calculator and changed tags to kanji 2020-09-17 18:53:34 -05:00
jon
4481fb0cee Failed applying alpha patch, removed manual patch files 2020-01-05 10:53:40 -06:00
jon
919619109c Applied focus adjacent tag patch. Required some manual patching due to two hunk failures. 2019-12-24 08:34:08 -06:00
jon
61b5d9251c Changed colors a bit, matched bar and background 2019-11-30 09:13:39 -06:00
jon
22fb46f457 Merge branch 'master' of https://git.jonfu.com/jon/dwm-6.2 2019-10-13 10:51:35 -05:00
jon
6234484ad8 Fixed script names for volume up/down in config 2019-10-13 10:50:55 -05:00
jomido
7a5a2fde14 Fixed firefox, class name changed and ruled for tag 2 stopped working. 2019-09-27 13:28:20 -05:00
jomido
85822e7ff4 Merge branch 'master' of https://git.jonfu.com/jon/dwm-6.2 2019-09-23 13:47:22 -05:00
jomido
0dc85103d6 Updated gitignore 2019-09-23 13:47:12 -05:00
jon
47c132db4e Added volume up/down using two shell scripts: pactl set-sink-volume +/-N% 2019-08-10 16:56:17 -05:00
jon
72dbded0e1 Added flameshot printscreen 2019-07-06 07:24:46 -05:00
jon
fa6ff46c1c Fixed keybind 2019-06-29 14:20:23 -05:00
jon
479cf61077 Fix keybind on lock (shift->control) 2019-06-29 14:18:50 -05:00
jon
1b402fe688 Added keybind for slock: ctrl-meta-l 2019-06-26 20:37:13 -05:00
jon
66c42c2531 Updated config.h with colors, terminal, firefox tag, etc 2019-05-27 10:32:54 -05:00
jon
c7d43eabc2 Applied warp patch 2019-05-27 10:09:01 -05:00
jon
fd71d7ec1d Downloaded warp patch 2019-05-27 10:08:49 -05:00
8 changed files with 496 additions and 2254 deletions

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
dwm
dwm.o
*.o

160
config.h Normal file
View File

@@ -0,0 +1,160 @@
/* See LICENSE file for copyright and license details. */
// patch config - uselessgap
static const unsigned int gappx = 6; /* gap pixel between windows */
// three column patch include
#include "tcl.c"
/* appearance */
static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */
static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
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 = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
static const char *fonts[] = { "monospace:size=10" };
static const char dmenufont[] = "monospace:size=10";
static const char col_gray1[] = "#222222";
static const char col_gray2[] = "#444444";
static const char col_gray3[] = "#bbbbbb";
static const char col_gray4[] = "#eeeeee";
static const char col_cyan[] = "#005577";
/* my colors */
static const char col_norm_fg[] = "#bbbbbb";
static const char col_norm_bg[] = "#222222";
static const char col_sel_fg[] = "#eeeeee";
static const char col_sel_bg[] = "#222222";
static const char col_norm_bdr[] = "#555555";
static const char col_sel_bdr[] = "#444444";
/* end my colors */
static const char *colors[][3] = {
/* fg bg border */
//[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
//[SchemeSel] = { col_gray4, col_cyan, col_cyan },
[SchemeNorm] = { col_norm_fg, col_norm_bg, col_norm_bdr },
[SchemeSel] = { col_sel_fg, col_sel_bg, col_sel_bdr },
};
/* tagging */
//static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
static const char *tags[] = { "", "", "", "", "", "", "", "", "" };
static const Rule rules[] = {
/* xprop(1):
* WM_CLASS(STRING) = instance, class
* WM_NAME(STRING) = title
*/
/* class instance title tags mask isfloating monitor */
{ "Gimp", NULL, NULL, 0, 1, -1 },
{ "firefox", NULL, NULL, 2, 0, -1 },
{ "URxvt", "cal", NULL, 0, 1, -1 },
};
/* layout(s) */
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
static const int nmaster = 1; /* number of clients in master area */
static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */
static const Layout layouts[] = {
/* symbol arrange function */
{ "[]=", tile }, /* first entry is default */
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
{ "|||", tcl },
};
/* key definitions */
#define MODKEY Mod4Mask
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
/* commands */
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_norm_bg, "-nf", col_norm_fg, "-sb", col_sel_bg, "-sf", col_sel_fg, NULL };
static const char *termcmd[] = { "urxvt256c", NULL };
static const char *lockcmd[] = { "slock", NULL };
static const char *prtscrcmd[] = { "flameshot", "gui", NULL};
static const char *vol_up[] = { "volume_up.sh", NULL};
static const char *vol_down[] = { "volume_down.sh", NULL};
static const char *mpc_play[] = { "mpc_play", NULL};
static const char *mpc_pause[] = { "mpc_pause", NULL};
static const char *calccmd[] = { "speedcrunch", NULL};
static const char *jmenu[] = {"jmenu", NULL};
static Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
{ MODKEY|ShiftMask, XK_i, incnmaster, {.i = +1 } },
{ MODKEY|ShiftMask, XK_d, incnmaster, {.i = -1 } },
{ MODKEY, XK_d, spawn, {.v = jmenu } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
{ MODKEY, XK_Return, zoom, {0} },
{ MODKEY, XK_Tab, view, {0} },
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
{ MODKEY, XK_c, spawn, {.v = calccmd } },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY|ShiftMask, XK_t, setlayout, {.v = &layouts[3]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_0, 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_Left, viewtoleft, {0} },
{ MODKEY, XK_Right, viewtoright, {0} },
{ MODKEY|ShiftMask, XK_Left, tagtoleft, {0} },
{ MODKEY|ShiftMask, XK_Right, tagtoright, {0} },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
TAGKEYS( XK_4, 3)
TAGKEYS( XK_5, 4)
TAGKEYS( XK_6, 5)
TAGKEYS( XK_7, 6)
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
//{ MODKEY|ShiftMask, XK_q, quit, {0} },
{ MODKEY|ControlMask, XK_q, quit, {0} },
{ 0, XK_Print, spawn, {.v = prtscrcmd } },
{ MODKEY, XK_F9, spawn, {.v = mpc_pause } },
{ MODKEY, XK_F10, spawn, {.v = mpc_play } },
{ MODKEY, XK_F11, spawn, {.v = vol_down } },
{ MODKEY, XK_F12, spawn, {.v = vol_up } },
{ MODKEY|ControlMask, XK_l, spawn, {.v = lockcmd } },
};
/* button definitions */
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
static Button buttons[] = {
/* click event mask button function argument */
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
{ ClkWinTitle, 0, Button2, zoom, {0} },
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
{ ClkTagBar, 0, Button1, view, {0} },
{ ClkTagBar, 0, Button3, toggleview, {0} },
{ ClkTagBar, MODKEY, Button1, tag, {0} },
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
};

12
dwm.1
View File

@@ -77,6 +77,18 @@ Send focused window to previous screen, if any.
.B Mod1\-Shift\-.
Send focused window to next screen, if any.
.TP
.B Mod1\-Right
Focus tag on the right, if any.
.TP
.B Mod1\-Left
Focus tag on the left, if any.
.TP
.B Mod1\-Shift\-Right
Send focused window to tag on the right, if any.
.TP
.B Mod1\-Shift\-Left
Send focused window to tag on the left, if any.
.TP
.B Mod1\-b
Toggles bar on and off.
.TP

74
dwm.c
View File

@@ -240,6 +240,8 @@ static void spawn(const Arg *arg);
static Monitor *systraytomon(Monitor *m);
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
static void tagtoleft(const Arg *arg);
static void tagtoright(const Arg *arg);
static void tile(Monitor *);
static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
@@ -262,6 +264,9 @@ static void updatetitle(Client *c);
static void updatewindowtype(Client *c);
static void updatewmhints(Client *c);
static void view(const Arg *arg);
static void viewtoleft(const Arg *arg);
static void viewtoright(const Arg *arg);
static void warp(const Client *c);
static Client *wintoclient(Window w);
static Monitor *wintomon(Window w);
static Client *wintosystrayicon(Window w);
@@ -954,6 +959,7 @@ focusmon(const Arg *arg)
unfocus(selmon->sel, 0);
selmon = m;
focus(NULL);
warp(selmon->sel);
}
void
@@ -1586,6 +1592,8 @@ restack(Monitor *m)
}
XSync(dpy, False);
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
if (m == selmon && (m->tagset[m->seltags] & m->sel->tags) && selmon->lt[selmon->sellt] != &layouts[2])
warp(m->sel);
}
void
@@ -1651,6 +1659,28 @@ setclientstate(Client *c, long state)
PropModeReplace, (unsigned char *)data, 2);
}
void
tagtoleft(const Arg *arg) {
if(selmon->sel != NULL
&& __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
&& selmon->tagset[selmon->seltags] > 1) {
selmon->sel->tags >>= 1;
focus(NULL);
arrange(selmon);
}
}
void
tagtoright(const Arg *arg) {
if(selmon->sel != NULL
&& __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
&& selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
selmon->sel->tags <<= 1;
focus(NULL);
arrange(selmon);
}
}
int
sendevent(Window w, Atom proto, int mask, long d0, long d1, long d2, long d3, long d4)
{
@@ -2470,6 +2500,50 @@ view(const Arg *arg)
arrange(selmon);
}
void
warp(const Client *c)
{
int x, y;
if (!c) {
XWarpPointer(dpy, None, root, 0, 0, 0, 0, selmon->wx + selmon->ww/2, selmon->wy + selmon->wh/2);
return;
}
if (!getrootptr(&x, &y) ||
(x > c->x - c->bw &&
y > c->y - c->bw &&
x < c->x + c->w + c->bw*2 &&
y < c->y + c->h + c->bw*2) ||
(y > c->mon->by && y < c->mon->by + bh) ||
(c->mon->topbar && !y))
return;
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w / 2, c->h / 2);
}
void
viewtoleft(const Arg *arg) {
if(__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
&& selmon->tagset[selmon->seltags] > 1) {
selmon->seltags ^= 1; /* toggle sel tagset */
selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] >> 1;
focus(NULL);
arrange(selmon);
}
}
void
viewtoright(const Arg *arg) {
if(__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
&& selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
selmon->seltags ^= 1; /* toggle sel tagset */
selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] << 1;
focus(NULL);
arrange(selmon);
}
}
Client *
wintoclient(Window w)
{

2254
dwm.c.orig

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,115 @@
diff -up a/config.h b/config.h
--- a/config.h 2014-06-23 18:04:29.536917000 +0200
+++ b/config.h 2014-06-24 08:15:51.857173332 +0200
@@ -74,6 +74,10 @@ static Key keys[] = {
{ MODKEY, XK_period, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
+ { MODKEY, XK_Left, viewtoleft, {0} },
+ { MODKEY, XK_Right, viewtoright, {0} },
+ { MODKEY|ShiftMask, XK_Left, tagtoleft, {0} },
+ { MODKEY|ShiftMask, XK_Right, tagtoright, {0} },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
diff -up a/dwm.1 b/dwm.1
--- a/dwm.1 2014-06-23 18:04:29.532917821 +0200
+++ b/dwm.1 2014-06-23 21:52:54.095867809 +0200
@@ -71,6 +71,18 @@ Send focused window to previous screen,
.B Mod1\-Shift\-.
Send focused window to next screen, if any.
.TP
+.B Mod1\-Right
+Focus tag on the right, if any.
+.TP
+.B Mod1\-Left
+Focus tag on the left, if any.
+.TP
+.B Mod1\-Shift\-Right
+Send focused window to tag on the right, if any.
+.TP
+.B Mod1\-Shift\-Left
+Send focused window to tag on the left, if any.
+.TP
.B Mod1\-b
Toggles bar on and off.
.TP
diff -up a/dwm.c b/dwm.c
--- a/dwm.c 2014-06-23 18:04:29.532917821 +0200
+++ b/dwm.c 2014-06-24 08:17:40.921714154 +0200
@@ -226,6 +226,8 @@ static void sigchld(int unused);
static void spawn(const Arg *arg);
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
+static void tagtoleft(const Arg *arg);
+static void tagtoright(const Arg *arg);
static int textnw(const char *text, unsigned int len);
static void tile(Monitor *);
static void togglebar(const Arg *arg);
@@ -245,6 +247,8 @@ static void updatewindowtype(Client *c);
static void updatetitle(Client *c);
static void updatewmhints(Client *c);
static void view(const Arg *arg);
+static void viewtoleft(const Arg *arg);
+static void viewtoright(const Arg *arg);
static Client *wintoclient(Window w);
static Monitor *wintomon(Window w);
static int xerror(Display *dpy, XErrorEvent *ee);
@@ -1690,6 +1694,28 @@ tagmon(const Arg *arg) {
sendmon(selmon->sel, dirtomon(arg->i));
}
+void
+tagtoleft(const Arg *arg) {
+ if(selmon->sel != NULL
+ && __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
+ && selmon->tagset[selmon->seltags] > 1) {
+ selmon->sel->tags >>= 1;
+ focus(NULL);
+ arrange(selmon);
+ }
+}
+
+void
+tagtoright(const Arg *arg) {
+ if(selmon->sel != NULL
+ && __builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
+ && selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
+ selmon->sel->tags <<= 1;
+ focus(NULL);
+ arrange(selmon);
+ }
+}
+
int
textnw(const char *text, unsigned int len) {
XRectangle r;
@@ -2052,6 +2078,28 @@ view(const Arg *arg) {
arrange(selmon);
}
+void
+viewtoleft(const Arg *arg) {
+ if(__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
+ && selmon->tagset[selmon->seltags] > 1) {
+ selmon->seltags ^= 1; /* toggle sel tagset */
+ selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] >> 1;
+ focus(NULL);
+ arrange(selmon);
+ }
+}
+
+void
+viewtoright(const Arg *arg) {
+ if(__builtin_popcount(selmon->tagset[selmon->seltags] & TAGMASK) == 1
+ && selmon->tagset[selmon->seltags] & (TAGMASK >> 1)) {
+ selmon->seltags ^= 1; /* toggle sel tagset */
+ selmon->tagset[selmon->seltags] = selmon->tagset[selmon->seltags ^ 1] << 1;
+ focus(NULL);
+ arrange(selmon);
+ }
+}
+
Client *
wintoclient(Window w) {
Client *c;

View File

@@ -0,0 +1,58 @@
diff --git a/dwm.c b/dwm.c
index b2bc9bd..0329e1f 100644
--- a/dwm.c
+++ b/dwm.c
@@ -228,6 +228,7 @@ static void updatewindowtype(Client *c);
static void updatetitle(Client *c);
static void updatewmhints(Client *c);
static void view(const Arg *arg);
+static void warp(const Client *c);
static Client *wintoclient(Window w);
static Monitor *wintomon(Window w);
static int xerror(Display *dpy, XErrorEvent *ee);
@@ -842,6 +843,7 @@ focusmon(const Arg *arg)
in gedit and anjuta */
selmon = m;
focus(NULL);
+ warp(selmon->sel);
}
void
@@ -1387,6 +1389,8 @@ restack(Monitor *m)
}
XSync(dpy, False);
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
+ if (m == selmon && (m->tagset[m->seltags] & m->sel->tags) && selmon->lt[selmon->sellt] != &layouts[2])
+ warp(m->sel);
}
void
@@ -2039,6 +2043,28 @@ view(const Arg *arg)
arrange(selmon);
}
+void
+warp(const Client *c)
+{
+ int x, y;
+
+ if (!c) {
+ XWarpPointer(dpy, None, root, 0, 0, 0, 0, selmon->wx + selmon->ww/2, selmon->wy + selmon->wh/2);
+ return;
+ }
+
+ if (!getrootptr(&x, &y) ||
+ (x > c->x - c->bw &&
+ y > c->y - c->bw &&
+ x < c->x + c->w + c->bw*2 &&
+ y < c->y + c->h + c->bw*2) ||
+ (y > c->mon->by && y < c->mon->by + bh) ||
+ (c->mon->topbar && !y))
+ return;
+
+ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w / 2, c->h / 2);
+}
+
Client *
wintoclient(Window w)
{

74
tcl.c Normal file
View File

@@ -0,0 +1,74 @@
void
tcl(Monitor * m)
{
int x, y, h, w, mw, sw, bdw;
unsigned int i, n;
Client * c;
for (n = 0, c = nexttiled(m->clients); c;
c = nexttiled(c->next), n++);
if (n == 0)
return;
c = nexttiled(m->clients);
mw = m->mfact * m->ww;
sw = (m->ww - mw) / 2;
bdw = (2 * c->bw);
resize(c,
n < 3 ? m->wx : m->wx + sw,
m->wy,
n == 1 ? m->ww - bdw : mw - bdw,
m->wh - bdw,
False);
if (--n == 0)
return;
w = (m->ww - mw) / ((n > 1) + 1);
c = nexttiled(c->next);
if (n > 1)
{
x = m->wx + ((n > 1) ? mw + sw : mw);
y = m->wy;
h = m->wh / (n / 2);
if (h < bh)
h = m->wh;
for (i = 0; c && i < n / 2; c = nexttiled(c->next), i++)
{
resize(c,
x,
y,
w - bdw,
(i + 1 == n / 2) ? m->wy + m->wh - y - bdw : h - bdw,
False);
if (h != m->wh)
y = c->y + HEIGHT(c);
}
}
x = (n + 1 / 2) == 1 ? mw : m->wx;
y = m->wy;
h = m->wh / ((n + 1) / 2);
if (h < bh)
h = m->wh;
for (i = 0; c; c = nexttiled(c->next), i++)
{
resize(c,
x,
y,
(i + 1 == (n + 1) / 2) ? w - bdw : w - bdw,
(i + 1 == (n + 1) / 2) ? m->wy + m->wh - y - bdw : h - bdw,
False);
if (h != m->wh)
y = c->y + HEIGHT(c);
}
}