Compare commits

...

3 Commits

Author SHA1 Message Date
Aryadev Chavali
6eb2ae7c8b Delete old layouts from explanation in dwm.1 2025-11-26 03:27:22 +00:00
Aryadev Chavali
f26327a181 Make selected client have a white border 2025-11-26 03:25:18 +00:00
Aryadev Chavali
879e7d351d Add focusonactive patch to DWM
When an application tags itself as "active" i.e. has something to do,
this patch will ensure that we're focused on it.  Works on multiple
monitors!
2025-11-26 03:23:30 +00:00
4 changed files with 71 additions and 37 deletions

View File

@@ -27,7 +27,7 @@ static const char col_dgreen[] = "#008000";
static const char *colors[][3] = {
/* Scheme fg bg border */
[SchemeNorm] = { col_gray3, col_black, col_black },
[SchemeSel] = { col_white, col_black, "#000077" },
[SchemeSel] = { col_white, col_black, col_white },
[SchemeStatus] = { col_white, col_black, col_black },
[SchemeTagsSel] = { col_white, col_gray2, col_black },
[SchemeTagsNorm] = { col_white, col_black, col_black },

38
dwm.1
View File

@@ -17,30 +17,16 @@ area on the left contains one window by default, and the stacking area
on the right contains all other windows. The number of master area
windows can be adjusted from zero to an arbitrary number.
.IP \[bu]
monocle (normal, centred or floating)
monocle (normal or floating master)
Normal: all windows are maximised to the screen size.
Centred: the screen is split into three sections with the master
clients getting the second section and the stacking clients get the
remaining 2 sections to be laid out in.
Floating: the master clients are placed floating in the centre of the
screen while the remaining stacking clients are placed side by side
vertically.
.IP \[bu]
fibonacci (dwindle and spiral): windows are tiled in a spiralling or
dwindling pattern.
In the dwindle layout new clients tend towards the bottom left of the
monitor while in the spiral layout clients tend towards the centre
bottom left.
Floating master: the master clients are placed floating in the centre
of the screen while the remaining stacking clients are placed side by
side vertically.
.IP \[bu]
deck: the stacking clients are placed floating on top of each other
such that there are only two partitions of the screen space.
.IP \[bu]
gapless grid: n clients are arranged into a square of ceil(sqrt(n))
length, where the top left is the latest client opened.
.P
Dialog windows are always managed floating, regardless of the layout
applied.
@@ -171,26 +157,10 @@ Set layout to floating.
.B Mod\-Shift\-m
Set layout to monocle.
.TP
.B Mod\-Shift\-u
Set layout to centred monocle.
.TP
.B Mod\-Shift\-o
Set layout to centred floating monocle.
.TP
.B Mod\-Shift\-s
Set layout to spiral fibonacci.
.TP
.B Mod\-Shift\-D
Set layout to dwindle fibonacci.
.TP
.B Mod\-Shift\-g
Set layout to gapless grid.
.TP
.B Mod\-Shift\-d
Set layout to deck layout.

11
dwm.c
View File

@@ -571,6 +571,7 @@ clientmessage(XEvent *e)
{
XClientMessageEvent *cme = &e->xclient;
Client *c = wintoclient(cme->window);
unsigned int i;
if (!c)
return;
@@ -585,8 +586,14 @@ clientmessage(XEvent *e)
setsticky(c, (cme->data.l[0] == 1 ||
(cme->data.l[0] == 2 && !c->issticky)));
} 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);
}
}
}

View File

@@ -0,0 +1,57 @@
From 286ca3bb1af08b452bf8140abcc23d4ef61baaa2 Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Tue, 7 Apr 2020 12:33:04 +0200
Subject: [PATCH] Activate a window in response to _NET_ACTIVE_WINDOW
By default, dwm response to client requests to _NET_ACTIVE_WINDOW client
messages by setting the urgency bit on the named window.
This patch activates the window instead.
Both behaviours are legitimate according to
https://specifications.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472702304
One should decide which of these one should perform based on the message
senders' untestable claims that it represents the end-user. Setting the
urgency bit is the conservative decision. This patch implements the more
trusting alternative.
It also allows dwm to work with `wmctrl -a` and other external window
management utilities
---
dwm.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/dwm.c b/dwm.c
index 4465af1..3919d47 100644
--- a/dwm.c
+++ b/dwm.c
@@ -514,6 +514,7 @@ clientmessage(XEvent *e)
{
XClientMessageEvent *cme = &e->xclient;
Client *c = wintoclient(cme->window);
+ unsigned int i;
if (!c)
return;
@@ -523,8 +524,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);
+ }
}
}
--
2.17.1