Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
061578bd73 | ||
|
|
c3f392644c | ||
|
|
56b069739b | ||
|
|
699c7bd99c | ||
|
|
f7ee3c4d2a | ||
|
|
12b83c13ba | ||
|
|
b05b22ae95 | ||
|
|
5cab3cf6c1 | ||
|
|
b313ef7f43 | ||
|
|
4481fb0cee | ||
|
|
919619109c | ||
|
|
61b5d9251c | ||
|
|
22fb46f457 | ||
|
|
6234484ad8 | ||
|
|
7a5a2fde14 | ||
|
|
85822e7ff4 | ||
|
|
0dc85103d6 | ||
|
|
47c132db4e | ||
|
|
72dbded0e1 | ||
|
|
fa6ff46c1c | ||
|
|
479cf61077 | ||
|
|
1b402fe688 | ||
|
|
66c42c2531 | ||
|
|
c7d43eabc2 | ||
|
|
fd71d7ec1d |
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
dwm
|
||||||
|
dwm.o
|
||||||
|
*.o
|
||||||
188
config.h
Normal file
188
config.h
Normal file
@@ -0,0 +1,188 @@
|
|||||||
|
/* 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"
|
||||||
|
// to use x keysymbols (eg xev button produces XF86AudioraiseVolume = XF86XK_AudioRaisevolume)
|
||||||
|
#include <X11/XF86keysym.h>
|
||||||
|
|
||||||
|
/* 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[] = { "Terminus:size=10" };
|
||||||
|
static const char dmenufont[] = "Terminus: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";
|
||||||
|
// this is to remove the border from non-selected windows
|
||||||
|
static const char col_norm_bdr[] = "#222222";
|
||||||
|
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 },
|
||||||
|
// make calculator floating
|
||||||
|
{ "SpeedCrunch", NULL, NULL, 0, 1, -1 },
|
||||||
|
{ "URxvt", NULL, "urxvt-f", 0, 1, -1 },
|
||||||
|
{ "mpv", NULL, NULL, 0, 1, -1 },
|
||||||
|
{ "vlc", NULL, NULL, 0, 1, -1 },
|
||||||
|
// didnt work
|
||||||
|
{ "org.gnome.Nautilus", NULL, NULL, 0, 1, -1 },
|
||||||
|
// $ xprop WM_CLASS #working below!
|
||||||
|
{ "Org.gnome.Nautilus", NULL, NULL, 0, 1, -1 },
|
||||||
|
{ "anki", NULL, NULL, 0, 1, -1 },
|
||||||
|
// { "Firefox", NULL, NULL, 1 << 8, 0, -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 *floattermcmd[] = { "urxvt256c", "-name", "urxvt-f", 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 *playerctl_play_pause[] = { "playerctl_play_pause", NULL};
|
||||||
|
static const char *playerctl_previous[] = { "playerctl_previous", NULL};
|
||||||
|
static const char *playerctl_next[] = { "playerctl_next", 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|ControlMask, XK_Return, spawn, {.v = floattermcmd } },
|
||||||
|
{ 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} },
|
||||||
|
// modified to alternative kill window
|
||||||
|
{ MODKEY|ShiftMask, XK_q, killclient, {0} },
|
||||||
|
{ MODKEY|ControlMask, XK_q, quit, {0} },
|
||||||
|
{ 0, XK_Print, spawn, {.v = prtscrcmd } },
|
||||||
|
{ MODKEY, XK_F8, spawn, {.v = playerctl_play_pause } },
|
||||||
|
{ MODKEY, XK_F9, spawn, {.v = playerctl_previous } },
|
||||||
|
{ MODKEY, XK_F10, spawn, {.v = playerctl_next } },
|
||||||
|
{ MODKEY, XK_F11, spawn, {.v = vol_down } },
|
||||||
|
{ MODKEY, XK_F12, spawn, {.v = vol_up } },
|
||||||
|
// trying to get volume knob working - trying symbols from XF86keysym.h and the keysym printed from xev
|
||||||
|
{ 0, XF86XK_AudioRaiseVolume, spawn, {.v = vol_up } },
|
||||||
|
{ 0, XF86XK_AudioLowerVolume, spawn, {.v = vol_down } },
|
||||||
|
{ 0, XF86XK_AudioMute, spawn, {.v = playerctl_play_pause } },
|
||||||
|
//{ MODKEY, 0x1008ff13, spawn, {.v = vol_up} },
|
||||||
|
//{ 0, 0x1008ff12, spawn, {.v = playerctl_play_pause } },
|
||||||
|
//{ MODKEY, 0x1008ff11, spawn, {.v = vol_down } },
|
||||||
|
// end volume knob
|
||||||
|
{ 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
12
dwm.1
@@ -77,6 +77,18 @@ Send focused window to previous screen, if any.
|
|||||||
.B Mod1\-Shift\-.
|
.B Mod1\-Shift\-.
|
||||||
Send focused window to next screen, if any.
|
Send focused window to next screen, if any.
|
||||||
.TP
|
.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
|
.B Mod1\-b
|
||||||
Toggles bar on and off.
|
Toggles bar on and off.
|
||||||
.TP
|
.TP
|
||||||
|
|||||||
74
dwm.c
74
dwm.c
@@ -240,6 +240,8 @@ static void spawn(const Arg *arg);
|
|||||||
static Monitor *systraytomon(Monitor *m);
|
static Monitor *systraytomon(Monitor *m);
|
||||||
static void tag(const Arg *arg);
|
static void tag(const Arg *arg);
|
||||||
static void tagmon(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 tile(Monitor *);
|
||||||
static void togglebar(const Arg *arg);
|
static void togglebar(const Arg *arg);
|
||||||
static void togglefloating(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 updatewindowtype(Client *c);
|
||||||
static void updatewmhints(Client *c);
|
static void updatewmhints(Client *c);
|
||||||
static void view(const Arg *arg);
|
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 Client *wintoclient(Window w);
|
||||||
static Monitor *wintomon(Window w);
|
static Monitor *wintomon(Window w);
|
||||||
static Client *wintosystrayicon(Window w);
|
static Client *wintosystrayicon(Window w);
|
||||||
@@ -954,6 +959,7 @@ focusmon(const Arg *arg)
|
|||||||
unfocus(selmon->sel, 0);
|
unfocus(selmon->sel, 0);
|
||||||
selmon = m;
|
selmon = m;
|
||||||
focus(NULL);
|
focus(NULL);
|
||||||
|
warp(selmon->sel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1586,6 +1592,8 @@ restack(Monitor *m)
|
|||||||
}
|
}
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
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
|
void
|
||||||
@@ -1651,6 +1659,28 @@ setclientstate(Client *c, long state)
|
|||||||
PropModeReplace, (unsigned char *)data, 2);
|
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
|
int
|
||||||
sendevent(Window w, Atom proto, int mask, long d0, long d1, long d2, long d3, long d4)
|
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);
|
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 *
|
Client *
|
||||||
wintoclient(Window w)
|
wintoclient(Window w)
|
||||||
{
|
{
|
||||||
|
|||||||
2254
dwm.c.orig
2254
dwm.c.orig
File diff suppressed because it is too large
Load Diff
115
patches/dwm-focusadjacenttag-6.0.diff
Normal file
115
patches/dwm-focusadjacenttag-6.0.diff
Normal 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;
|
||||||
58
patches/dwm-warp-git-20160626-7af4d43.diff
Normal file
58
patches/dwm-warp-git-20160626-7af4d43.diff
Normal 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
74
tcl.c
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user