Compare commits
17 Commits
40701c6c58
...
e9719522e6
Author | SHA1 | Date | |
---|---|---|---|
|
e9719522e6 | ||
|
5ea0081aaf | ||
3807b98084 | |||
12569e61c5 | |||
|
50514a2e9a | ||
bb6ccde971 | |||
|
75a4d98edc | ||
590f4d7602 | |||
|
43d9dc4a93 | ||
f8030a0859 | |||
f20074cd72 | |||
cedafa274c | |||
24c27ad415 | |||
|
9d11cd7d18 | ||
d2b23e176d | |||
7a3a2c3cc1 | |||
c4ccdce0b6 |
3
Makefile
3
Makefile
@ -48,4 +48,7 @@ uninstall:
|
||||
rm -f ${DESTDIR}${PREFIX}/bin/dwm\
|
||||
${DESTDIR}${MANPREFIX}/man1/dwm.1
|
||||
|
||||
reload:
|
||||
pkill dwm
|
||||
|
||||
.PHONY: all options clean dist install uninstall
|
||||
|
12
config.def.h
12
config.def.h
@ -31,10 +31,10 @@ static const Rule rules[] = {
|
||||
* WM_CLASS(STRING) = instance, class
|
||||
* WM_NAME(STRING) = title
|
||||
*/
|
||||
/* class instance title tags mask isfloating isterminal noswallow monitor */
|
||||
{ "Gimp", NULL, NULL, 0, 1, 0, 0, -1 },
|
||||
{ "Firefox", NULL, NULL, 1 << 8, 0, 0, 0, -1 },
|
||||
{ "st", NULL, NULL, 0, 0, 1, 1, -1 },
|
||||
/* class instance title tags mask isfloating isfakefullscreen isterminal noswallow ignoretransient monitor */
|
||||
{ "Gimp", NULL, NULL, 0, 1, 0, 0, 0, 0, -1 },
|
||||
{ "Firefox", NULL, NULL, 1 << 8, 0, 1, 0, 0, 0, -1 },
|
||||
{ "st", NULL, NULL, 0, 0, 0, 1, 1, 0, -1 },
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
@ -84,8 +84,10 @@ static Key keys[] = {
|
||||
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||
{ MODKEY, XK_c, setlayout, {.v = &layouts[3]} },
|
||||
{ MODKEY, XK_space, setlayout, {0} },
|
||||
{ MODKEY|ShiftMask, XK_f, fullscreen, {0} },
|
||||
{ MODKEY, XK_space, setlayout, {0} },
|
||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||
{ MODKEY|ShiftMask, XK_f, togglefullscr, {0} },
|
||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
||||
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||
|
68
config.h
68
config.h
@ -17,26 +17,26 @@
|
||||
#define XF86AudioPause 0x1008ff31
|
||||
|
||||
/* appearance */
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
static const unsigned int borderpx = 2; /* border pixel of windows */
|
||||
static const unsigned int gappx = 5; /* gaps between 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 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 *fonts[] = { "emojione:size=10", "monospace:size=10"};
|
||||
static const char dmenufont[] = "monospace:size=10";
|
||||
static const char col_gray1[] = "#141414";
|
||||
static const char col_gray2[] = "#444444";
|
||||
static const char col_gray3[] = "#bbbbbb";
|
||||
static const char col_gray4[] = "#eeeeee";
|
||||
static const char col_cyan[] = "#224488";
|
||||
static const char col_gray1[] = "#232323";
|
||||
static const char col_gray2[] = "#303030";
|
||||
static const char col_gray3[] = "#404040";
|
||||
static const char col_gray4[] = "#b1b1b1";
|
||||
static const char col_gray5[] = "#c0c0c0";
|
||||
static const char *colors[][3] = {
|
||||
/* fg bg border */
|
||||
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
|
||||
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
||||
[SchemeNorm] = { col_gray4, col_gray1, col_gray2 },
|
||||
[SchemeSel] = { col_gray4, col_gray2, col_gray5 },
|
||||
};
|
||||
|
||||
/* tagging */
|
||||
@ -47,16 +47,21 @@ static const Rule rules[] = {
|
||||
* WM_CLASS(STRING) = instance, class
|
||||
* WM_NAME(STRING) = title
|
||||
*/
|
||||
/* class instance title tags mask isfloating isterminal noswallow monitor */
|
||||
|
||||
{"jetbrains-studio", NULL, NULL, 0, 1, 0, 0, -1 },
|
||||
{"st", NULL, NULL, 0, 0, 1, 1, -1},
|
||||
{"Xephyr", NULL, NULL, 0, 1, 0, 0, -1},
|
||||
{"Xnest", NULL, NULL, 0, 1, 0, 0, -1},
|
||||
{"streamdeck", NULL, NULL, 0, 0, 0, 1, -1},
|
||||
{"jetbrains-toolbox", NULL, NULL, 0, 1, 0, 1, -1},
|
||||
{"jetbrains-idea", NULL, NULL, 0, 0, 0, 1, -1},
|
||||
{"jetbrains-idea", NULL, "Welcome to IntelliJ IDEA", 0, 1, 0, 1, -1},
|
||||
/* class instance title tags mask isfloating isfakefullscreen isterminal noswallow ignoretransient monitor */
|
||||
{"jetbrains-studio", NULL, NULL, 0, 1, 0, 0, 0, 0, -1},
|
||||
{"st", NULL, NULL, 0, 0, 0, 1, 1, 0, -1},
|
||||
{"Xephyr", NULL, NULL, 0, 1, 0, 0, 0, 0, -1},
|
||||
{"Xnest", NULL, NULL, 0, 1, 0, 0, 0, 0, -1},
|
||||
{"streamdeck", NULL, NULL, 0, 0, 0, 0, 1, 0, -1},
|
||||
{"jetbrains-toolbox", NULL, NULL, 0, 1, 0, 0, 1, 0, -1},
|
||||
{"jetbrains-idea", NULL, NULL, 0, 0, 0, 0, 1, 1, -1},
|
||||
{"jetbrains-studio", NULL, NULL, 0, 0, 0, 0, 1, 1, -1},
|
||||
{"jetbrains-webstorm", NULL, NULL, 0, 0, 0, 0, 1, 1, -1},
|
||||
{"jetbrains-clion", NULL, NULL, 0, 0, 0, 0, 1, 1, -1},
|
||||
{"jetbrains-pycharm", NULL, NULL, 0, 0, 0, 0, 1, 1, -1},
|
||||
{"jetbrains-idea", NULL, "Welcome to IntelliJ IDEA", 0, 1, 0, 0, 1, 0, -1},
|
||||
{"looking-glass-client", NULL, NULL, 0, 1, 0, 0, 1, 0, -1},
|
||||
{"firefox", NULL, NULL, 0, 0, 1, 0, 0, 0, -1},
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
@ -85,12 +90,13 @@ 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 *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray5, "-sb", col_gray2, "-sf", col_gray4, NULL };
|
||||
static const char *termcmd[] = { "st", NULL };
|
||||
|
||||
static Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
{ MODKEY, XK_d, spawn, {.v = dmenucmd } },
|
||||
{ MODKEY, XK_b, spawn, SHCMD("bt-menu") },
|
||||
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
|
||||
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
||||
@ -106,6 +112,8 @@ static Key keys[] = {
|
||||
// { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||
{ MODKEY, XK_space, setlayout, {0} },
|
||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||
{ MODKEY|ShiftMask, XK_f, togglefullscr, {0} },
|
||||
{ MODKEY|ShiftMask, XK_g, fullscreen, {0} },
|
||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
||||
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||
@ -121,13 +129,17 @@ static Key keys[] = {
|
||||
{ MODKEY, XK_F5, spawn, SHCMD("idea") },
|
||||
{ MODKEY, XK_F6, spawn, SHCMD("clion") },
|
||||
{ MODKEY, XK_F7, spawn, SHCMD("pycharm") },
|
||||
{ 0, XK_Print, spawn, SHCMD("screenshot") },
|
||||
{ 0, XK_Print, spawn, SHCMD("gnome-screenshot -i") },
|
||||
{ MODKEY|ShiftMask, XK_s, spawn, SHCMD("gnome-screenshot -a")},
|
||||
|
||||
{ 0, XF86AudioPlay, spawn, SHCMD("playerctl play-pause")} ,
|
||||
{ 0, XF86AudioPause, spawn, SHCMD("playerctl pause")} ,
|
||||
{ 0, XF86AudioStop, spawn, SHCMD("playerctl stop")} ,
|
||||
{ 0, XF86AudioNext, spawn, SHCMD("playerctl next")} ,
|
||||
{ 0, XF86AudioPrev, spawn, SHCMD("playerctl previous")} ,
|
||||
{ 0, XF86AudioPlay, spawn, SHCMD("playerctl play-pause")} ,
|
||||
{ 0, XF86AudioPause, spawn, SHCMD("playerctl pause")} ,
|
||||
{ 0, XF86AudioStop, spawn, SHCMD("playerctl stop")} ,
|
||||
{ 0, XF86AudioNext, spawn, SHCMD("playerctl next")} ,
|
||||
{ 0, XF86AudioPrev, spawn, SHCMD("playerctl previous")} ,
|
||||
{ 0, XF86AudioLowerVolume, spawn, SHCMD("volume-set 2%-")},
|
||||
{ 0, XF86AudioRaiseVolume, spawn, SHCMD("volume-set 2%+")},
|
||||
{ 0, XF86AudioMute, spawn, SHCMD("amixer -D pulse sset Master toggle")},
|
||||
|
||||
TAGKEYS( XK_1, 0)
|
||||
TAGKEYS( XK_2, 1)
|
||||
@ -148,7 +160,7 @@ static Button buttons[] = {
|
||||
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
||||
{ ClkWinTitle, 0, Button2, zoom, {0} },
|
||||
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
||||
{ ClkStatusText, 0, Button2, spawn, SHCMD("gsimplecal") },
|
||||
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
||||
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
||||
|
74
dwm.c
74
dwm.c
@ -113,7 +113,7 @@ struct Client {
|
||||
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
||||
int bw, oldbw;
|
||||
unsigned int tags;
|
||||
int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, isterminal, noswallow;
|
||||
int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, isfakefullscreen, isterminal, noswallow, ignoretransient;
|
||||
pid_t pid;
|
||||
Client *next;
|
||||
Client *snext;
|
||||
@ -162,8 +162,10 @@ typedef struct {
|
||||
const char *title;
|
||||
unsigned int tags;
|
||||
int isfloating;
|
||||
int isfakefullscreen;
|
||||
int isterminal;
|
||||
int noswallow;
|
||||
int ignoretransient;
|
||||
int monitor;
|
||||
} Rule;
|
||||
|
||||
@ -241,6 +243,7 @@ static void sendmon(Client *c, Monitor *m);
|
||||
static void setclientstate(Client *c, long state);
|
||||
static void setfocus(Client *c);
|
||||
static void setfullscreen(Client *c, int fullscreen);
|
||||
static void fullscreen(const Arg *arg);
|
||||
static void setgaps(const Arg *arg);
|
||||
static void setlayout(const Arg *arg);
|
||||
static void setmfact(const Arg *arg);
|
||||
@ -257,6 +260,7 @@ static Client *termforwin(const Client *c);
|
||||
static void tile(Monitor *);
|
||||
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);
|
||||
@ -354,6 +358,8 @@ applyrules(Client *c)
|
||||
{
|
||||
c->isterminal = r->isterminal;
|
||||
c->isfloating = r->isfloating;
|
||||
c->isfakefullscreen = r->isfakefullscreen;
|
||||
c->ignoretransient = r->ignoretransient;
|
||||
c->tags |= r->tags;
|
||||
for (m = mons; m && m->num != r->monitor; m = m->next);
|
||||
if (m)
|
||||
@ -688,7 +694,8 @@ clientmessage(XEvent *e)
|
||||
if (cme->data.l[1] == netatom[NetWMFullscreen]
|
||||
|| cme->data.l[2] == netatom[NetWMFullscreen])
|
||||
setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */
|
||||
|| (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen)));
|
||||
|| (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */
|
||||
&& (!c->isfullscreen || c->isfakefullscreen))));
|
||||
} else if (cme->message_type == netatom[NetActiveWindow]) {
|
||||
if (c != selmon->sel && !c->isurgent)
|
||||
seturgent(c, 1);
|
||||
@ -732,7 +739,8 @@ configurenotify(XEvent *e)
|
||||
updatebars();
|
||||
for (m = mons; m; m = m->next) {
|
||||
for (c = m->clients; c; c = c->next)
|
||||
if (c->isfullscreen)
|
||||
if (c->isfullscreen
|
||||
&& !c->isfakefullscreen)
|
||||
resizeclient(c, m->mx, m->my, m->mw, m->mh);
|
||||
resizebarwin(m);
|
||||
}
|
||||
@ -1353,7 +1361,8 @@ movemouse(const Arg *arg)
|
||||
|
||||
if (!(c = selmon->sel))
|
||||
return;
|
||||
if (c->isfullscreen) /* no support moving fullscreen windows by mouse */
|
||||
if (c->isfullscreen
|
||||
&& !c->isfakefullscreen) /* no support moving fullscreen windows by mouse */
|
||||
return;
|
||||
restack(selmon);
|
||||
ocx = c->x;
|
||||
@ -1453,9 +1462,9 @@ propertynotify(XEvent *e)
|
||||
switch(ev->atom) {
|
||||
default: break;
|
||||
case XA_WM_TRANSIENT_FOR:
|
||||
if (!c->isfloating && (XGetTransientForHint(dpy, c->win, &trans)) &&
|
||||
(c->isfloating = (wintoclient(trans)) != NULL))
|
||||
arrange(c->mon);
|
||||
if (!c->ignoretransient && !c->isfloating && (XGetTransientForHint(dpy, c->win, &trans)) &&
|
||||
(c->isfloating = (wintoclient(trans)) != NULL))
|
||||
arrange(c->mon);
|
||||
break;
|
||||
case XA_WM_NORMAL_HINTS:
|
||||
updatesizehints(c);
|
||||
@ -1534,6 +1543,14 @@ 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(selmon->showbar) {
|
||||
} else {
|
||||
wc.border_width = 0;
|
||||
c->w = wc.width += c->bw * 2;
|
||||
c->h = wc.height += c->bw * 2;
|
||||
}
|
||||
|
||||
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
|
||||
configure(c);
|
||||
XSync(dpy, False);
|
||||
@ -1550,7 +1567,8 @@ resizemouse(const Arg *arg)
|
||||
|
||||
if (!(c = selmon->sel))
|
||||
return;
|
||||
if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */
|
||||
if (c->isfullscreen
|
||||
&& !c->isfakefullscreen) /* no support resizing fullscreen windows by mouse */
|
||||
return;
|
||||
restack(selmon);
|
||||
ocx = c->x;
|
||||
@ -1751,6 +1769,10 @@ setfullscreen(Client *c, int fullscreen)
|
||||
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
|
||||
PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
|
||||
c->isfullscreen = 1;
|
||||
if (c->isfakefullscreen) {
|
||||
resizeclient(c, c->x, c->y, c->w, c->h);
|
||||
return;
|
||||
}
|
||||
c->oldstate = c->isfloating;
|
||||
c->oldbw = c->bw;
|
||||
c->bw = 0;
|
||||
@ -1761,6 +1783,10 @@ setfullscreen(Client *c, int fullscreen)
|
||||
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
|
||||
PropModeReplace, (unsigned char*)0, 0);
|
||||
c->isfullscreen = 0;
|
||||
if (c->isfakefullscreen) {
|
||||
resizeclient(c, c->x, c->y, c->w, c->h);
|
||||
return;
|
||||
}
|
||||
c->isfloating = c->oldstate;
|
||||
c->bw = c->oldbw;
|
||||
c->x = c->oldx;
|
||||
@ -1782,6 +1808,19 @@ setgaps(const Arg *arg)
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
Layout *last_layout;
|
||||
void
|
||||
fullscreen(const Arg *arg)
|
||||
{
|
||||
if (selmon->showbar) {
|
||||
for(last_layout = (Layout *)layouts; last_layout != selmon->lt[selmon->sellt]; last_layout++);
|
||||
setlayout(&((Arg) { .v = &layouts[3] }));
|
||||
} else {
|
||||
setlayout(&((Arg) { .v = last_layout }));
|
||||
}
|
||||
togglebar(arg);
|
||||
}
|
||||
|
||||
void
|
||||
setlayout(const Arg *arg)
|
||||
{
|
||||
@ -1912,7 +1951,8 @@ showhide(Client *c)
|
||||
if (ISVISIBLE(c)) {
|
||||
/* show clients top down */
|
||||
XMoveWindow(dpy, c->win, c->x, c->y);
|
||||
if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
|
||||
if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating)
|
||||
&& (!c->isfullscreen || c->isfakefullscreen))
|
||||
resize(c, c->x, c->y, c->w, c->h, 0);
|
||||
showhide(c->snext);
|
||||
} else {
|
||||
@ -2004,13 +2044,13 @@ col(Monitor *m) {
|
||||
mw = m->ww - m->gappx;
|
||||
for(i =0, x = y = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
||||
if(i < m->nmaster) {
|
||||
w = (mw - x) / (MIN(n, m->nmaster)-i) - m->gappx;
|
||||
resize(c, x + m->wx + m->gappx, m->wy + m->gappx, w - (2*c->bw) - (2*m->gappx), m->wh - ((2*c->bw) + (2*m->gappx)), False);
|
||||
w = (mw - x) / (MIN(n, m->nmaster)-i);
|
||||
resize(c, x + m->wx, m->wy + m->gappx, w - (2*c->bw), m->wh - ((2*c->bw) + (2*m->gappx)), False);
|
||||
x += WIDTH(c) + m->gappx;
|
||||
}
|
||||
else {
|
||||
h = (m->wh - y) / (n - i) - m->gappx;
|
||||
resize(c, x + m->wx + m->gappx, m->wy + y, m->ww - x - (2*c->bw) - (2*m->gappx), h - (2*c->bw), False);
|
||||
resize(c, x + m->wx, m->wy + y, m->ww - x - (2*c->bw) - m->gappx, h - (2*c->bw), False);
|
||||
y += HEIGHT(c) + m->gappx;
|
||||
}
|
||||
}
|
||||
@ -2041,7 +2081,8 @@ togglefloating(const Arg *arg)
|
||||
{
|
||||
if (!selmon->sel)
|
||||
return;
|
||||
if (selmon->sel->isfullscreen) /* no support for fullscreen windows */
|
||||
if (selmon->sel->isfullscreen
|
||||
&& !selmon->sel->isfakefullscreen) /* no support for fullscreen windows */
|
||||
return;
|
||||
selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
|
||||
if (selmon->sel->isfloating)
|
||||
@ -2050,6 +2091,13 @@ togglefloating(const Arg *arg)
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
void
|
||||
togglefullscr(const Arg *arg)
|
||||
{
|
||||
if(selmon->sel)
|
||||
setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
|
||||
}
|
||||
|
||||
void
|
||||
toggletag(const Arg *arg)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user