Compare commits
17 commits
c0fef8b024
...
b580d631eb
Author | SHA1 | Date | |
---|---|---|---|
b580d631eb | |||
6bdf768759 | |||
d717ea7bee | |||
7133f6b3e9 | |||
729133ff34 | |||
fe25e52d0b | |||
b570321c0a | |||
40476cc254 | |||
e24b12a8bf | |||
002db4dfed | |||
36438a32b7 | |||
260027814f | |||
72520fc0d6 | |||
1849f00209 | |||
|
5687f46964 | ||
|
061e9fe9a7 | ||
|
9f8855343c |
5 changed files with 302 additions and 57 deletions
10
Makefile
10
Makefile
|
@ -6,13 +6,7 @@ include config.mk
|
|||
SRC = drw.c dwm.c util.c
|
||||
OBJ = ${SRC:.c=.o}
|
||||
|
||||
all: options dwm
|
||||
|
||||
options:
|
||||
@echo dwm build options:
|
||||
@echo "CFLAGS = ${CFLAGS}"
|
||||
@echo "LDFLAGS = ${LDFLAGS}"
|
||||
@echo "CC = ${CC}"
|
||||
all: dwm
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $<
|
||||
|
@ -48,4 +42,4 @@ uninstall:
|
|||
rm -f ${DESTDIR}${PREFIX}/bin/dwm\
|
||||
${DESTDIR}${MANPREFIX}/man1/dwm.1
|
||||
|
||||
.PHONY: all options clean dist install uninstall
|
||||
.PHONY: all clean dist install uninstall
|
||||
|
|
|
@ -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 focusonwheel = 0;
|
||||
static const char *fonts[] = { "monospace:size=10" };
|
||||
static const char dmenufont[] = "monospace:size=10";
|
||||
static const char col_gray1[] = "#222222";
|
||||
|
|
249
config.h
Normal file
249
config.h
Normal file
|
@ -0,0 +1,249 @@
|
|||
/* See LICENSE file for copyright and license details. */
|
||||
|
||||
/* appearance */
|
||||
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 focusonwheel = 0;
|
||||
static const char *fonts[] = { "monospace:size=10", "IPAGothic:size=10", "Symbola: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";
|
||||
static const char col_black[] = "#000000";
|
||||
static const char col_white[] = "#ffffff";
|
||||
static const char *colors[][3] = {
|
||||
/* fg bg border */
|
||||
[SchemeNorm] = { col_gray3, col_black, col_gray2 },
|
||||
[SchemeSel] = { col_gray4, col_gray2, col_gray3 },
|
||||
};
|
||||
|
||||
/* tagging */
|
||||
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||
|
||||
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 },
|
||||
{ NULL, "float", NULL, 0, 1, -1 },
|
||||
{ "Dragon-drop", NULL, NULL, ~0, 1, -1 },
|
||||
{ NULL, NULL, "Event Tester", 0, 1, -1 },
|
||||
{ "Minecraft 1.8.9", NULL, NULL, 0, 1, -1 },
|
||||
{ "Minecraft 1.12.2", NULL, NULL, 0, 1, -1 },
|
||||
{ "Minecraft* 1.20.4", NULL, NULL, 0, 1, -1 },
|
||||
{ NULL, "Godot_Engine", NULL, 0, 1, -1 },
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
static const float mfact = 0.50; /* factor of master area size [0.05..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 = 1; /* 1 will force focus on the fullscreen window */
|
||||
|
||||
/* custom layout declarations */
|
||||
static void deck(Monitor *m);
|
||||
|
||||
static const Layout layouts[] = {
|
||||
/* symbol arrange function */
|
||||
{ "[]=", tile }, /* first entry is default */
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
{ "[M]", monocle },
|
||||
{ "[D]", deck },
|
||||
};
|
||||
|
||||
/* custom functions declarations */
|
||||
static unsigned int adjtag(const Arg *arg);
|
||||
static void viewadj(const Arg *arg);
|
||||
static void tagadj(const Arg *arg);
|
||||
static void toggletagadj(const Arg *arg);
|
||||
|
||||
/* key definitions */
|
||||
#define MODKEY Mod1Mask
|
||||
#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_black, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
|
||||
static const char *termcmd[] = { "st", NULL };
|
||||
|
||||
#define EXEC(...) { .v = (const char*[]){ __VA_ARGS__, NULL } }
|
||||
|
||||
#include <X11/XF86keysym.h>
|
||||
static Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
|
||||
{ MODKEY, XK_t, togglebar, {0} },
|
||||
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_i, incnmaster, {.i = +1 } },
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_u, incnmaster, {.i = -1 } },
|
||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_h, setmfact, {.f = -0.025} },
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_l, setmfact, {.f = +0.025} },
|
||||
{ MODKEY, XK_z, zoom, {0} },
|
||||
{ MODKEY, XK_Tab, view, {0} },
|
||||
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
||||
{ MODKEY|ShiftMask, XK_t, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY|ShiftMask, XK_f, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY|ShiftMask, XK_m, setlayout, {.v = &layouts[2]} },
|
||||
{ MODKEY|ShiftMask, XK_r, 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_comma, viewadj, {.i = -1 } },
|
||||
{ MODKEY, XK_period, viewadj, {.i = +1 } },
|
||||
{ MODKEY|ShiftMask, XK_comma, tagadj, {.i = -1 } },
|
||||
{ MODKEY|ShiftMask, XK_period, tagadj, {.i = +1 } },
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_comma, toggletagadj, {.i = -1 } },
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_period, toggletagadj, {.i = +1 } },
|
||||
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|ControlMask|ShiftMask, XK_q, quit, {0} },
|
||||
{ 0, XF86XK_AudioMute, spawn, EXEC("vol", "mute") },
|
||||
{ 0, XF86XK_AudioRaiseVolume, spawn, EXEC("vol", "up") },
|
||||
{ 0, XF86XK_AudioLowerVolume, spawn, EXEC("vol", "down") },
|
||||
{ MODKEY, XK_i, spawn, EXEC("vol", "up") },
|
||||
{ MODKEY, XK_u, spawn, EXEC("vol", "down") },
|
||||
{ MODKEY, XK_m, spawn, EXEC("vol", "mute") },
|
||||
{ MODKEY|ShiftMask, XK_i, spawn, EXEC("bri", "up") },
|
||||
{ MODKEY|ShiftMask, XK_u, spawn, EXEC("bri", "down") },
|
||||
/* { MODKEY|ControlMask, XK_space, spawn, EXEC("togglepad") }, */
|
||||
{ MODKEY, XF86XK_PowerOff, spawn, EXEC("sysact") },
|
||||
{ MODKEY, XK_Delete, spawn, EXEC("sysact") },
|
||||
{ 0, XF86XK_PowerOff, spawn, EXEC("xset", "dpms", "force", "off") },
|
||||
{ MODKEY, XK_Escape, spawn, EXEC("slock") },
|
||||
{ MODKEY, XK_a, spawn, EXEC("menu_a") },
|
||||
{ MODKEY, XK_x, spawn, EXEC("menu_x") },
|
||||
{ MODKEY, XK_semicolon, spawn, EXEC("menu_semi") },
|
||||
{ MODKEY, XK_s, spawn, EXEC("ddic") },
|
||||
{ MODKEY|ShiftMask, XK_w, spawn, EXEC("web") },
|
||||
{ MODKEY|ShiftMask, XK_w, view, {.ui = 1 << 8 } },
|
||||
{ MODKEY, XK_g, spawn, EXEC("dgen") },
|
||||
{ MODKEY, XK_apostrophe, spawn, EXEC("dsnip") },
|
||||
{ MODKEY|ShiftMask, XK_apostrophe, spawn, EXEC("duni") },
|
||||
{ MODKEY|ShiftMask, XK_p, spawn, EXEC("mpvc", "toggle") },
|
||||
{ MODKEY|ShiftMask, XK_h, spawn, EXEC("mpvc", "backward") },
|
||||
{ MODKEY|ShiftMask, XK_l, spawn, EXEC("mpvc", "forward") },
|
||||
{ MODKEY, XK_Pause, spawn, EXEC("mpvc", "stop") },
|
||||
{ 0, XF86XK_AudioPlay, spawn, EXEC("mpvc", "toggle") },
|
||||
{ 0, XF86XK_AudioStop, spawn, EXEC("mpvc", "stop") },
|
||||
{ 0, XF86XK_AudioNext, spawn, EXEC("mpvc", "next") },
|
||||
{ MODKEY, XK_n, spawn, EXEC("mpvc", "next") },
|
||||
{ 0, XF86XK_AudioPrev, spawn, EXEC("mpvc", "prev") },
|
||||
{ MODKEY, XF86XK_Forward, spawn, EXEC("mpvc", "forward") },
|
||||
{ MODKEY, XF86XK_Back, spawn, EXEC("mpvc", "backward") },
|
||||
{ 0, XF86XK_Display, spawn, EXEC("ddisplaycon") },
|
||||
{ MODKEY|ShiftMask, XK_Pause, spawn, EXEC("W") },
|
||||
{ MODKEY, XK_9, spawn, EXEC("W", "c") },
|
||||
{ MODKEY, XK_slash, spawn, EXEC("dwls") },
|
||||
{ MODKEY, XK_backslash, spawn, EXEC("scratchpad") },
|
||||
{ MODKEY, XK_F1, spawn, EXEC("univ-menu") },
|
||||
{ MODKEY, XK_F2, spawn, EXEC("mpvc", "playlist") },
|
||||
{ MODKEY, XK_F3, spawn, EXEC("dmpvc") },
|
||||
{ 0, XK_Print, spawn, EXEC("sshot") },
|
||||
{ MODKEY, XK_Print, spawn, EXEC("sshot", "-s") },
|
||||
};
|
||||
|
||||
/* 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} },
|
||||
/* { ClkWinTitle, 0, Button1, spawn, EXEC("togglepad") }, */
|
||||
};
|
||||
|
||||
/* custom functions */
|
||||
unsigned int
|
||||
adjtag(const Arg *arg)
|
||||
{
|
||||
unsigned int seltag = selmon->tagset[selmon->seltags];
|
||||
if (arg->i > 0)
|
||||
return seltag == (1 << (LENGTH(tags) - 1)) ? 1 : seltag << 1;
|
||||
else
|
||||
return seltag == 1 ? (1 << (LENGTH(tags) - 1)) : seltag >> 1;
|
||||
}
|
||||
|
||||
void
|
||||
viewadj(const Arg *arg)
|
||||
{
|
||||
view(&(const Arg){.ui = adjtag(arg)});
|
||||
}
|
||||
|
||||
void
|
||||
tagadj(const Arg *arg)
|
||||
{
|
||||
if (selmon->sel == NULL)
|
||||
return;
|
||||
tag(&(const Arg){.ui = adjtag(arg)});
|
||||
}
|
||||
|
||||
void
|
||||
toggletagadj(const Arg *arg)
|
||||
{
|
||||
if (selmon->sel == NULL)
|
||||
return;
|
||||
toggletag(&(const Arg){.ui = adjtag(arg)});
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
deck(Monitor *m) {
|
||||
unsigned int i, n, h, mw, my;
|
||||
Client *c;
|
||||
|
||||
for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||
if(n == 0)
|
||||
return;
|
||||
|
||||
if(n > m->nmaster) {
|
||||
mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||
snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
|
||||
}
|
||||
else
|
||||
mw = m->ww;
|
||||
for(i = my = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
if(i < m->nmaster) {
|
||||
h = (m->wh - my) / (MIN(n, m->nmaster) - i);
|
||||
resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False);
|
||||
my += HEIGHT(c);
|
||||
}
|
||||
else
|
||||
resize(c, m->wx + mw, m->wy, m->ww - mw - (2*c->bw), m->wh - (2*c->bw), False);
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
# dwm version
|
||||
VERSION = 6.4
|
||||
VERSION = 6.5
|
||||
|
||||
# Customize below to fit your system
|
||||
|
||||
|
|
97
dwm.c
97
dwm.c
|
@ -62,7 +62,7 @@ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
|
|||
enum { SchemeNorm, SchemeSel }; /* color schemes */
|
||||
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
|
||||
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
|
||||
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
|
||||
NetWMWindowTypeDialog, NetClientList, NetNumberOfDesktops, NetCurrentDesktop, NetLast }; /* EWMH atoms */
|
||||
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
|
||||
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
|
||||
ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
|
||||
|
@ -163,7 +163,6 @@ static void detachstack(Client *c);
|
|||
static Monitor *dirtomon(int dir);
|
||||
static void drawbar(Monitor *m);
|
||||
static void drawbars(void);
|
||||
static void enternotify(XEvent *e);
|
||||
static void expose(XEvent *e);
|
||||
static void focus(Client *c);
|
||||
static void focusin(XEvent *e);
|
||||
|
@ -182,7 +181,6 @@ static void manage(Window w, XWindowAttributes *wa);
|
|||
static void mappingnotify(XEvent *e);
|
||||
static void maprequest(XEvent *e);
|
||||
static void monocle(Monitor *m);
|
||||
static void motionnotify(XEvent *e);
|
||||
static void movemouse(const Arg *arg);
|
||||
static Client *nexttiled(Client *c);
|
||||
static void pop(Client *c);
|
||||
|
@ -202,6 +200,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 setnumbdesktops(void);
|
||||
static void setup(void);
|
||||
static void seturgent(Client *c, int urg);
|
||||
static void showhide(Client *c);
|
||||
|
@ -219,6 +218,7 @@ static void unmapnotify(XEvent *e);
|
|||
static void updatebarpos(Monitor *m);
|
||||
static void updatebars(void);
|
||||
static void updateclientlist(void);
|
||||
static void updatecurrenddesktop(void);
|
||||
static int updategeom(void);
|
||||
static void updatenumlockmask(void);
|
||||
static void updatesizehints(Client *c);
|
||||
|
@ -249,13 +249,11 @@ static void (*handler[LASTEvent]) (XEvent *) = {
|
|||
[ConfigureRequest] = configurerequest,
|
||||
[ConfigureNotify] = configurenotify,
|
||||
[DestroyNotify] = destroynotify,
|
||||
[EnterNotify] = enternotify,
|
||||
[Expose] = expose,
|
||||
[FocusIn] = focusin,
|
||||
[KeyPress] = keypress,
|
||||
[MappingNotify] = mappingnotify,
|
||||
[MapRequest] = maprequest,
|
||||
[MotionNotify] = motionnotify,
|
||||
[PropertyNotify] = propertynotify,
|
||||
[UnmapNotify] = unmapnotify
|
||||
};
|
||||
|
@ -426,7 +424,8 @@ buttonpress(XEvent *e)
|
|||
|
||||
click = ClkRootWin;
|
||||
/* focus monitor if necessary */
|
||||
if ((m = wintomon(ev->window)) && m != selmon) {
|
||||
if ((m = wintomon(ev->window)) && m != selmon
|
||||
&& (focusonwheel || (ev->button != Button4 && ev->button != Button5))) {
|
||||
unfocus(selmon->sel, 1);
|
||||
selmon = m;
|
||||
focus(NULL);
|
||||
|
@ -446,8 +445,8 @@ buttonpress(XEvent *e)
|
|||
else
|
||||
click = ClkWinTitle;
|
||||
} else if ((c = wintoclient(ev->window))) {
|
||||
focus(c);
|
||||
restack(selmon);
|
||||
if (focusonwheel || (ev->button != Button4 && ev->button != Button5))
|
||||
focus(c);
|
||||
XAllowEvents(dpy, ReplayPointer, CurrentTime);
|
||||
click = ClkClientWin;
|
||||
}
|
||||
|
@ -517,6 +516,7 @@ clientmessage(XEvent *e)
|
|||
{
|
||||
XClientMessageEvent *cme = &e->xclient;
|
||||
Client *c = wintoclient(cme->window);
|
||||
unsigned int i;
|
||||
|
||||
if (!c)
|
||||
return;
|
||||
|
@ -526,8 +526,14 @@ clientmessage(XEvent *e)
|
|||
setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */
|
||||
|| (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen)));
|
||||
} else if (cme->message_type == netatom[NetActiveWindow]) {
|
||||
if (c != selmon->sel && !c->isurgent)
|
||||
seturgent(c, 1);
|
||||
for (i = 0; i < LENGTH(tags) && !((1 << i) & c->tags); i++);
|
||||
if (i < LENGTH(tags)) {
|
||||
const Arg a = {.ui = 1 << i};
|
||||
selmon = c->mon;
|
||||
view(&a);
|
||||
focus(c);
|
||||
restack(selmon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -642,7 +648,7 @@ createmon(void)
|
|||
m->showbar = showbar;
|
||||
m->topbar = topbar;
|
||||
m->lt[0] = &layouts[0];
|
||||
m->lt[1] = &layouts[1 % LENGTH(layouts)];
|
||||
m->lt[1] = &layouts[2 % LENGTH(layouts)];
|
||||
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
|
||||
return m;
|
||||
}
|
||||
|
@ -757,25 +763,6 @@ drawbars(void)
|
|||
drawbar(m);
|
||||
}
|
||||
|
||||
void
|
||||
enternotify(XEvent *e)
|
||||
{
|
||||
Client *c;
|
||||
Monitor *m;
|
||||
XCrossingEvent *ev = &e->xcrossing;
|
||||
|
||||
if ((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root)
|
||||
return;
|
||||
c = wintoclient(ev->window);
|
||||
m = c ? c->mon : wintomon(ev->window);
|
||||
if (m != selmon) {
|
||||
unfocus(selmon->sel, 1);
|
||||
selmon = m;
|
||||
} else if (!c || c == selmon->sel)
|
||||
return;
|
||||
focus(c);
|
||||
}
|
||||
|
||||
void
|
||||
expose(XEvent *e)
|
||||
{
|
||||
|
@ -1125,23 +1112,6 @@ monocle(Monitor *m)
|
|||
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
|
||||
}
|
||||
|
||||
void
|
||||
motionnotify(XEvent *e)
|
||||
{
|
||||
static Monitor *mon = NULL;
|
||||
Monitor *m;
|
||||
XMotionEvent *ev = &e->xmotion;
|
||||
|
||||
if (ev->window != root)
|
||||
return;
|
||||
if ((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) {
|
||||
unfocus(selmon->sel, 1);
|
||||
selmon = m;
|
||||
focus(NULL);
|
||||
}
|
||||
mon = m;
|
||||
}
|
||||
|
||||
void
|
||||
movemouse(const Arg *arg)
|
||||
{
|
||||
|
@ -1433,6 +1403,13 @@ sendmon(Client *c, Monitor *m)
|
|||
arrange(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
setcurrentdesktop(void){
|
||||
long data[] = { 0 };
|
||||
XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32,
|
||||
PropModeReplace, (unsigned char *)data, 1);
|
||||
}
|
||||
|
||||
void
|
||||
setclientstate(Client *c, long state)
|
||||
{
|
||||
|
@ -1536,6 +1513,13 @@ setmfact(const Arg *arg)
|
|||
arrange(selmon);
|
||||
}
|
||||
|
||||
void
|
||||
setnumbdesktops(void){
|
||||
long data[] = { TAGMASK };
|
||||
XChangeProperty(dpy, root, netatom[NetNumberOfDesktops], XA_CARDINAL, 32,
|
||||
PropModeReplace, (unsigned char *)data, 1);
|
||||
}
|
||||
|
||||
void
|
||||
setup(void)
|
||||
{
|
||||
|
@ -1579,6 +1563,9 @@ setup(void)
|
|||
netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
|
||||
netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False);
|
||||
netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);
|
||||
netatom[NetNumberOfDesktops] = XInternAtom(dpy, "_NET_NUMBER_OF_DESKTOPS", False);
|
||||
netatom[NetCurrentDesktop] = XInternAtom(dpy, "_NET_CURRENT_DESKTOP", False);
|
||||
|
||||
/* init cursors */
|
||||
cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
|
||||
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
|
||||
|
@ -1602,6 +1589,10 @@ setup(void)
|
|||
XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
|
||||
PropModeReplace, (unsigned char *) netatom, NetLast);
|
||||
XDeleteProperty(dpy, root, netatom[NetClientList]);
|
||||
/* set EWMH NUMBER_OF_DESKTOPS */
|
||||
setnumbdesktops();
|
||||
/* initialize EWMH CURRENT_DESKTOP */
|
||||
setcurrentdesktop();
|
||||
/* select events */
|
||||
wa.cursor = cursor[CurNormal]->cursor;
|
||||
wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask
|
||||
|
@ -1760,6 +1751,7 @@ toggleview(const Arg *arg)
|
|||
focus(NULL);
|
||||
arrange(selmon);
|
||||
}
|
||||
updatecurrenddesktop();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1851,7 +1843,7 @@ updatebarpos(Monitor *m)
|
|||
}
|
||||
|
||||
void
|
||||
updateclientlist()
|
||||
updateclientlist(void)
|
||||
{
|
||||
Client *c;
|
||||
Monitor *m;
|
||||
|
@ -1864,6 +1856,14 @@ updateclientlist()
|
|||
(unsigned char *) &(c->win), 1);
|
||||
}
|
||||
|
||||
void
|
||||
updatecurrenddesktop(void)
|
||||
{
|
||||
long data[] = { selmon->tagset[selmon->seltags] };
|
||||
XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32,
|
||||
PropModeReplace, (unsigned char *)data, 1);
|
||||
}
|
||||
|
||||
int
|
||||
updategeom(void)
|
||||
{
|
||||
|
@ -2060,6 +2060,7 @@ view(const Arg *arg)
|
|||
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
updatecurrenddesktop();
|
||||
}
|
||||
|
||||
Client *
|
||||
|
|
Loading…
Reference in a new issue