init fork
This commit is contained in:
parent
f09418bbb6
commit
6b9ad72848
75
config.def.h
75
config.def.h
@ -1,25 +1,30 @@
|
||||
/* See LICENSE file for copyright and license details. */
|
||||
|
||||
/* appearance */
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
static const unsigned int borderpx = 3; /* border pixel of windows */
|
||||
static const unsigned int gappx = 10; /* gaps between 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 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";
|
||||
static const char *fonts[] = { "FuraCode Nerd Font Mono:size=16" };
|
||||
static const char dmenufont[] = "FuraCode Nerd Font Mono:size=16";
|
||||
static const char col_black[] = "#1d2021";
|
||||
static const char col_gray[] = "#665c54";
|
||||
static const char col_lightgray[] = "#a89984";
|
||||
static const char col_orange[] = "#f7a583";
|
||||
static const char col_aqua[] = "#89b594";
|
||||
static const char col_blue[] = "#458588";
|
||||
static const char col_purple[] = "#d3869b";
|
||||
static const char col_white[] = "#ebdbb2";
|
||||
static const char *colors[][3] = {
|
||||
/* fg bg border */
|
||||
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
|
||||
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
||||
[SchemeNorm] = { col_lightgray, col_black, col_black },
|
||||
[SchemeSel] = { col_white, col_gray, col_aqua },
|
||||
};
|
||||
|
||||
/* tagging */
|
||||
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||
//static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||
static const char *tags[] = { "1 ", "2 ", "3 ", "4 ", "5 ", "6 ", "7 ", "8 ", "9 " };
|
||||
|
||||
static const Rule rules[] = {
|
||||
/* xprop(1):
|
||||
@ -27,8 +32,9 @@ static const Rule rules[] = {
|
||||
* WM_NAME(STRING) = title
|
||||
*/
|
||||
/* class instance title tags mask isfloating monitor */
|
||||
{ "Gimp", NULL, NULL, 0, 1, -1 },
|
||||
{ "Firefox", NULL, NULL, 1 << 8, 0, -1 },
|
||||
{ "Brave", NULL, NULL, 1 << 1, 0, -1 },
|
||||
{ "Transmission", NULL, NULL, 1 << 2, 0, -1 },
|
||||
{ "mpv", NULL, NULL, 1 << 3, 0, -1 },
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
@ -44,7 +50,7 @@ static const Layout layouts[] = {
|
||||
};
|
||||
|
||||
/* key definitions */
|
||||
#define MODKEY Mod1Mask
|
||||
#define MODKEY Mod4Mask /* SUPER */
|
||||
#define TAGKEYS(KEY,TAG) \
|
||||
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||
@ -56,43 +62,46 @@ 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, "-p", "run:", NULL };
|
||||
static const char *termcmd[] = { "st", NULL };
|
||||
|
||||
static Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
||||
//{ 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, XK_i, incnmaster, {.i = +1 } },
|
||||
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
||||
{ MODKEY, XK_o, incnmaster, {.i = +1 } },
|
||||
{ MODKEY, XK_i, incnmaster, {.i = -1 } },
|
||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||
{ MODKEY, XK_Return, zoom, {0} },
|
||||
{ MODKEY, XK_space, zoom, {0} },
|
||||
{ MODKEY, XK_Tab, view, {0} },
|
||||
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
||||
{ MODKEY, XK_q, killclient, {0} },
|
||||
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||
{ MODKEY, XK_space, setlayout, {0} },
|
||||
//{ 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_agrave, view, {.ui = ~0 } },
|
||||
{ MODKEY|ShiftMask, XK_a, 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 } },
|
||||
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, XK_less, setgaps, {.i = -5 } },
|
||||
{ MODKEY|ShiftMask, XK_less, setgaps, {.i = +5 } },
|
||||
{ MODKEY, XK_equal, setgaps, {.i = 10 } },
|
||||
TAGKEYS( XK_ampersand, 0)
|
||||
TAGKEYS( XK_eacute, 1)
|
||||
TAGKEYS( XK_quotedbl, 2)
|
||||
TAGKEYS( XK_apostrophe, 3)
|
||||
TAGKEYS( XK_parenleft, 4)
|
||||
TAGKEYS( XK_minus, 5)
|
||||
TAGKEYS( XK_egrave, 6)
|
||||
TAGKEYS( XK_underscore, 7)
|
||||
TAGKEYS( XK_ccedilla, 8)
|
||||
{ MODKEY|ShiftMask, XK_q, quit, {0} },
|
||||
};
|
||||
|
||||
|
112
dwm.1
112
dwm.1
@ -1,6 +1,6 @@
|
||||
.TH DWM 1 dwm\-VERSION
|
||||
.SH NAME
|
||||
dwm \- dynamic window manager
|
||||
dwm \- dynamic window manager (swy7ch' build)
|
||||
.SH SYNOPSIS
|
||||
.B dwm
|
||||
.RB [ \-v ]
|
||||
@ -20,16 +20,21 @@ layout applied.
|
||||
Windows are grouped by tags. Each window can be tagged with one or multiple
|
||||
tags. Selecting certain tags displays all windows with these tags.
|
||||
.P
|
||||
Each screen contains a small status bar which displays all available tags, the
|
||||
Each screen contains a small status bar which displays all used tags, the
|
||||
layout, the title of the focused window, and the text read from the root window
|
||||
name property, if the screen is focused. A floating window is indicated with an
|
||||
empty square and a maximised floating window is indicated with a filled square
|
||||
before the windows title. The selected tags are indicated with a different
|
||||
color. The tags of the focused window are indicated with a filled square in the
|
||||
top left corner. The tags which are applied to one or more windows are
|
||||
indicated with an empty square in the top left corner.
|
||||
color.
|
||||
.P
|
||||
dwm draws a small border around windows to indicate the focus state.
|
||||
dwm draws a small border around windows to indicate the focus state. Gaps are added around windows.
|
||||
.P
|
||||
.B !!! DISCLAIMER !!!
|
||||
My [swy7ch] keyboard being an AZERTY layout, numbers are not sent by the keys
|
||||
of the special characters row; instead, those special characters are sent:
|
||||
please check
|
||||
.B config[.def].h
|
||||
ro change the keybindings
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-v
|
||||
@ -49,108 +54,119 @@ label toggles between tiled and floating layout.
|
||||
.B Button3
|
||||
click on a tag label adds/removes all windows with that tag to/from the view.
|
||||
.TP
|
||||
.B Mod1\-Button1
|
||||
.B SUPER\-Button1
|
||||
click on a tag label applies that tag to the focused window.
|
||||
.TP
|
||||
.B Mod1\-Button3
|
||||
.B SUPER\-Button3
|
||||
click on a tag label adds/removes that tag to/from the focused window.
|
||||
.SS Keyboard commands
|
||||
.\".TP
|
||||
.\".B SUPER\-Shift\-Return
|
||||
.\"Start
|
||||
.\".BR st(1).
|
||||
.\".TP
|
||||
.\".B SUPER\-p
|
||||
.\"Spawn
|
||||
.\".BR dmenu(1)
|
||||
.\"for launching other programs.
|
||||
.TP
|
||||
.B Mod1\-Shift\-Return
|
||||
Start
|
||||
.BR st(1).
|
||||
.TP
|
||||
.B Mod1\-p
|
||||
Spawn
|
||||
.BR dmenu(1)
|
||||
for launching other programs.
|
||||
.TP
|
||||
.B Mod1\-,
|
||||
.B SUPER\-,
|
||||
Focus previous screen, if any.
|
||||
.TP
|
||||
.B Mod1\-.
|
||||
.B SUPER\-.
|
||||
Focus next screen, if any.
|
||||
.TP
|
||||
.B Mod1\-Shift\-,
|
||||
.B SUPER\-Shift\-,
|
||||
Send focused window to previous screen, if any.
|
||||
.TP
|
||||
.B Mod1\-Shift\-.
|
||||
.B SUPER\-Shift\-.
|
||||
Send focused window to next screen, if any.
|
||||
.TP
|
||||
.B Mod1\-b
|
||||
.B SUPER\-b
|
||||
Toggles bar on and off.
|
||||
.TP
|
||||
.B Mod1\-t
|
||||
.B SUPER\-t
|
||||
Sets tiled layout.
|
||||
.TP
|
||||
.B Mod1\-f
|
||||
.B SUPER\-f
|
||||
Sets floating layout.
|
||||
.TP
|
||||
.B Mod1\-m
|
||||
.B SUPER\-m
|
||||
Sets monocle layout.
|
||||
.\".TP
|
||||
.\".B SUPER\-space
|
||||
.\"Toggles between current and previous layout.
|
||||
.TP
|
||||
.B Mod1\-space
|
||||
Toggles between current and previous layout.
|
||||
.TP
|
||||
.B Mod1\-j
|
||||
.B SUPER\-j
|
||||
Focus next window.
|
||||
.TP
|
||||
.B Mod1\-k
|
||||
.B SUPER\-k
|
||||
Focus previous window.
|
||||
.TP
|
||||
.B Mod1\-i
|
||||
.B SUPER\-o
|
||||
Increase number of windows in master area.
|
||||
.TP
|
||||
.B Mod1\-d
|
||||
.B SUPER\-i
|
||||
Decrease number of windows in master area.
|
||||
.TP
|
||||
.B Mod1\-l
|
||||
.B SUPER\-l
|
||||
Increase master area size.
|
||||
.TP
|
||||
.B Mod1\-h
|
||||
.B SUPER\-h
|
||||
Decrease master area size.
|
||||
.TP
|
||||
.B Mod1\-Return
|
||||
.B SUPER\-space
|
||||
Zooms/cycles focused window to/from master area (tiled layouts only).
|
||||
.TP
|
||||
.B Mod1\-Shift\-c
|
||||
.B SUPER\-q
|
||||
Close focused window.
|
||||
.TP
|
||||
.B Mod1\-Shift\-space
|
||||
.B SUPER\-Shift\-space
|
||||
Toggle focused window between tiled and floating state.
|
||||
.TP
|
||||
.B Mod1\-Tab
|
||||
.B SUPER\-Tab
|
||||
Toggles to the previously selected tags.
|
||||
.TP
|
||||
.B Mod1\-Shift\-[1..n]
|
||||
.B SUPER\-Shift\-[1..n]
|
||||
Apply nth tag to focused window.
|
||||
.TP
|
||||
.B Mod1\-Shift\-0
|
||||
.B SUPER\-Shift\-0
|
||||
Apply all tags to focused window.
|
||||
.TP
|
||||
.B Mod1\-Control\-Shift\-[1..n]
|
||||
.B SUPER\-Control\-Shift\-[1..n]
|
||||
Add/remove nth tag to/from focused window.
|
||||
.TP
|
||||
.B Mod1\-[1..n]
|
||||
.B SUPER\-[1..n]
|
||||
View all windows with nth tag.
|
||||
.TP
|
||||
.B Mod1\-0
|
||||
.B SUPER\-0
|
||||
View all windows with any tag.
|
||||
.TP
|
||||
.B Mod1\-Control\-[1..n]
|
||||
.B SUPER\-Control\-[1..n]
|
||||
Add/remove all windows with nth tag to/from the view.
|
||||
.TP
|
||||
.B Mod1\-Shift\-q
|
||||
.B SUPER\-<
|
||||
Decrease the gaps around windows.
|
||||
.TP
|
||||
.B SUPER\->
|
||||
Increase the gaps around windows.
|
||||
.TP
|
||||
.B SUPER\-=
|
||||
Reset the gaps around windows to their default
|
||||
.B (10)
|
||||
value.
|
||||
.TP
|
||||
.B SUPER\-Shift\-q
|
||||
Quit dwm.
|
||||
.SS Mouse commands
|
||||
.TP
|
||||
.B Mod1\-Button1
|
||||
.B SUPER\-Button1
|
||||
Move focused window while dragging. Tiled windows will be toggled to the floating state.
|
||||
.TP
|
||||
.B Mod1\-Button2
|
||||
.B SUPER\-Button2
|
||||
Toggles focused window between floating and tiled state.
|
||||
.TP
|
||||
.B Mod1\-Button3
|
||||
.B SUPER\-Button3
|
||||
Resize focused window while dragging. Tiled windows will be toggled to the floating state.
|
||||
.SH CUSTOMIZATION
|
||||
dwm is customized by creating a custom config.h and (re)compiling the source
|
||||
|
54
dwm.c
54
dwm.c
@ -119,6 +119,7 @@ struct Monitor {
|
||||
int by; /* bar geometry */
|
||||
int mx, my, mw, mh; /* screen size */
|
||||
int wx, wy, ww, wh; /* window area */
|
||||
int gappx; /* gaps between windows */
|
||||
unsigned int seltags;
|
||||
unsigned int sellt;
|
||||
unsigned int tagset[2];
|
||||
@ -200,6 +201,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 setgaps(const Arg *arg);
|
||||
static void setlayout(const Arg *arg);
|
||||
static void setmfact(const Arg *arg);
|
||||
static void setup(void);
|
||||
@ -417,7 +419,7 @@ attachstack(Client *c)
|
||||
void
|
||||
buttonpress(XEvent *e)
|
||||
{
|
||||
unsigned int i, x, click;
|
||||
unsigned int i, x, click, occ = 0;
|
||||
Arg arg = {0};
|
||||
Client *c;
|
||||
Monitor *m;
|
||||
@ -432,9 +434,14 @@ buttonpress(XEvent *e)
|
||||
}
|
||||
if (ev->window == selmon->barwin) {
|
||||
i = x = 0;
|
||||
do
|
||||
for (c = m->clients; c; c = c->next)
|
||||
occ |= c->tags == 255 ? 0 : c->tags;
|
||||
do {
|
||||
/* do not reserve space for vacant tags */
|
||||
if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
|
||||
continue;
|
||||
x += TEXTW(tags[i]);
|
||||
while (ev->x >= x && ++i < LENGTH(tags));
|
||||
} while (ev->x >= x && ++i < LENGTH(tags));
|
||||
if (i < LENGTH(tags)) {
|
||||
click = ClkTagBar;
|
||||
arg.ui = 1 << i;
|
||||
@ -639,6 +646,7 @@ createmon(void)
|
||||
m->nmaster = nmaster;
|
||||
m->showbar = showbar;
|
||||
m->topbar = topbar;
|
||||
m->gappx = gappx;
|
||||
m->lt[0] = &layouts[0];
|
||||
m->lt[1] = &layouts[1 % LENGTH(layouts)];
|
||||
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
|
||||
@ -710,19 +718,19 @@ drawbar(Monitor *m)
|
||||
}
|
||||
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
occ |= c->tags;
|
||||
occ |= c->tags == 255 ? 0 : c->tags;
|
||||
if (c->isurgent)
|
||||
urg |= c->tags;
|
||||
}
|
||||
x = 0;
|
||||
for (i = 0; i < LENGTH(tags); i++) {
|
||||
/* do not draw vacant tags */
|
||||
if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
|
||||
continue;
|
||||
|
||||
w = TEXTW(tags[i]);
|
||||
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
|
||||
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
|
||||
if (occ & 1 << i)
|
||||
drw_rect(drw, x + boxs, boxs, boxw, boxw,
|
||||
m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
|
||||
urg & 1 << i);
|
||||
x += w;
|
||||
}
|
||||
w = blw = TEXTW(m->ltsymbol);
|
||||
@ -1498,6 +1506,16 @@ setfullscreen(Client *c, int fullscreen)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
setgaps(const Arg *arg)
|
||||
{
|
||||
if ((arg->i == 0) || (selmon->gappx + arg->i < 0))
|
||||
selmon->gappx = 0;
|
||||
else
|
||||
selmon->gappx += arg->i;
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
void
|
||||
setlayout(const Arg *arg)
|
||||
{
|
||||
@ -1684,18 +1702,18 @@ tile(Monitor *m)
|
||||
if (n > m->nmaster)
|
||||
mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||
else
|
||||
mw = m->ww;
|
||||
for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
mw = m->ww - m->gappx;
|
||||
for (i = 0, my = ty = m->gappx, 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), 0);
|
||||
if (my + HEIGHT(c) < m->wh)
|
||||
my += HEIGHT(c);
|
||||
h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx;
|
||||
resize(c, m->wx + m->gappx, m->wy + my, mw - (2*c->bw) - m->gappx, h - (2*c->bw), 0);
|
||||
if (my + HEIGHT(c) + m->gappx < m->wh)
|
||||
my += HEIGHT(c) + m->gappx;
|
||||
} else {
|
||||
h = (m->wh - ty) / (n - i);
|
||||
resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
|
||||
if (ty + HEIGHT(c) < m->wh)
|
||||
ty += HEIGHT(c);
|
||||
h = (m->wh - ty) / (n - i) - m->gappx;
|
||||
resize(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappx, h - (2*c->bw), 0);
|
||||
if (ty + HEIGHT(c) + m->gappx < m->wh)
|
||||
ty += HEIGHT(c) + m->gappx;
|
||||
}
|
||||
}
|
||||
|
||||
|
137
patches/dwm-fullgaps-20200504-3833e81.diff
Normal file
137
patches/dwm-fullgaps-20200504-3833e81.diff
Normal file
@ -0,0 +1,137 @@
|
||||
From 3833e813b101b84f380f7c10e33fe02a896f8c76 Mon Sep 17 00:00:00 2001
|
||||
From: swy7ch <swy7ch@protonmail.com>
|
||||
Date: Mon, 4 May 2020 03:53:40 +0200
|
||||
Subject: [PATCH] update dwm-fullgaps patch to be used with tile layout update
|
||||
|
||||
the recent tile layout changes in commit HEAD~1 (f09418b) broke the
|
||||
patch
|
||||
|
||||
this patch adapt the new `if` statements to take gaps into account
|
||||
|
||||
this patch also provides manpage entries for the keybindings
|
||||
---
|
||||
config.def.h | 4 ++++
|
||||
dwm.1 | 10 ++++++++++
|
||||
dwm.c | 33 +++++++++++++++++++++++----------
|
||||
3 files changed, 37 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 1c0b587..38d2f6c 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
/* appearance */
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
+static const unsigned int gappx = 5; /* gaps between 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 */
|
||||
@@ -84,6 +85,9 @@ 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_minus, setgaps, {.i = -1 } },
|
||||
+ { MODKEY, XK_equal, setgaps, {.i = +1 } },
|
||||
+ { MODKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } },
|
||||
TAGKEYS( XK_1, 0)
|
||||
TAGKEYS( XK_2, 1)
|
||||
TAGKEYS( XK_3, 2)
|
||||
diff --git a/dwm.1 b/dwm.1
|
||||
index 13b3729..445a697 100644
|
||||
--- a/dwm.1
|
||||
+++ b/dwm.1
|
||||
@@ -140,6 +140,16 @@ View all windows with any tag.
|
||||
.B Mod1\-Control\-[1..n]
|
||||
Add/remove all windows with nth tag to/from the view.
|
||||
.TP
|
||||
+.B Mod1\-<
|
||||
+Decrease the gaps around windows.
|
||||
+.TP
|
||||
+.B Mod1\->
|
||||
+Increase the gaps around windows.
|
||||
+.TP
|
||||
+.B Mod1\-=
|
||||
+Reset the gaps around windows to
|
||||
+.BR 0 .
|
||||
+.TP
|
||||
.B Mod1\-Shift\-q
|
||||
Quit dwm.
|
||||
.SS Mouse commands
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index 9fd0286..45a58f3 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -119,6 +119,7 @@ struct Monitor {
|
||||
int by; /* bar geometry */
|
||||
int mx, my, mw, mh; /* screen size */
|
||||
int wx, wy, ww, wh; /* window area */
|
||||
+ int gappx; /* gaps between windows */
|
||||
unsigned int seltags;
|
||||
unsigned int sellt;
|
||||
unsigned int tagset[2];
|
||||
@@ -200,6 +201,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 setgaps(const Arg *arg);
|
||||
static void setlayout(const Arg *arg);
|
||||
static void setmfact(const Arg *arg);
|
||||
static void setup(void);
|
||||
@@ -639,6 +641,7 @@ createmon(void)
|
||||
m->nmaster = nmaster;
|
||||
m->showbar = showbar;
|
||||
m->topbar = topbar;
|
||||
+ m->gappx = gappx;
|
||||
m->lt[0] = &layouts[0];
|
||||
m->lt[1] = &layouts[1 % LENGTH(layouts)];
|
||||
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
|
||||
@@ -1498,6 +1501,16 @@ setfullscreen(Client *c, int fullscreen)
|
||||
}
|
||||
}
|
||||
|
||||
+void
|
||||
+setgaps(const Arg *arg)
|
||||
+{
|
||||
+ if ((arg->i == 0) || (selmon->gappx + arg->i < 0))
|
||||
+ selmon->gappx = 0;
|
||||
+ else
|
||||
+ selmon->gappx += arg->i;
|
||||
+ arrange(selmon);
|
||||
+}
|
||||
+
|
||||
void
|
||||
setlayout(const Arg *arg)
|
||||
{
|
||||
@@ -1684,18 +1697,18 @@ tile(Monitor *m)
|
||||
if (n > m->nmaster)
|
||||
mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||
else
|
||||
- mw = m->ww;
|
||||
- for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
+ mw = m->ww - m->gappx;
|
||||
+ for (i = 0, my = ty = m->gappx, 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), 0);
|
||||
- if (my + HEIGHT(c) < m->wh)
|
||||
- my += HEIGHT(c);
|
||||
+ h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx;
|
||||
+ resize(c, m->wx + m->gappx, m->wy + my, mw - (2*c->bw) - m->gappx, h - (2*c->bw), 0);
|
||||
+ if (my + HEIGHT(c) + m->gappx < m->wh)
|
||||
+ my += HEIGHT(c) + m->gappx;
|
||||
} else {
|
||||
- h = (m->wh - ty) / (n - i);
|
||||
- resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
|
||||
- if (ty + HEIGHT(c) < m->wh)
|
||||
- ty += HEIGHT(c);
|
||||
+ h = (m->wh - ty) / (n - i) - m->gappx;
|
||||
+ resize(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappx, h - (2*c->bw), 0);
|
||||
+ if (ty + HEIGHT(c) + m->gappx < m->wh)
|
||||
+ ty += HEIGHT(c) + m->gappx;
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.26.2
|
||||
|
55
patches/dwm-hide_vacant_tags-6.2.diff
Normal file
55
patches/dwm-hide_vacant_tags-6.2.diff
Normal file
@ -0,0 +1,55 @@
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index 4465af1..c4aa3de 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -416,7 +416,7 @@ attachstack(Client *c)
|
||||
void
|
||||
buttonpress(XEvent *e)
|
||||
{
|
||||
- unsigned int i, x, click;
|
||||
+ unsigned int i, x, click, occ = 0;
|
||||
Arg arg = {0};
|
||||
Client *c;
|
||||
Monitor *m;
|
||||
@@ -431,9 +431,14 @@ buttonpress(XEvent *e)
|
||||
}
|
||||
if (ev->window == selmon->barwin) {
|
||||
i = x = 0;
|
||||
- do
|
||||
+ for (c = m->clients; c; c = c->next)
|
||||
+ occ |= c->tags == 255 ? 0 : c->tags;
|
||||
+ do {
|
||||
+ /* do not reserve space for vacant tags */
|
||||
+ if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
|
||||
+ continue;
|
||||
x += TEXTW(tags[i]);
|
||||
- while (ev->x >= x && ++i < LENGTH(tags));
|
||||
+ } while (ev->x >= x && ++i < LENGTH(tags));
|
||||
if (i < LENGTH(tags)) {
|
||||
click = ClkTagBar;
|
||||
arg.ui = 1 << i;
|
||||
@@ -709,19 +714,19 @@ drawbar(Monitor *m)
|
||||
}
|
||||
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
- occ |= c->tags;
|
||||
+ occ |= c->tags == 255 ? 0 : c->tags;
|
||||
if (c->isurgent)
|
||||
urg |= c->tags;
|
||||
}
|
||||
x = 0;
|
||||
for (i = 0; i < LENGTH(tags); i++) {
|
||||
+ /* do not draw vacant tags */
|
||||
+ if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
|
||||
+ continue;
|
||||
+
|
||||
w = TEXTW(tags[i]);
|
||||
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
|
||||
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
|
||||
- if (occ & 1 << i)
|
||||
- drw_rect(drw, x + boxs, boxs, boxw, boxw,
|
||||
- m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
|
||||
- urg & 1 << i);
|
||||
x += w;
|
||||
}
|
||||
w = blw = TEXTW(m->ltsymbol);
|
Loading…
x
Reference in New Issue
Block a user