summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorProsperousPotato <ProsperousPotato@users.noreply.github.com>2025-06-17 17:47:59 +0100
committerProsperousPotato <ProsperousPotato@users.noreply.github.com>2025-06-17 17:47:59 +0100
commitfbc7e6ddb8617683dff6e9cba96ae4b8d33d18ef (patch)
tree68a7a95a9294aeb7d9cd539a56c8a58386e58606
parentbb1b2fe60ac3cc6e8a494f6b57c806c0f24d06ea (diff)
remove most of bar, remove patches
-rw-r--r--config.h77
-rw-r--r--drw.c250
-rw-r--r--drw.h13
-rw-r--r--dwm.13
-rw-r--r--dwm.c456
-rw-r--r--dwm.pngbin373 -> 0 bytes
6 files changed, 68 insertions, 731 deletions
diff --git a/config.h b/config.h
index f9154d6..f0ea0ef 100644
--- a/config.h
+++ b/config.h
@@ -2,33 +2,22 @@
/* Constants */
#define TERMINAL "st"
-#define BROWSER "srch"
+#define BROWSER "icecat"
/* appearance */
static const unsigned int borderpx = 3; /* border pixel of windows */
static const unsigned int snap = 16; /* snap pixel */
-static const unsigned int minwsz = 20; /* Minimum height of a client for smfact */
-static const int swallowfloating = 1;
-static const int showbar = 0; /* 0 means no bar */
-static const int topbar = 1; /* 0 means bottom bar */
-static const char *fonts[] = { "Bm437 IBM VGA 8x16:pixelsize=16, fontawesome:size=16" };
-static const char dmenufont[] = "Bm437 IBM VGA 8x16:pixelsize=16, fontawesome:size=16";
+static const int swallowfloating = 1; /* 1 means swallow floating windows by default */
+static const char dmenufont[] = "Terminess Nerd Font Mono:pixelsize=14";
static const char col_gray1[] = "#000000";
static const char col_gray2[] = "#000000";
static const char col_gray3[] = "#bbbbbb";
static const char col_gray4[] = "#eeeeee";
-// static const char col_cyan[] = "#FF8C00"; /* orange */
-// static const char col_cyan[] = "#2f9b85"; /* manjaro green */
-static const char col_cyan[] = "#54487A"; /* gentoo purple */
+static const char col_cyan[] = "#bbbbbb";
static const char *colors[][3] = {
/* fg bg border */
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
- [SchemeSel] = { col_gray4, col_cyan, col_cyan },
- [SchemeStatus] = { col_gray3, col_gray1, "#000000" }, // Statusbar right {text,background,not used but cannot be empty}
- [SchemeTagsSel] = { col_gray3, col_cyan, "#000000" }, // Tagbar left selected {text,background,not used but cannot be empty}
- [SchemeTagsNorm] = { col_cyan, col_gray1, "#000000" }, // Tagbar left unselected {text,background,not used but cannot be empty}
- [SchemeInfoSel] = { col_gray3, col_cyan, "#000000" }, // infobar middle selected {text,background,not used but cannot be empty}
- [SchemeInfoNorm] = { col_cyan, col_gray1, "#000000" }, // infobar middle unselected {text,background,not used but cannot be empty}
+ [SchemeSel] = { col_gray1, col_cyan, col_cyan },
};
/* tagging */
@@ -40,7 +29,6 @@ static const Rule rules[] = {
* WM_NAME(STRING) = title
*/
/* class instance title tags mask isfloating isterminal noswallow monitor */
- { "Thunar", "thunar", NULL, 0, 1, 0, 0, -1 },
{ "steam", "steamwebhelper", NULL, 0, 1, 0, 0, -1 },
{ "Steam", "Steam", NULL, 0, 1, 0, 0, -1 },
{ "steam", "steamwebhelper", "Steam", 0, 0, 0, 0, -1 },
@@ -58,17 +46,16 @@ static const Rule rules[] = {
};
/* layout(s) */
-static const float mfact = 0.50; /* factor of master area size [0.05..0.95] */
-static const float smfact = 0.00; /* factor of tiled clients [0.00..0.95] */
+static const float mfact = 0.5; /* 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 resizehints = 0; /* 1 means respect size hints in tiled resizals */
static const int lockfullscreen = 0; /* 1 will force focus on the fullscreen window */
static const Layout layouts[] = {
/* symbol arrange function */
{ "[]=", tile }, /* first entry is default */
+ { "[M]", monocle },
{ "><>", NULL }, /* no layout function means floating behavior */
- { "[M]", monocle },
};
/* key definitions */
@@ -84,8 +71,8 @@ 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 *termcmd[] = { TERMINAL, NULL };
+static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray1, NULL };
+static const char *termcmd[] = { "st", NULL };
#include <X11/XF86keysym.h>
static const Key keys[] = {
@@ -95,27 +82,18 @@ static const Key keys[] = {
{ MODKEY|ShiftMask, XK_space, spawn, SHCMD(TERMINAL" -e su") },
{ Mod1Mask, XK_space, spawn, SHCMD(TERMINAL" -c stfloat") },
{ Mod1Mask|ShiftMask, XK_space, spawn, SHCMD(TERMINAL" -c stfloat -e su") },
- { MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
- { MODKEY, XK_u, incnmaster, {.i = +1 } },
- { MODKEY, XK_i, incnmaster, {.i = -1 } },
- { MODKEY|ControlMask, XK_h, setmfact, {.f = -0.05} },
- { MODKEY|ControlMask, XK_l, setmfact, {.f = +0.05} },
- { MODKEY|ControlMask, XK_k, setsmfact, {.f = +0.05} },
- { MODKEY|ControlMask, XK_j, setsmfact, {.f = -0.05} },
- { MODKEY, XK_h, viewprev, {0} },
- { MODKEY, XK_l, viewnext, {0} },
- { MODKEY|ShiftMask, XK_h, tagtoprev, {0} },
- { MODKEY|ShiftMask, XK_l, tagtonext, {0} },
- { MODKEY, XK_Return, zoom, {0} },
+ { MODKEY, XK_i, incnmaster, {.i = +1 } },
+ { MODKEY, XK_u, incnmaster, {.i = -1 } },
+ { MODKEY, XK_h, setmfact, {.f = -0.01} },
+ { MODKEY, XK_l, setmfact, {.f = +0.01} },
{ Mod1Mask, XK_Tab, zoom, {0} },
{ MODKEY, XK_Tab, view, {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_Return, setlayout, {0} },
{ MODKEY|ShiftMask, XK_f, togglefloating, {0} },
{ MODKEY, XK_f, togglefullscr, {0} },
{ MODKEY, XK_grave, view, {.ui = ~0 } },
@@ -124,41 +102,35 @@ static const Key keys[] = {
{ 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)
+ { MODKEY|ShiftMask, XK_End, quit, {0} },
+ { MODKEY|ShiftMask, XK_r, quit, {1} },
- { MODKEY|ShiftMask, XK_End, quit, {0} },
- { MODKEY|ShiftMask, XK_r, quit, {1} },
{ MODKEY, XK_e, spawn, SHCMD(TERMINAL" -e mc --nosubshell") },
- { MODKEY|ShiftMask, XK_e, spawn, SHCMD(TERMINAL" -c stfloat -e su -c 'mc --nosubshell'") },
+ { Mod1Mask, XK_e, spawn, SHCMD(TERMINAL" -c stfloat -e mc --nosubshell") },
{ MODKEY|ShiftMask, XK_m, spawn, SHCMD(TERMINAL" -e neomutt") },
{ MODKEY, XK_n, spawn, SHCMD(TERMINAL" -e newsboat") },
- { MODKEY, XK_Escape, spawn, SHCMD(TERMINAL" -e gotop") },
- { Mod1Mask, XK_Escape, spawn, SHCMD(TERMINAL" -c stfloat -e gotop") },
+ { MODKEY, XK_Escape, spawn, SHCMD(TERMINAL" -e htop") },
+ { Mod1Mask, XK_Escape, spawn, SHCMD(TERMINAL" -c stfloat -e htop") },
+ { Mod1Mask, XK_n, spawn, SHCMD(TERMINAL" -c stfloat -e nvtop") },
{ MODKEY, XK_x, spawn, SHCMD("xkill") },
{ MODKEY, XK_s, spawn, SHCMD("steam") },
{ MODKEY|ShiftMask, XK_s, spawn, SHCMD("pkill -9 steam") },
- { Mod1Mask|ControlMask, XK_Delete, spawn, SHCMD("slock") },
{ MODKEY, XK_w, spawn, SHCMD(BROWSER) },
{ 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("amixer sset Master 5%+") },
{ 0, XF86XK_AudioLowerVolume, spawn, SHCMD("amixer sset Master 5%-") },
- { 0, XF86XK_AudioMute, spawn, SHCMD("amixer sset Capture Toggle") },
+ { 0, XF86XK_AudioMute, spawn, SHCMD("amixer sset Master toggle") },
{ 0, XF86XK_MonBrightnessUp, spawn, SHCMD("xbacklight -inc 10") },
{ 0, XF86XK_MonBrightnessDown, spawn, SHCMD("xbacklight -dec 10") },
{ MODKEY, XK_Print, spawn, SHCMD("maimpick") },
- { MODKEY, XK_Down, moveresize, {.v = "0x 25y 0w 0h" } },
- { MODKEY, XK_Up, moveresize, {.v = "0x -25y 0w 0h" } },
- { MODKEY, XK_Right, moveresize, {.v = "25x 0y 0w 0h" } },
- { MODKEY, XK_Left, moveresize, {.v = "-25x 0y 0w 0h" } },
- { MODKEY|ShiftMask, XK_Down, moveresize, {.v = "0x 0y 0w 25h" } },
- { MODKEY|ShiftMask, XK_Up, moveresize, {.v = "0x 0y 0w -25h" } },
- { MODKEY|ShiftMask, XK_Right, moveresize, {.v = "0x 0y 25w 0h" } },
- { MODKEY|ShiftMask, XK_Left, moveresize, {.v = "0x 0y -25w 0h" } },
+ { ControlMask, XK_F1, spawn, SHCMD("amixer sset Master toggle") },
+ { ControlMask, XK_F2, spawn, SHCMD("amixer sset Master 5%-") },
+ { ControlMask, XK_F3, spawn, SHCMD("amixer sset Master 5%+") },
};
/* button definitions */
@@ -169,3 +141,4 @@ static const Button buttons[] = {
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
};
+
diff --git a/drw.c b/drw.c
index 9aa5f24..58a2760 100644
--- a/drw.c
+++ b/drw.c
@@ -10,42 +10,6 @@
#define UTF_INVALID 0xFFFD
-static int
-utf8decode(const char *s_in, long *u, int *err)
-{
- static const unsigned char lens[] = {
- /* 0XXXX */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- /* 10XXX */ 0, 0, 0, 0, 0, 0, 0, 0, /* invalid */
- /* 110XX */ 2, 2, 2, 2,
- /* 1110X */ 3, 3,
- /* 11110 */ 4,
- /* 11111 */ 0, /* invalid */
- };
- static const unsigned char leading_mask[] = { 0x7F, 0x1F, 0x0F, 0x07 };
- static const unsigned int overlong[] = { 0x0, 0x80, 0x0800, 0x10000 };
-
- const unsigned char *s = (const unsigned char *)s_in;
- int len = lens[*s >> 3];
- *u = UTF_INVALID;
- *err = 1;
- if (len == 0)
- return 1;
-
- long cp = s[0] & leading_mask[len - 1];
- for (int i = 1; i < len; ++i) {
- if (s[i] == '\0' || (s[i] & 0xC0) != 0x80)
- return i;
- cp = (cp << 6) | (s[i] & 0x3F);
- }
- /* out of range, surrogate, overlong encoding */
- if (cp > 0x10FFFF || (cp >> 11) == 0x1B || cp < overlong[len - 1])
- return len;
-
- *err = 0;
- *u = cp;
- return len;
-}
-
Drw *
drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h)
{
@@ -198,220 +162,6 @@ drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
}
void
-drw_setfontset(Drw *drw, Fnt *set)
-{
- if (drw)
- drw->fonts = set;
-}
-
-void
-drw_setscheme(Drw *drw, Clr *scm)
-{
- if (drw)
- drw->scheme = scm;
-}
-
-void
-drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert)
-{
- if (!drw || !drw->scheme)
- return;
- XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme[ColBg].pixel : drw->scheme[ColFg].pixel);
- if (filled)
- XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
- else
- XDrawRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w - 1, h - 1);
-}
-
-int
-drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert)
-{
- int ty, ellipsis_x = 0;
- unsigned int tmpw, ew, ellipsis_w = 0, ellipsis_len, hash, h0, h1;
- XftDraw *d = NULL;
- Fnt *usedfont, *curfont, *nextfont;
- int utf8strlen, utf8charlen, utf8err, render = x || y || w || h;
- long utf8codepoint = 0;
- const char *utf8str;
- FcCharSet *fccharset;
- FcPattern *fcpattern;
- FcPattern *match;
- XftResult result;
- int charexists = 0, overflow = 0;
- /* keep track of a couple codepoints for which we have no match. */
- static unsigned int nomatches[128], ellipsis_width, invalid_width;
- static const char invalid[] = "�";
-
- if (!drw || (render && (!drw->scheme || !w)) || !text || !drw->fonts)
- return 0;
-
- if (!render) {
- w = invert ? invert : ~invert;
- } else {
- XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
- XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
- if (w < lpad)
- return x + w;
- d = XftDrawCreate(drw->dpy, drw->drawable,
- DefaultVisual(drw->dpy, drw->screen),
- DefaultColormap(drw->dpy, drw->screen));
- x += lpad;
- w -= lpad;
- }
-
- usedfont = drw->fonts;
- if (!ellipsis_width && render)
- ellipsis_width = drw_fontset_getwidth(drw, "...");
- if (!invalid_width && render)
- invalid_width = drw_fontset_getwidth(drw, invalid);
- while (1) {
- ew = ellipsis_len = utf8err = utf8charlen = utf8strlen = 0;
- utf8str = text;
- nextfont = NULL;
- while (*text) {
- utf8charlen = utf8decode(text, &utf8codepoint, &utf8err);
- for (curfont = drw->fonts; curfont; curfont = curfont->next) {
- charexists = charexists || XftCharExists(drw->dpy, curfont->xfont, utf8codepoint);
- if (charexists) {
- drw_font_getexts(curfont, text, utf8charlen, &tmpw, NULL);
- if (ew + ellipsis_width <= w) {
- /* keep track where the ellipsis still fits */
- ellipsis_x = x + ew;
- ellipsis_w = w - ew;
- ellipsis_len = utf8strlen;
- }
-
- if (ew + tmpw > w) {
- overflow = 1;
- /* called from drw_fontset_getwidth_clamp():
- * it wants the width AFTER the overflow
- */
- if (!render)
- x += tmpw;
- else
- utf8strlen = ellipsis_len;
- } else if (curfont == usedfont) {
- text += utf8charlen;
- utf8strlen += utf8err ? 0 : utf8charlen;
- ew += utf8err ? 0 : tmpw;
- } else {
- nextfont = curfont;
- }
- break;
- }
- }
-
- if (overflow || !charexists || nextfont || utf8err)
- break;
- else
- charexists = 0;
- }
-
- if (utf8strlen) {
- if (render) {
- ty = y + (h - usedfont->h) / 2 + usedfont->xfont->ascent;
- XftDrawStringUtf8(d, &drw->scheme[invert ? ColBg : ColFg],
- usedfont->xfont, x, ty, (XftChar8 *)utf8str, utf8strlen);
- }
- x += ew;
- w -= ew;
- }
- if (utf8err && (!render || invalid_width < w)) {
- if (render)
- drw_text(drw, x, y, w, h, 0, invalid, invert);
- x += invalid_width;
- w -= invalid_width;
- }
- if (render && overflow)
- drw_text(drw, ellipsis_x, y, ellipsis_w, h, 0, "...", invert);
-
- if (!*text || overflow) {
- break;
- } else if (nextfont) {
- charexists = 0;
- usedfont = nextfont;
- } else {
- /* Regardless of whether or not a fallback font is found, the
- * character must be drawn. */
- charexists = 1;
-
- hash = (unsigned int)utf8codepoint;
- hash = ((hash >> 16) ^ hash) * 0x21F0AAAD;
- hash = ((hash >> 15) ^ hash) * 0xD35A2D97;
- h0 = ((hash >> 15) ^ hash) % LENGTH(nomatches);
- h1 = (hash >> 17) % LENGTH(nomatches);
- /* avoid expensive XftFontMatch call when we know we won't find a match */
- if (nomatches[h0] == utf8codepoint || nomatches[h1] == utf8codepoint)
- goto no_match;
-
- fccharset = FcCharSetCreate();
- FcCharSetAddChar(fccharset, utf8codepoint);
-
- if (!drw->fonts->pattern) {
- /* Refer to the comment in xfont_create for more information. */
- die("the first font in the cache must be loaded from a font string.");
- }
-
- fcpattern = FcPatternDuplicate(drw->fonts->pattern);
- FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset);
- FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue);
-
- FcConfigSubstitute(NULL, fcpattern, FcMatchPattern);
- FcDefaultSubstitute(fcpattern);
- match = XftFontMatch(drw->dpy, drw->screen, fcpattern, &result);
-
- FcCharSetDestroy(fccharset);
- FcPatternDestroy(fcpattern);
-
- if (match) {
- usedfont = xfont_create(drw, NULL, match);
- if (usedfont && XftCharExists(drw->dpy, usedfont->xfont, utf8codepoint)) {
- for (curfont = drw->fonts; curfont->next; curfont = curfont->next)
- ; /* NOP */
- curfont->next = usedfont;
- } else {
- xfont_free(usedfont);
- nomatches[nomatches[h0] ? h1 : h0] = utf8codepoint;
-no_match:
- usedfont = drw->fonts;
- }
- }
- }
- }
- if (d)
- XftDrawDestroy(d);
-
- return x + (render ? w : 0);
-}
-
-void
-drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h)
-{
- if (!drw)
- return;
-
- XCopyArea(drw->dpy, drw->drawable, win, drw->gc, x, y, w, h, x, y);
- XSync(drw->dpy, False);
-}
-
-unsigned int
-drw_fontset_getwidth(Drw *drw, const char *text)
-{
- if (!drw || !drw->fonts || !text)
- return 0;
- return drw_text(drw, 0, 0, 0, 0, 0, text, 0);
-}
-
-unsigned int
-drw_fontset_getwidth_clamp(Drw *drw, const char *text, unsigned int n)
-{
- unsigned int tmp = 0;
- if (drw && drw->fonts && text && n)
- tmp = drw_text(drw, 0, 0, 0, 0, 0, text, n);
- return MIN(n, tmp);
-}
-
-void
drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h)
{
XGlyphInfo ext;
diff --git a/drw.h b/drw.h
index 6471431..7719776 100644
--- a/drw.h
+++ b/drw.h
@@ -34,8 +34,6 @@ void drw_free(Drw *drw);
/* Fnt abstraction */
Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount);
void drw_fontset_free(Fnt* set);
-unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
-unsigned int drw_fontset_getwidth_clamp(Drw *drw, const char *text, unsigned int n);
void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
/* Colorscheme abstraction */
@@ -45,14 +43,3 @@ Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount);
/* Cursor abstraction */
Cur *drw_cur_create(Drw *drw, int shape);
void drw_cur_free(Drw *drw, Cur *cursor);
-
-/* Drawing context manipulation */
-void drw_setfontset(Drw *drw, Fnt *set);
-void drw_setscheme(Drw *drw, Clr *scm);
-
-/* Drawing functions */
-void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert);
-int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert);
-
-/* Map functions */
-void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);
diff --git a/dwm.1 b/dwm.1
index 7b6cadb..837d02a 100644
--- a/dwm.1
+++ b/dwm.1
@@ -116,6 +116,9 @@ Zooms/cycles focused window to/from master area (tiled layouts only).
.B Mod1\-Shift\-c
Close focused window.
.TP
+.B Mod1\-Shift\-f
+Toggle fullscreen for focused window.
+.TP
.B Mod1\-Shift\-space
Toggle focused window between tiled and floating state.
.TP
diff --git a/dwm.c b/dwm.c
index 266104c..7696552 100644
--- a/dwm.c
+++ b/dwm.c
@@ -60,23 +60,20 @@
#define WIDTH(X) ((X)->w + 2 * (X)->bw)
#define HEIGHT(X) ((X)->h + 2 * (X)->bw)
#define TAGMASK ((1 << LENGTH(tags)) - 1)
-#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
/* enums */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
-enum { SchemeNorm, SchemeSel, SchemeStatus, SchemeTagsSel, SchemeTagsNorm, SchemeInfoSel, SchemeInfoNorm }; /* color schemes */
+enum { SchemeNorm, SchemeSel }; /* color schemes */
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
-enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
- ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
+enum { ClkTagBar, ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
typedef union {
int i;
unsigned int ui;
float f;
- float sf;
const void *v;
} Arg;
@@ -99,7 +96,6 @@ struct Client {
int bw, oldbw;
unsigned int tags;
int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, isterminal, noswallow;
- int issteam;
pid_t pid;
Client *next;
Client *snext;
@@ -123,7 +119,6 @@ typedef struct {
struct Monitor {
char ltsymbol[16];
float mfact;
- float smfact;
int nmaster;
int num;
int by; /* bar geometry */
@@ -132,8 +127,6 @@ struct Monitor {
unsigned int seltags;
unsigned int sellt;
unsigned int tagset[2];
- int showbar;
- int topbar;
Client *clients;
Client *sel;
Client *stack;
@@ -173,10 +166,7 @@ static void destroynotify(XEvent *e);
static void detach(Client *c);
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);
static void focusmon(const Arg *arg);
@@ -195,14 +185,7 @@ static void mappingnotify(XEvent *e);
static void maprequest(XEvent *e);
static void monocle(Monitor *m);
static void motionnotify(XEvent *e);
-static void moveresize(const Arg *arg);
static void movemouse(const Arg *arg);
-static unsigned int nexttag(void);
-static unsigned int prevtag(void);
-static void tagtonext(const Arg *arg);
-static void tagtoprev(const Arg *arg);
-static void viewnext(const Arg *arg);
-static void viewprev(const Arg *arg);
static Client *nexttiled(Client *c);
static void pop(Client *c);
static void propertynotify(XEvent *e);
@@ -221,7 +204,6 @@ 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 setsmfact(const Arg *arg);
static void setup(void);
static void seturgent(Client *c, int urg);
static void showhide(Client *c);
@@ -231,7 +213,6 @@ static void spawn(const Arg *arg);
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
static void tile(Monitor *m);
-static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
static void togglefullscr(const Arg *arg);
static void toggletag(const Arg *arg);
@@ -239,13 +220,10 @@ static void toggleview(const Arg *arg);
static void unfocus(Client *c, int setfocus);
static void unmanage(Client *c, int destroyed);
static void unmapnotify(XEvent *e);
-static void updatebarpos(Monitor *m);
-static void updatebars(void);
static void updateclientlist(void);
static int updategeom(void);
static void updatenumlockmask(void);
static void updatesizehints(Client *c);
-static void updatestatus(void);
static void updatetitle(Client *c);
static void updatewindowtype(Client *c);
static void updatewmhints(Client *c);
@@ -265,11 +243,9 @@ static pid_t winpid(Window w);
/* variables */
static const char broken[] = "broken";
-static char stext[256];
static int screen;
static int sw, sh; /* X display screen geometry width, height */
static int bh; /* bar height */
-static int lrpad; /* sum of left and right padding for text */
static int (*xerrorxlib)(Display *, XErrorEvent *);
static unsigned int numlockmask = 0;
static void (*handler[LASTEvent]) (XEvent *) = {
@@ -279,7 +255,6 @@ static void (*handler[LASTEvent]) (XEvent *) = {
[ConfigureNotify] = configurenotify,
[DestroyNotify] = destroynotify,
[EnterNotify] = enternotify,
- [Expose] = expose,
[FocusIn] = focusin,
[KeyPress] = keypress,
[MappingNotify] = mappingnotify,
@@ -291,7 +266,6 @@ static void (*handler[LASTEvent]) (XEvent *) = {
static Atom wmatom[WMLast], netatom[NetLast];
static int restart = 0;
static int running = 1;
-static int showtags = 0;
static Cur *cursor[CurLast];
static Clr **scheme;
static Display *dpy;
@@ -324,9 +298,6 @@ applyrules(Client *c)
class = ch.res_class ? ch.res_class : broken;
instance = ch.res_name ? ch.res_name : broken;
- if (strstr(class, "Steam") || strstr(class, "steam_app_"))
- c->issteam = 1;
-
for (i = 0; i < LENGTH(rules); i++) {
r = &rules[i];
if ((!r->title || strstr(c->name, r->title))
@@ -377,10 +348,6 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact)
if (*y + *h + 2 * c->bw <= m->wy)
*y = m->wy;
}
- if (*h < bh)
- *h = bh;
- if (*w < bh)
- *w = bh;
if (resizehints || c->isfloating || !c->mon->lt[c->mon->sellt]->arrange) {
if (!c->hintsvalid)
updatesizehints(c);
@@ -503,7 +470,7 @@ unswallow(Client *c)
void
buttonpress(XEvent *e)
{
- unsigned int i, x, click;
+ unsigned int i, click;
Arg arg = {0};
Client *c;
Monitor *m;
@@ -517,19 +484,6 @@ buttonpress(XEvent *e)
focus(NULL);
}
if (ev->window == selmon->barwin) {
- i = x = 0;
- do
- x += TEXTW(tags[i]);
- while (ev->x >= x && ++i < LENGTH(tags));
- if (i < LENGTH(tags)) {
- click = ClkTagBar;
- arg.ui = 1 << i;
- } else if (ev->x < x + TEXTW(selmon->ltsymbol))
- click = ClkLtSymbol;
- else if (ev->x > selmon->ww - (int)TEXTW(stext))
- click = ClkStatusText;
- else
- click = ClkWinTitle;
} else if ((c = wintoclient(ev->window))) {
focus(c);
restack(selmon);
@@ -650,7 +604,6 @@ configurenotify(XEvent *e)
sh = ev->height;
if (updategeom() || dirty) {
drw_resize(drw, sw, bh);
- updatebars();
for (m = mons; m; m = m->next) {
for (c = m->clients; c; c = c->next)
if (c->isfullscreen)
@@ -676,15 +629,13 @@ configurerequest(XEvent *e)
c->bw = ev->border_width;
else if (c->isfloating || !selmon->lt[selmon->sellt]->arrange) {
m = c->mon;
- if (!c->issteam) {
- if (ev->value_mask & CWX) {
- c->oldx = c->x;
- c->x = m->mx + ev->x;
- }
- if (ev->value_mask & CWY) {
- c->oldy = c->y;
- c->y = m->my + ev->y;
- }
+ if (ev->value_mask & CWX) {
+ c->oldx = c->x;
+ c->x = m->mx + ev->x;
+ }
+ if (ev->value_mask & CWY) {
+ c->oldy = c->y;
+ c->y = m->my + ev->y;
}
if (ev->value_mask & CWWidth) {
c->oldw = c->w;
@@ -725,10 +676,7 @@ createmon(void)
m = ecalloc(1, sizeof(Monitor));
m->tagset[0] = m->tagset[1] = 1;
m->mfact = mfact;
- m->smfact = smfact;
m->nmaster = nmaster;
- m->showbar = showbar;
- m->topbar = topbar;
m->lt[0] = &layouts[0];
m->lt[1] = &layouts[1 % LENGTH(layouts)];
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
@@ -787,92 +735,6 @@ dirtomon(int dir)
}
void
-drawbar(Monitor *m)
-{
- int x, w, tw = 0, mw, ew = 0;
- int boxs = drw->fonts->h / 9;
- int boxw = drw->fonts->h / 6 + 2;
- unsigned int i, occ = 0, urg = 0, n = 0;
- Client *c;
-
- if (!m->showbar)
- return;
-
- /* draw status first so it can be overdrawn by tags later */
- if (m == selmon) { /* status is only drawn on selected monitor */
- drw_setscheme(drw, scheme[SchemeStatus]);
- tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
- drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
- }
-
- for (c = m->clients; c; c = c->next) {
- if (ISVISIBLE(c))
- n++;
- occ |= c->tags == TAGMASK ? 0 : c->tags;
- if (c->isurgent)
- urg |= c->tags;
- }
-
- x = 0;
- if (showtags == 1) {
- for (i = 0; i < LENGTH(tags); i++) {
- 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 ? SchemeTagsSel : SchemeTagsNorm]);
- drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
- x += w;
- }
- }
-
- if ((w = m->ww - tw - x) > bh) {
- if (n > 0) {
- tw = TEXTW(m->sel->name) + lrpad;
- mw = (tw >= w || n == 1) ? 0 : (w - tw) / (n - 1);
-
- i = 0;
- for (c = m->clients; c; c = c->next) {
- if (!ISVISIBLE(c) || c == m->sel)
- continue;
- tw = TEXTW(c->name);
- if(tw < mw)
- ew += (mw - tw);
- else
- i++;
- }
- if (i > 0)
- mw += ew / i;
-
- for (c = m->clients; c; c = c->next) {
- if (!ISVISIBLE(c))
- continue;
- tw = MIN(m->sel == c ? w : mw, TEXTW(c->name));
-
- drw_setscheme(drw, scheme[m == selmon && m->sel == c ? SchemeInfoSel : SchemeInfoNorm]);
- if (tw > lrpad / 2)
- drw_text(drw, x, 0, tw, bh, lrpad / 2, c->name, 0);
- if (c->isfloating)
- drw_rect(drw, x + boxs, boxs, boxw, boxw, c->isfixed, 0);
- x += tw;
- w -= tw;
- }
- }
- drw_setscheme(drw, scheme[SchemeNorm]);
- drw_rect(drw, x, 0, w, bh, 1, 1);
- }
- drw_map(drw, m->barwin, 0, 0, m->ww, bh);
-}
-
-void
-drawbars(void)
-{
- Monitor *m;
-
- for (m = mons; m; m = m->next)
- drawbar(m);
-}
-
-void
enternotify(XEvent *e)
{
Client *c;
@@ -892,16 +754,6 @@ enternotify(XEvent *e)
}
void
-expose(XEvent *e)
-{
- Monitor *m;
- XExposeEvent *ev = &e->xexpose;
-
- if (ev->count == 0 && (m = wintomon(ev->window)))
- drawbar(m);
-}
-
-void
focus(Client *c)
{
if (!c || !ISVISIBLE(c))
@@ -923,7 +775,6 @@ focus(Client *c)
XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
}
selmon->sel = c;
- drawbars();
}
/* there are some broken focus acquiring clients needing extra handling */
@@ -948,6 +799,8 @@ focusmon(const Arg *arg)
unfocus(selmon->sel, 0);
selmon = m;
focus(NULL);
+ if (selmon->sel)
+ XWarpPointer(dpy, None, selmon->sel->win, 0, 0, 0, 0, selmon->sel->w/2, selmon->sel->h/2);
}
void
@@ -955,8 +808,6 @@ focusstack(const Arg *arg)
{
Client *c = NULL, *i;
- showtags = 0;
-
if (!selmon->sel || (selmon->sel->isfullscreen && lockfullscreen))
return;
if (arg->i > 0) {
@@ -1188,8 +1039,8 @@ manage(Window w, XWindowAttributes *wa)
updatewindowtype(c);
updatesizehints(c);
updatewmhints(c);
- c->x = c->mon->mx + (c->mon->mw - WIDTH(c)) / 2;
- c->y = c->mon->my + (c->mon->mh - HEIGHT(c)) / 2;
+ c->x = c->mon->mx + (c->mon->mw - WIDTH(c)) / 2;
+ c->y = c->mon->my + (c->mon->mh - HEIGHT(c)) / 2;
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
grabbuttons(c, 0);
if (!c->isfloating)
@@ -1290,11 +1141,11 @@ movemouse(const Arg *arg)
XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
switch(ev.type) {
case ConfigureRequest:
- case Expose:
case MapRequest:
handler[ev.type](&ev);
break;
case MotionNotify:
+
nx = ocx + (ev.xmotion.x - x);
ny = ocy + (ev.xmotion.y - y);
if (abs(selmon->wx - nx) < snap)
@@ -1321,125 +1172,6 @@ movemouse(const Arg *arg)
}
}
-void
-moveresize(const Arg *arg) {
- Client *c;
- c = selmon->sel;
- int x, y, w, h, nx, ny, nw, nh, ox, oy, ow, oh;
- char xAbs, yAbs, wAbs, hAbs;
- int msx, msy, dx, dy, nmx, nmy;
- unsigned int dui;
- Window dummy;
-
- if (!c || !arg)
- return;
- if (selmon->lt[selmon->sellt]->arrange && !c->isfloating)
- return;
- if (sscanf((char *)arg->v, "%d%c %d%c %d%c %d%c", &x, &xAbs, &y, &yAbs, &w, &wAbs, &h, &hAbs) != 8)
- return;
-
- nw = c->w + w;
- if (wAbs == 'W')
- nw = w < selmon->mw - 2 * c->bw ? w : selmon->mw - 2 * c->bw;
-
- nh = c->h + h;
- if (hAbs == 'H')
- nh = h < selmon->mh - 2 * c->bw ? h : selmon->mh - 2 * c->bw;
-
- nx = c->x + x;
- if (xAbs == 'X') {
- if (x < selmon->mx)
- nx = selmon->mx;
- else if (x > selmon->mx + selmon->mw)
- nx = selmon->mx + selmon->mw - nw - 2 * c->bw;
- else
- nx = x;
- }
-
- ny = c->y + y;
- if (yAbs == 'Y') {
- if (y < selmon->my)
- ny = selmon->my;
- else if (y > selmon->my + selmon->mh)
- ny = selmon->my + selmon->mh - nh - 2 * c->bw;
- else
- ny = y;
- }
-
- ox = c->x;
- oy = c->y;
- ow = c->w;
- oh = c->h;
-
- XRaiseWindow(dpy, c->win);
- Bool xqp = XQueryPointer(dpy, root, &dummy, &dummy, &msx, &msy, &dx, &dy, &dui);
- resize(c, nx, ny, nw, nh, True);
-
- /* move cursor along with the window to avoid problems */
- if (xqp && ox <= msx && (ox + ow) >= msx && oy <= msy && (oy + oh) >= msy)
- {
- nmx = c->x - ox + c->w - ow;
- nmy = c->y - oy + c->h - oh;
- /* make sure the cursor stays inside the window */
- if ((msx + nmx) > c->x && (msy + nmy) > c->y)
- XWarpPointer(dpy, None, None, 0, 0, 0, 0, nmx, nmy);
- }
-}
-
-unsigned int
-nexttag(void)
-{
- showtags = 1;
- unsigned int seltag = selmon->tagset[selmon->seltags];
- return seltag == (1 << (LENGTH(tags) - 1)) ? 1 : seltag << 1;
-}
-
-unsigned int
-prevtag(void)
-{
- showtags = 1;
- unsigned int seltag = selmon->tagset[selmon->seltags];
- return seltag == 1 ? (1 << (LENGTH(tags) - 1)) : seltag >> 1;
-}
-
-void
-tagtonext(const Arg *arg)
-{
- unsigned int tmp;
-
- if (selmon->sel == NULL)
- return;
-
- tmp = nexttag();
- tag(&(const Arg){.ui = tmp});
- view(&(const Arg){.ui = tmp});
-}
-
-void
-tagtoprev(const Arg *arg)
-{
- unsigned int tmp;
-
- if (selmon->sel == NULL)
- return;
-
- tmp = prevtag();
- tag(&(const Arg){.ui = tmp});
- view(&(const Arg){.ui = tmp});
-}
-
-void
-viewnext(const Arg *arg)
-{
- view(&(const Arg){.ui = nexttag()});
-}
-
-void
-viewprev(const Arg *arg)
-{
- view(&(const Arg){.ui = prevtag()});
-}
-
Client *
nexttiled(Client *c)
{
@@ -1463,9 +1195,7 @@ propertynotify(XEvent *e)
Window trans;
XPropertyEvent *ev = &e->xproperty;
- if ((ev->window == root) && (ev->atom == XA_WM_NAME))
- updatestatus();
- else if (ev->state == PropertyDelete)
+ if (ev->state == PropertyDelete)
return; /* ignore */
else if ((c = wintoclient(ev->window))) {
switch(ev->atom) {
@@ -1480,13 +1210,10 @@ propertynotify(XEvent *e)
break;
case XA_WM_HINTS:
updatewmhints(c);
- drawbars();
break;
}
if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
updatetitle(c);
- if (c == c->mon->sel)
- drawbar(c->mon);
}
if (ev->atom == netatom[NetWMWindowType])
updatewindowtype(c);
@@ -1525,26 +1252,20 @@ void
resizeclient(Client *c, int x, int y, int w, int h)
{
XWindowChanges wc;
- unsigned int n;
- Client *nbc;
c->oldx = c->x; c->x = wc.x = x;
c->oldy = c->y; c->y = wc.y = y;
c->oldw = c->w; c->w = wc.width = w;
c->oldh = c->h; c->h = wc.height = h;
wc.border_width = c->bw;
-
- for (n = 0, nbc = nexttiled(c->mon->clients); nbc; nbc = nexttiled(nbc->next), n++);
-
- if (c->isfloating || c->mon->lt[c->mon->sellt]->arrange == NULL) {
- } else {
- if (c->mon->lt[c->mon->sellt]->arrange == monocle || n == 1) {
- wc.border_width = 0;
- c->w = wc.width += c->bw * 2;
- c->h = wc.height += c->bw * 2;
- }
- }
-
+ if (((nexttiled(c->mon->clients) == c && !nexttiled(c->next))
+ || &monocle == c->mon->lt[c->mon->sellt]->arrange)
+ && !c->isfullscreen && !c->isfloating
+ && NULL != c->mon->lt[c->mon->sellt]->arrange) {
+ c->w = wc.width += c->bw * 2;
+ c->h = wc.height += c->bw * 2;
+ wc.border_width = 0;
+ }
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
configure(c);
XSync(dpy, False);
@@ -1553,7 +1274,7 @@ resizeclient(Client *c, int x, int y, int w, int h)
void
resizemouse(const Arg *arg)
{
- int x, y, ocw, och, nw, nh;
+ int ocx, ocy, nw, nh;
Client *c;
Monitor *m;
XEvent ev;
@@ -1563,25 +1284,24 @@ resizemouse(const Arg *arg)
if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */
return;
restack(selmon);
- ocw = c->w;
- och = c->h;
+ ocx = c->x;
+ ocy = c->y;
if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess)
return;
- if(!getrootptr(&x, &y))
- return;
+ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
do {
XMaskEvent(dpy, MOUSEMASK|ExposureMask|SubstructureRedirectMask, &ev);
switch(ev.type) {
case ConfigureRequest:
- case Expose:
case MapRequest:
handler[ev.type](&ev);
break;
case MotionNotify:
- nw = MAX(ocw + (ev.xmotion.x - x), 1);
- nh = MAX(och + (ev.xmotion.y - y), 1);
- if (c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww
+
+ nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1);
+ nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1);
+ if (c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww
&& c->mon->wy + nh >= selmon->wy && c->mon->wy + nh <= selmon->wy + selmon->wh)
{
if (!c->isfloating && selmon->lt[selmon->sellt]->arrange
@@ -1593,6 +1313,7 @@ resizemouse(const Arg *arg)
break;
}
} while (ev.type != ButtonRelease);
+ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
XUngrabPointer(dpy, CurrentTime);
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) {
@@ -1609,7 +1330,6 @@ restack(Monitor *m)
XEvent ev;
XWindowChanges wc;
- drawbar(m);
if (!m->sel)
return;
if (m->sel->isfloating || !m->lt[m->sellt]->arrange)
@@ -1724,8 +1444,6 @@ setfocus(Client *c)
XA_WINDOW, 32, PropModeReplace,
(unsigned char *) &(c->win), 1);
}
- if (c->issteam)
- setclientstate(c, NormalState);
sendevent(c, wmatom[WMTakeFocus]);
}
@@ -1767,8 +1485,6 @@ setlayout(const Arg *arg)
strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
if (selmon->sel)
arrange(selmon);
- else
- drawbar(selmon);
}
/* arg > 1.0 will set mfact absolutely */
@@ -1787,19 +1503,6 @@ setmfact(const Arg *arg)
}
void
-setsmfact(const Arg *arg) {
- float sf;
-
- if(!arg || !selmon->lt[selmon->sellt]->arrange)
- return;
- sf = arg->sf < 1.0 ? arg->sf + selmon->smfact : arg->sf - 1.0;
- if(sf < 0 || sf > 0.9)
- return;
- selmon->smfact = sf;
- arrange(selmon);
-}
-
-void
setup(void)
{
int i;
@@ -1825,10 +1528,6 @@ setup(void)
sh = DisplayHeight(dpy, screen);
root = RootWindow(dpy, screen);
drw = drw_create(dpy, screen, root, sw, sh);
- if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
- die("no fonts could be loaded.");
- lrpad = drw->fonts->h;
- bh = drw->fonts->h + 2;
updategeom();
/* init atoms */
utf8string = XInternAtom(dpy, "UTF8_STRING", False);
@@ -1853,9 +1552,6 @@ setup(void)
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
for (i = 0; i < LENGTH(colors); i++)
scheme[i] = drw_scm_create(drw, colors[i], 3);
- /* init bars */
- updatebars();
- updatestatus();
/* supporting window for NetWMCheck */
wmcheckwin = XCreateSimpleWindow(dpy, root, 0, 0, 1, 1, 0, 0, 0);
XChangeProperty(dpy, wmcheckwin, netatom[NetWMCheck], XA_WINDOW, 32,
@@ -1929,8 +1625,6 @@ spawn(const Arg *arg)
{
struct sigaction sa;
- showtags = 0;
-
if (arg->v == dmenucmd)
dmenumon[0] = '0' + selmon->num;
if (fork() == 0) {
@@ -1969,7 +1663,7 @@ tagmon(const Arg *arg)
void
tile(Monitor *m)
{
- unsigned int i, n, h, smh, mw, my, ty;
+ unsigned int i, n, h, mw, my, ty;
Client *c;
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
@@ -1987,36 +1681,14 @@ tile(Monitor *m)
if (my + HEIGHT(c) < m->wh)
my += HEIGHT(c);
} else {
- smh = m->mh * m->smfact;
- if(!(nexttiled(c->next)))
- h = (m->wh - ty) / (n - i);
- else
- h = (m->wh - smh - ty) / (n - i);
- if(h < minwsz) {
- c->isfloating = True;
- XRaiseWindow(dpy, c->win);
- resize(c, m->mx + (m->mw / 2 - WIDTH(c) / 2), m->my + (m->mh / 2 - HEIGHT(c) / 2), m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
- ty -= HEIGHT(c);
- }
- else
- resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
- if(!(nexttiled(c->next)))
- ty += HEIGHT(c) + smh;
- else
- ty += HEIGHT(c);
+ 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);
}
}
void
-togglebar(const Arg *arg)
-{
- selmon->showbar = !selmon->showbar;
- updatebarpos(selmon);
- XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
- arrange(selmon);
-}
-
-void
togglefloating(const Arg *arg)
{
if (!selmon->sel)
@@ -2033,8 +1705,8 @@ togglefloating(const Arg *arg)
void
togglefullscr(const Arg *arg)
{
- if(selmon->sel)
- setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
+ if(selmon->sel)
+ setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
}
void
@@ -2044,7 +1716,6 @@ toggletag(const Arg *arg)
if (!selmon->sel)
return;
- showtags = 1;
newtags = selmon->sel->tags ^ (arg->ui & TAGMASK);
if (newtags) {
selmon->sel->tags = newtags;
@@ -2058,7 +1729,6 @@ toggleview(const Arg *arg)
{
unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
- showtags = 1;
if (newtagset) {
selmon->tagset[selmon->seltags] = newtagset;
focus(NULL);
@@ -2137,41 +1807,6 @@ unmapnotify(XEvent *e)
}
void
-updatebars(void)
-{
- Monitor *m;
- XSetWindowAttributes wa = {
- .override_redirect = True,
- .background_pixmap = ParentRelative,
- .event_mask = ButtonPressMask|ExposureMask
- };
- XClassHint ch = {"dwm", "dwm"};
- for (m = mons; m; m = m->next) {
- if (m->barwin)
- continue;
- m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),
- CopyFromParent, DefaultVisual(dpy, screen),
- CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
- XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
- XMapRaised(dpy, m->barwin);
- XSetClassHint(dpy, m->barwin, &ch);
- }
-}
-
-void
-updatebarpos(Monitor *m)
-{
- m->wy = m->my;
- m->wh = m->mh;
- if (m->showbar) {
- m->wh -= bh;
- m->by = m->topbar ? m->wy : m->wy + m->wh;
- m->wy = m->topbar ? m->wy + bh : m->wy;
- } else
- m->by = -bh;
-}
-
-void
updateclientlist(void)
{
Client *c;
@@ -2226,7 +1861,6 @@ updategeom(void)
m->my = m->wy = unique[i].y_org;
m->mw = m->ww = unique[i].width;
m->mh = m->wh = unique[i].height;
- updatebarpos(m);
}
/* removed monitors if n > nn */
for (i = nn; i < n; i++) {
@@ -2253,7 +1887,6 @@ updategeom(void)
dirty = 1;
mons->mw = mons->ww = sw;
mons->mh = mons->wh = sh;
- updatebarpos(mons);
}
}
if (dirty) {
@@ -2324,14 +1957,6 @@ updatesizehints(Client *c)
}
void
-updatestatus(void)
-{
- // if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
- // strcpy(stext, "dwm-"VERSION);
- drawbar(selmon);
-}
-
-void
updatetitle(Client *c)
{
if (!gettextprop(c->win, netatom[NetWMName], c->name, sizeof c->name))
@@ -2376,7 +2001,6 @@ view(const Arg *arg)
{
if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
return;
- showtags = 1;
selmon->seltags ^= 1; /* toggle sel tagset */
if (arg->ui & TAGMASK)
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
diff --git a/dwm.png b/dwm.png
deleted file mode 100644
index b1f9ba7..0000000
--- a/dwm.png
+++ /dev/null
Binary files differ