Compare commits
30 Commits
d92c684bcf
...
main
Author | SHA1 | Date | |
---|---|---|---|
b157cb3277 | |||
7a8b272500 | |||
866d2f9d30 | |||
15533ee00e | |||
104b7f1fc9 | |||
403436514a | |||
780a7c6092 | |||
25af6dd966 | |||
3f74312239 | |||
abe52747fe | |||
7869969e0d | |||
5d304c99af | |||
645882cc94 | |||
1b96862ae2 | |||
a0fe569f7e | |||
ceb23ea470 | |||
22da8d956f | |||
976638aa52 | |||
a039af0a87 | |||
52a64691d3 | |||
149532bdf0 | |||
f802f3b04e | |||
cc9b2c5f22 | |||
89b87f20e0 | |||
c2ab5aa057 | |||
adc2ff2b17 | |||
b745273428 | |||
66a7223541 | |||
c354d720b6 | |||
31e3dd85c2 |
12
Makefile
12
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} $<
|
||||
@ -26,7 +20,7 @@ dwm: ${OBJ}
|
||||
${CC} -o $@ ${OBJ} ${LDFLAGS}
|
||||
|
||||
clean:
|
||||
rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz config.h
|
||||
rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz
|
||||
|
||||
dist: clean
|
||||
mkdir -p dwm-${VERSION}
|
||||
@ -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
|
||||
|
10
PATCHES
Normal file
10
PATCHES
Normal file
@ -0,0 +1,10 @@
|
||||
actualfullscreen
|
||||
quitprompt
|
||||
fullgaps
|
||||
gaplessgrid
|
||||
status2d + extrabar
|
||||
barpadding + notitle
|
||||
resizecorners
|
||||
statuspadding
|
||||
|
||||
- fonts
|
98
config.def.h
98
config.def.h
@ -3,34 +3,26 @@
|
||||
#include <X11/XF86keysym.h>
|
||||
|
||||
/* appearance */
|
||||
|
||||
static const unsigned int borderpx = 4;
|
||||
static const unsigned int gappx = 15;
|
||||
static const unsigned int borderpx = 4; /* border pixel of windows */
|
||||
static const unsigned int gappx = 15; /* gaps between windows */
|
||||
static const unsigned int snap = 32; /* snap pixel */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int showextrabar = 1; /* 0 means no bar */
|
||||
// TODO: FIX THAT SHIT
|
||||
static const int showextrabar = 1; /* 0 means no extra bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
static const char statussep = ';';
|
||||
static const int horizpadbar = 8;
|
||||
static const int vertpadbar = 12;
|
||||
static const int vertpadstat = 0;
|
||||
static const char *fonts[] = {
|
||||
"Ubuntu Mono:style=Bold:size=12:antialias=true:autohint=true",
|
||||
"Font Awesome 6 Free Solid:style=Solid:size=12:antialias=true:autohint=true",
|
||||
"Font Awesome 6 Brands Regular:style=Regular:size=12:antialias=true:autohint=true"
|
||||
};
|
||||
static char dmenufont[] = "Ubuntu Mono:size=12";
|
||||
static char normbgcolor[] = "#222222";
|
||||
static char normbordercolor[] = "#444444";
|
||||
static char normfgcolor[] = "#bbbbbb";
|
||||
static char selfgcolor[] = "#eeeeee";
|
||||
static char selbordercolor[] = "#005577";
|
||||
static char selbgcolor[] = "#005577";
|
||||
static char *colors[][3] = {
|
||||
static const int horizpadbar = 8; /* horizontal padding for statusbar */
|
||||
static const int vertpadbar = 12; /* vertical padding for statusbar */
|
||||
static const char *fonts[] = { "Ubuntu Mono:size=12" };
|
||||
static const char dmenufont[] = "Ubuntu Mono:size=12";
|
||||
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 *colors[][3] = {
|
||||
/* fg bg border */
|
||||
[SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor },
|
||||
[SchemeSel] = { selfgcolor, selbgcolor, selbordercolor },
|
||||
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
|
||||
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
||||
};
|
||||
|
||||
/* tagging */
|
||||
@ -45,27 +37,32 @@ static const Rule rules[] = {
|
||||
// ----- 1 -----
|
||||
{ "st-256color", NULL, NULL, 0, 0, -1 },
|
||||
// ----- 2 -----
|
||||
{ "Nemo", NULL, NULL, 1 << 1, 0, -1 },
|
||||
{ "Code", NULL, NULL, 1 << 1, 0, -1 },
|
||||
// ----- 3 -----
|
||||
{ "thunderbird", NULL, NULL, 1 << 2, 0, -1 },
|
||||
{ "KeePassXC", NULL, NULL, 1 << 2, 0, -1 },
|
||||
// ----- 4 -----
|
||||
{ "TelegramDesktop", NULL, NULL, 1 << 3, 0, -1 },
|
||||
{ "vesktop", NULL, NULL, 1 << 3, 0, -1 },
|
||||
{ "discord", NULL, NULL, 1 << 3, 0, -1 },
|
||||
{ "KotatogramDesktop", NULL, NULL, 1 << 3, 0, -1 },
|
||||
{ NULL, "Telegram", NULL, 1 << 3, 0, -1 },
|
||||
// ----- 5 -----
|
||||
{ "Steam", NULL, NULL, 1 << 4, 0, -1 },
|
||||
{ "steam", NULL, NULL, 1 << 4, 0, -1 },
|
||||
{ "steamwebhelper", NULL, NULL, 1 << 4, 0, -1 },
|
||||
// ----- 7 -----
|
||||
{ "QjackCtl", NULL, NULL, 1 << 6, 1, -1 },
|
||||
{ "qpwgraph", NULL, NULL, 1 << 6, 0, -1 },
|
||||
{ "nekoray", NULL, NULL, 1 << 6, 0, -1 },
|
||||
{ "PatchMatrix", NULL, NULL, 1 << 6, 0, -1 },
|
||||
{ "Blueman-manager", NULL, NULL, 1 << 6, 0, -1 },
|
||||
{ "corectrl", NULL, NULL, 1 << 6, 0, -1 },
|
||||
// ----- 9 -----
|
||||
{ "firefox", NULL, NULL, 1 << 8, 0, -1 },
|
||||
{ "LibreWolf", NULL, NULL, 1 << 8, 0, -1 },
|
||||
// ----- OTHER -----
|
||||
{ "xwinwrap", NULL, NULL, 1 << 9, 0, -1 },
|
||||
// { NULL, NULL, "broken", 1 << 9, 0, -1 },
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
@ -75,19 +72,18 @@ static const int resizehints = 1; /* 1 means respect size hints in tiled resi
|
||||
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
|
||||
|
||||
#include "layouts.c"
|
||||
|
||||
static const Layout layouts[] = {
|
||||
/* symbol arrange function */
|
||||
{ "###", gaplessgrid },
|
||||
{ "[]=", tile }, /* first entry is default */
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
{ "[]=", tile },
|
||||
{ "><>", NULL },
|
||||
{ "[M]", monocle },
|
||||
{ "HHH", grid },
|
||||
};
|
||||
|
||||
/* key definitions */
|
||||
#define SUPERKEY Mod4Mask
|
||||
#define ALTKEY Mod1Mask
|
||||
|
||||
#define TAGKEYS(KEY,TAG) \
|
||||
{ SUPERKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||
{ SUPERKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||
@ -108,14 +104,12 @@ static const char *volmute[] = { "pactl", "set-sink-mute", "0", "toggle", NULL }
|
||||
static const char *backlightup[] = { "light", "-A", "10", NULL };
|
||||
static const char *backlightdown[] = { "light", "-U", "10", NULL };
|
||||
|
||||
static const char *lockcmd[] = { "slock", NULL };
|
||||
|
||||
static const char *dmenucmd[] = { "dmenu_run", "-g", "15", "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbordercolor, "-sf", selfgcolor, NULL };
|
||||
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[] = { "st", NULL };
|
||||
|
||||
static const Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
{ 0, XF86XK_ModeLock, spawn, {.v = lockcmd } },
|
||||
{ 0, XK_Print, spawn, {.v = screenshot } },
|
||||
{ ShiftMask, XK_Print, spawn, {.v = screenshotarea } },
|
||||
{ 0, XF86XK_AudioRaiseVolume, spawn, {.v = volup } },
|
||||
@ -123,36 +117,27 @@ static const Key keys[] = {
|
||||
{ 0, XF86XK_MonBrightnessUp, spawn, {.v = backlightup } },
|
||||
{ 0, XF86XK_MonBrightnessDown, spawn, {.v = backlightdown } },
|
||||
{ 0, XF86XK_AudioMute, spawn, {.v = volmute } },
|
||||
{ SUPERKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||
{ SUPERKEY, XK_d, spawn, {.v = dmenucmd } },
|
||||
{ SUPERKEY, XK_Return, spawn, {.v = termcmd } },
|
||||
{ SUPERKEY, XK_b, togglebar, {.i = 1} },
|
||||
{ SUPERKEY|ShiftMask, XK_b, togglebar, {.i = 2} },
|
||||
{ SUPERKEY, XK_b, togglebar, {0} },
|
||||
{ SUPERKEY|ShiftMask, XK_b, toggleextrabar, {0} },
|
||||
{ ALTKEY, XK_Tab, focusstack, {.i = +1 } },
|
||||
/* { SUPERKEY, XK_k, focusstack, {.i = -1 } }, */
|
||||
{ SUPERKEY, XK_i, incnmaster, {.i = +1 } },
|
||||
{ SUPERKEY, XK_d, incnmaster, {.i = -1 } },
|
||||
{ SUPERKEY, XK_h, setmfact, {.f = -0.05} },
|
||||
{ SUPERKEY, XK_p, incnmaster, {.i = -1 } },
|
||||
{ SUPERKEY, XK_o, setmfact, {.f = -0.05} },
|
||||
{ SUPERKEY, XK_l, setmfact, {.f = +0.05} },
|
||||
{ SUPERKEY|ShiftMask, XK_Return, zoom, {0} },
|
||||
{ SUPERKEY, XK_Tab, view, {.ui = 0 } }, // next tab
|
||||
{ SUPERKEY|ShiftMask, XK_Tab, view, {.ui = -1 } }, // prev tab
|
||||
{ SUPERKEY|ControlMask, XK_Tab, view, {.ui = -2 } }, // last tab
|
||||
{ SUPERKEY, XK_q, killclient, {0} },
|
||||
{ SUPERKEY, XK_t, setlayout, {.v = &layouts[1]} },
|
||||
{ SUPERKEY, XK_g, setlayout, {.v = &layouts[0]} },
|
||||
// { SUPERKEY, XK_t, setlayout, {.v = &layouts[1]} },
|
||||
{ SUPERKEY, XK_f, setlayout, {.v = &layouts[2]} },
|
||||
{ SUPERKEY, XK_m, setlayout, {.v = &layouts[3]} },
|
||||
{ SUPERKEY|ShiftMask, XK_g, setlayout, {.v = &layouts[4]} },
|
||||
{ SUPERKEY, XK_g, setlayout, {.v = &layouts[0]} },
|
||||
/* { SUPERKEY, XK_space, setlayout, {0} }, */
|
||||
{ SUPERKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||
{ SUPERKEY, XK_comma, focusmon, {.i = -1 } },
|
||||
{ SUPERKEY, XK_period, focusmon, {.i = +1 } },
|
||||
{ SUPERKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||
{ SUPERKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||
{ SUPERKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } },
|
||||
{ SUPERKEY|ShiftMask, XK_t, togglealwaysontop, {0} },
|
||||
// { SUPERKEY, XK_comma, focusmon, {.i = -1 } },
|
||||
// { SUPERKEY, XK_period, focusmon, {.i = +1 } },
|
||||
// { SUPERKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||
// { SUPERKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||
{ SUPERKEY|ShiftMask, XK_f, togglefullscr, {0} },
|
||||
{ SUPERKEY, XK_F5, xrdb, {.v = NULL } },
|
||||
TAGKEYS(XK_1, 0)
|
||||
TAGKEYS(XK_2, 1)
|
||||
TAGKEYS(XK_3, 2)
|
||||
@ -175,12 +160,11 @@ static const Button buttons[] = {
|
||||
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
||||
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
||||
{ ClkClientWin, ALTKEY, Button1, movemouse, {0} },
|
||||
{ ClkClientWin, ALTKEY, Button2, togglefloating, {0} },
|
||||
{ ClkClientWin, ALTKEY, Button3, resizemouse, {0} },
|
||||
{ ClkClientWin, SUPERKEY, Button1, movemouse, {0} },
|
||||
{ ClkClientWin, SUPERKEY, Button2, togglefloating, {0} },
|
||||
{ ClkClientWin, SUPERKEY, Button3, resizemouse, {0} },
|
||||
{ ClkTagBar, 0, Button1, view, {0} },
|
||||
{ ClkTagBar, 0, Button3, toggleview, {0} },
|
||||
{ ClkTagBar, SUPERKEY, Button1, tag, {0} },
|
||||
{ ClkTagBar, SUPERKEY, Button3, toggletag, {0} },
|
||||
};
|
||||
|
||||
|
186
config.h
186
config.h
@ -1,186 +0,0 @@
|
||||
/* See LICENSE file for copyright and license details. */
|
||||
|
||||
#include <X11/XF86keysym.h>
|
||||
|
||||
/* appearance */
|
||||
|
||||
static const unsigned int borderpx = 4;
|
||||
static const unsigned int gappx = 15;
|
||||
static const unsigned int snap = 32; /* snap pixel */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int showextrabar = 1; /* 0 means no bar */
|
||||
// TODO: FIX THAT SHIT
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
static const char statussep = ';';
|
||||
static const int horizpadbar = 8;
|
||||
static const int vertpadbar = 12;
|
||||
static const int vertpadstat = 0;
|
||||
static const char *fonts[] = {
|
||||
"Ubuntu Mono:style=Bold:size=12:antialias=true:autohint=true",
|
||||
"Font Awesome 6 Free Solid:style=Solid:size=12:antialias=true:autohint=true",
|
||||
"Font Awesome 6 Brands Regular:style=Regular:size=12:antialias=true:autohint=true"
|
||||
};
|
||||
static char dmenufont[] = "Ubuntu Mono:size=12";
|
||||
static char normbgcolor[] = "#222222";
|
||||
static char normbordercolor[] = "#444444";
|
||||
static char normfgcolor[] = "#bbbbbb";
|
||||
static char selfgcolor[] = "#eeeeee";
|
||||
static char selbordercolor[] = "#005577";
|
||||
static char selbgcolor[] = "#005577";
|
||||
static char *colors[][3] = {
|
||||
/* fg bg border */
|
||||
[SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor },
|
||||
[SchemeSel] = { selfgcolor, selbgcolor, selbordercolor },
|
||||
};
|
||||
|
||||
/* tagging */
|
||||
static const char *tags[] = { "", "", "", "", "", "", "", "", "", "0", "-", "=" };
|
||||
|
||||
static const Rule rules[] = {
|
||||
/* xprop(1):
|
||||
* WM_CLASS(STRING) = instance, class
|
||||
* WM_NAME(STRING) = title
|
||||
*/
|
||||
/* class instance title tags mask isfloating monitor */
|
||||
// ----- 1 -----
|
||||
{ "st-256color", NULL, NULL, 0, 0, -1 },
|
||||
// ----- 2 -----
|
||||
{ "Code", NULL, NULL, 1 << 1, 0, -1 },
|
||||
// ----- 3 -----
|
||||
{ "thunderbird", NULL, NULL, 1 << 2, 0, -1 },
|
||||
{ "KeePassXC", NULL, NULL, 1 << 2, 0, -1 },
|
||||
// ----- 4 -----
|
||||
{ "TelegramDesktop", NULL, NULL, 1 << 3, 0, -1 },
|
||||
{ "discord", NULL, NULL, 1 << 3, 0, -1 },
|
||||
// ----- 5 -----
|
||||
{ "Steam", NULL, NULL, 1 << 4, 0, -1 },
|
||||
{ "steam", NULL, NULL, 1 << 4, 0, -1 },
|
||||
{ "steamwebhelper", NULL, NULL, 1 << 4, 0, -1 },
|
||||
// ----- 7 -----
|
||||
{ "QjackCtl", NULL, NULL, 1 << 6, 1, -1 },
|
||||
{ "PatchMatrix", NULL, NULL, 1 << 6, 0, -1 },
|
||||
{ "Blueman-manager", NULL, NULL, 1 << 6, 0, -1 },
|
||||
{ "corectrl", NULL, NULL, 1 << 6, 0, -1 },
|
||||
// ----- 9 -----
|
||||
{ "firefox", NULL, NULL, 1 << 8, 0, -1 },
|
||||
// ----- OTHER -----
|
||||
{ "xwinwrap", NULL, NULL, 1 << 9, 0, -1 },
|
||||
// { NULL, NULL, "broken", 1 << 9, 0, -1 },
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
static const float mfact = 0.55; /* 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 */
|
||||
|
||||
#include "layouts.c"
|
||||
static const Layout layouts[] = {
|
||||
/* symbol arrange function */
|
||||
{ "###", gaplessgrid },
|
||||
{ "[]=", tile }, /* first entry is default */
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
{ "[M]", monocle },
|
||||
{ "HHH", grid },
|
||||
};
|
||||
|
||||
/* key definitions */
|
||||
#define SUPERKEY Mod4Mask
|
||||
#define ALTKEY Mod1Mask
|
||||
|
||||
#define TAGKEYS(KEY,TAG) \
|
||||
{ SUPERKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||
{ SUPERKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||
{ SUPERKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
|
||||
{ SUPERKEY|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 const char *screenshot[] = { "scrsht", NULL };
|
||||
static const char *screenshotarea[] = { "scrsht", "-s", NULL };
|
||||
|
||||
static const char *volup[] = { "pactl", "set-sink-volume", "0", "+5%", NULL };
|
||||
static const char *voldown[] = { "pactl", "set-sink-volume", "0", "-5%", NULL };
|
||||
static const char *volmute[] = { "pactl", "set-sink-mute", "0", "toggle", NULL };
|
||||
|
||||
static const char *backlightup[] = { "light", "-A", "10", NULL };
|
||||
static const char *backlightdown[] = { "light", "-U", "10", NULL };
|
||||
|
||||
static const char *lockcmd[] = { "slock", NULL };
|
||||
|
||||
static const char *dmenucmd[] = { "dmenu_run", "-g", "15", "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbordercolor, "-sf", selfgcolor, NULL };
|
||||
static const char *termcmd[] = { "st", NULL };
|
||||
|
||||
static const Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
{ 0, XF86XK_ModeLock, spawn, {.v = lockcmd } },
|
||||
{ 0, XK_Print, spawn, {.v = screenshot } },
|
||||
{ ShiftMask, XK_Print, spawn, {.v = screenshotarea } },
|
||||
{ 0, XF86XK_AudioRaiseVolume, spawn, {.v = volup } },
|
||||
{ 0, XF86XK_AudioLowerVolume, spawn, {.v = voldown } },
|
||||
{ 0, XF86XK_MonBrightnessUp, spawn, {.v = backlightup } },
|
||||
{ 0, XF86XK_MonBrightnessDown, spawn, {.v = backlightdown } },
|
||||
{ 0, XF86XK_AudioMute, spawn, {.v = volmute } },
|
||||
{ SUPERKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||
{ SUPERKEY, XK_Return, spawn, {.v = termcmd } },
|
||||
{ SUPERKEY, XK_b, togglebar, {.i = 1} },
|
||||
{ SUPERKEY|ShiftMask, XK_b, togglebar, {.i = 2} },
|
||||
{ ALTKEY, XK_Tab, focusstack, {.i = +1 } },
|
||||
/* { SUPERKEY, XK_k, focusstack, {.i = -1 } }, */
|
||||
{ SUPERKEY, XK_i, incnmaster, {.i = +1 } },
|
||||
{ SUPERKEY, XK_d, incnmaster, {.i = -1 } },
|
||||
{ SUPERKEY, XK_h, setmfact, {.f = -0.05} },
|
||||
{ SUPERKEY, XK_l, setmfact, {.f = +0.05} },
|
||||
{ SUPERKEY|ShiftMask, XK_Return, zoom, {0} },
|
||||
{ SUPERKEY, XK_Tab, view, {.ui = 0 } }, // next tab
|
||||
{ SUPERKEY|ShiftMask, XK_Tab, view, {.ui = -1 } }, // prev tab
|
||||
{ SUPERKEY|ControlMask, XK_Tab, view, {.ui = -2 } }, // last tab
|
||||
{ SUPERKEY, XK_q, killclient, {0} },
|
||||
{ SUPERKEY, XK_t, setlayout, {.v = &layouts[1]} },
|
||||
{ SUPERKEY, XK_f, setlayout, {.v = &layouts[2]} },
|
||||
{ SUPERKEY, XK_m, setlayout, {.v = &layouts[3]} },
|
||||
{ SUPERKEY|ShiftMask, XK_g, setlayout, {.v = &layouts[4]} },
|
||||
{ SUPERKEY, XK_g, setlayout, {.v = &layouts[0]} },
|
||||
/* { SUPERKEY, XK_space, setlayout, {0} }, */
|
||||
{ SUPERKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||
{ SUPERKEY, XK_comma, focusmon, {.i = -1 } },
|
||||
{ SUPERKEY, XK_period, focusmon, {.i = +1 } },
|
||||
{ SUPERKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||
{ SUPERKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||
{ SUPERKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } },
|
||||
{ SUPERKEY|ShiftMask, XK_t, togglealwaysontop, {0} },
|
||||
{ SUPERKEY|ShiftMask, XK_f, togglefullscr, {0} },
|
||||
{ SUPERKEY, XK_F5, xrdb, {.v = NULL } },
|
||||
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)
|
||||
TAGKEYS( XK_0, 9)
|
||||
TAGKEYS( XK_minus, 10)
|
||||
TAGKEYS( XK_equal, 11)
|
||||
{ SUPERKEY|ShiftMask, XK_q, quitprompt, {0} },
|
||||
};
|
||||
|
||||
/* button definitions */
|
||||
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
|
||||
static const Button buttons[] = {
|
||||
/* click event mask button function argument */
|
||||
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
||||
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
||||
{ ClkClientWin, ALTKEY, Button1, movemouse, {0} },
|
||||
{ ClkClientWin, ALTKEY, Button2, togglefloating, {0} },
|
||||
{ ClkClientWin, ALTKEY, Button3, resizemouse, {0} },
|
||||
{ ClkTagBar, 0, Button1, view, {0} },
|
||||
{ ClkTagBar, 0, Button3, toggleview, {0} },
|
||||
{ ClkTagBar, SUPERKEY, Button1, tag, {0} },
|
||||
{ ClkTagBar, SUPERKEY, Button3, toggletag, {0} },
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
# dwm version
|
||||
VERSION = bit_1.1
|
||||
VERSION = 6.5
|
||||
|
||||
# Customize below to fit your system
|
||||
|
||||
@ -26,7 +26,7 @@ INCS = -I${X11INC} -I${FREETYPEINC}
|
||||
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}
|
||||
|
||||
# flags
|
||||
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
|
||||
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
|
||||
#CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS}
|
||||
CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS}
|
||||
LDFLAGS = ${LIBS}
|
||||
|
2
drw.c
2
drw.c
@ -195,7 +195,7 @@ drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
|
||||
/* Wrapper to create color schemes. The caller has to call free(3) on the
|
||||
* returned color scheme when done using it. */
|
||||
Clr *
|
||||
drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount)
|
||||
drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
|
||||
{
|
||||
size_t i;
|
||||
Clr *ret;
|
||||
|
2
drw.h
2
drw.h
@ -40,7 +40,7 @@ void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned in
|
||||
|
||||
/* Colorscheme abstraction */
|
||||
void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
|
||||
Clr *drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount);
|
||||
Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount);
|
||||
|
||||
/* Cursor abstraction */
|
||||
Cur *drw_cur_create(Drw *drw, int shape);
|
||||
|
504
dwm.c
504
dwm.c
@ -1,4 +1,3 @@
|
||||
|
||||
/* See LICENSE file for copyright and license details.
|
||||
*
|
||||
* dynamic window manager is designed like any other X client as well. It is
|
||||
@ -36,7 +35,6 @@
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/Xresource.h>
|
||||
#include <X11/Xutil.h>
|
||||
#ifdef XINERAMA
|
||||
#include <X11/extensions/Xinerama.h>
|
||||
@ -58,21 +56,6 @@
|
||||
#define HEIGHT(X) ((X)->h + 2 * (X)->bw)
|
||||
#define TAGMASK ((1 << LENGTH(tags)) - 1)
|
||||
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
|
||||
#define XRDB_LOAD_COLOR(R,V) if (XrmGetResource(xrdb, R, NULL, &type, &value) == True) { \
|
||||
if (value.addr != NULL && strnlen(value.addr, 8) == 7 && value.addr[0] == '#') { \
|
||||
int i = 1; \
|
||||
for (; i <= 6; i++) { \
|
||||
if (value.addr[i] < 48) break; \
|
||||
if (value.addr[i] > 57 && value.addr[i] < 65) break; \
|
||||
if (value.addr[i] > 70 && value.addr[i] < 97) break; \
|
||||
if (value.addr[i] > 102) break; \
|
||||
} \
|
||||
if (i == 7) { \
|
||||
strncpy(V, value.addr, 7); \
|
||||
V[7] = '\0'; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
/* enums */
|
||||
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
|
||||
@ -81,8 +64,8 @@ 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, ClkClientWin,
|
||||
ClkRootWin, ClkLast }; /* clicks */
|
||||
enum { ClkTagBar, ClkLtSymbol, ClkStatusText,
|
||||
ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
|
||||
|
||||
typedef union {
|
||||
int i;
|
||||
@ -99,6 +82,7 @@ typedef struct {
|
||||
const Arg arg;
|
||||
} Button;
|
||||
|
||||
typedef struct Pertag Pertag;
|
||||
typedef struct Monitor Monitor;
|
||||
typedef struct Client Client;
|
||||
struct Client {
|
||||
@ -109,7 +93,7 @@ struct Client {
|
||||
int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid;
|
||||
int bw, oldbw;
|
||||
unsigned int tags;
|
||||
int isfixed, iscentered, isfloating, isalwaysontop, isurgent, neverfocus, oldstate, isfullscreen;
|
||||
int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
|
||||
Client *next;
|
||||
Client *snext;
|
||||
Monitor *mon;
|
||||
@ -128,17 +112,15 @@ typedef struct {
|
||||
void (*arrange)(Monitor *);
|
||||
} Layout;
|
||||
|
||||
typedef struct Pertag Pertag;
|
||||
struct Monitor {
|
||||
char ltsymbol[16];
|
||||
float mfact;
|
||||
int nmaster;
|
||||
int num;
|
||||
int by; /* bar geometry */
|
||||
int eby; /* bar geometry */
|
||||
int eby; /* extra bar geometry */
|
||||
int mx, my, mw, mh; /* screen size */
|
||||
int wx, wy, ww, wh; /* window area */
|
||||
int gappx;
|
||||
unsigned int seltags;
|
||||
unsigned int sellt;
|
||||
unsigned int tagset[2];
|
||||
@ -183,7 +165,6 @@ static Monitor *createmon(void);
|
||||
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 int drawstatusbar(Monitor *m, int bh, int extra, char* text);
|
||||
@ -191,7 +172,6 @@ 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);
|
||||
static void focusstack(const Arg *arg);
|
||||
static Atom getatomprop(Client *c, Atom prop);
|
||||
static int getrootptr(int *x, int *y);
|
||||
@ -202,7 +182,6 @@ static void grabkeys(void);
|
||||
static void incnmaster(const Arg *arg);
|
||||
static void keypress(XEvent *e);
|
||||
static void killclient(const Arg *arg);
|
||||
static void loadxrdb(void);
|
||||
static void manage(Window w, XWindowAttributes *wa);
|
||||
static void mappingnotify(XEvent *e);
|
||||
static void maprequest(XEvent *e);
|
||||
@ -225,20 +204,17 @@ 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);
|
||||
static void seturgent(Client *c, int urg);
|
||||
static void showhide(Client *c);
|
||||
static void sigchld(int unused);
|
||||
static void spawn(const Arg *arg);
|
||||
static void tag(const Arg *arg);
|
||||
static void tagmon(const Arg *arg);
|
||||
static void togglebar(const Arg *arg);
|
||||
static void toggleextrabar(const Arg *arg);
|
||||
static void togglefloating(const Arg *arg);
|
||||
static void togglefullscr(const Arg *arg);
|
||||
static void togglealwaysontop(const Arg *arg);
|
||||
static void toggletag(const Arg *arg);
|
||||
static void toggleview(const Arg *arg);
|
||||
static void unfocus(Client *c, int setfocus);
|
||||
@ -260,21 +236,18 @@ static Monitor *wintomon(Window w);
|
||||
static int xerror(Display *dpy, XErrorEvent *ee);
|
||||
static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
||||
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||
static void xrdb(const Arg *arg);
|
||||
static void zoom(const Arg *arg);
|
||||
|
||||
/* variables */
|
||||
static const char broken[] = "broken";
|
||||
static char stext[1024];
|
||||
static char estext[2048];
|
||||
static char estext[1024];
|
||||
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 vpb;
|
||||
static int hpb;
|
||||
static int (*xerrorxlib)(Display *, XErrorEvent *);
|
||||
static unsigned int numlockmask = 0;
|
||||
static unsigned int numlockmask = 1;
|
||||
static void (*handler[LASTEvent]) (XEvent *) = {
|
||||
[ButtonPress] = buttonpress,
|
||||
[ClientMessage] = clientmessage,
|
||||
@ -481,11 +454,10 @@ buttonpress(XEvent *e)
|
||||
if (i < LENGTH(tags)) {
|
||||
click = ClkTagBar;
|
||||
arg.ui = 1 << i;
|
||||
} else if (ev->x < x + TEXTW(selmon->ltsymbol)) {
|
||||
} else if (ev->x < x + TEXTW(selmon->ltsymbol))
|
||||
click = ClkLtSymbol;
|
||||
} else if (ev->x > selmon->ww - TEXTW(selmon->ltsymbol)) {
|
||||
else
|
||||
click = ClkStatusText;
|
||||
}
|
||||
} else if ((c = wintoclient(ev->window))) {
|
||||
focus(c);
|
||||
restack(selmon);
|
||||
@ -613,8 +585,8 @@ configurenotify(XEvent *e)
|
||||
for (c = m->clients; c; c = c->next)
|
||||
if (c->isfullscreen)
|
||||
resizeclient(c, m->mx, m->my, m->mw, m->mh);
|
||||
XMoveResizeWindow(dpy, m->barwin, m->wx + hpb, m->by + vpb, m->ww - 2 * hpb, bh);
|
||||
XMoveResizeWindow(dpy, m->extrabarwin, m->wx + hpb, m->eby - vpb, m->ww - 2 * hpb, bh);
|
||||
XMoveResizeWindow(dpy, m->barwin, m->wx + gappx, m->by + gappx, m->ww - 2 * gappx, bh);
|
||||
XMoveResizeWindow(dpy, m->extrabarwin, m->wx + gappx, m->eby - gappx, m->ww - 2 * gappx, bh);
|
||||
}
|
||||
focus(NULL);
|
||||
arrange(NULL);
|
||||
@ -687,7 +659,6 @@ createmon(void)
|
||||
m->showbar = showbar;
|
||||
m->showextrabar = showextrabar;
|
||||
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);
|
||||
@ -704,6 +675,7 @@ createmon(void)
|
||||
|
||||
m->pertag->showbars[i] = m->showbar;
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
@ -740,48 +712,16 @@ detachstack(Client *c)
|
||||
}
|
||||
}
|
||||
|
||||
Monitor *
|
||||
dirtomon(int dir)
|
||||
{
|
||||
Monitor *m = NULL;
|
||||
|
||||
if (dir > 0) {
|
||||
if (!(m = selmon->next))
|
||||
m = mons;
|
||||
} else if (selmon == mons)
|
||||
for (m = mons; m->next; m = m->next);
|
||||
else
|
||||
for (m = mons; m->next != selmon; m = m->next);
|
||||
return m;
|
||||
}
|
||||
|
||||
int
|
||||
drawstatusbar(Monitor *m, int bh, int extra, char* stext) {
|
||||
int ret, i, w, w2, x, x2, len, len2;
|
||||
short isCode = 0, isCode2 = 0;
|
||||
char *text, *text2;
|
||||
char *p, *p2;
|
||||
char stext2[1024];
|
||||
|
||||
char *st = strchr(stext, statussep);
|
||||
if (st) {
|
||||
*st = '\0'; st++;
|
||||
strncpy(stext2, st, sizeof(stext2) - 1);
|
||||
} else {
|
||||
stext2[0] = '\0';
|
||||
}
|
||||
|
||||
len2 = strlen(stext2) + 1;
|
||||
if (!(text2 = (char*) malloc(sizeof(char)*len2)))
|
||||
die("malloc");
|
||||
|
||||
p2 = text2;
|
||||
memcpy(text2, stext2, len2);
|
||||
int ret, i, w, x, len;
|
||||
short isCode = 0;
|
||||
char *text;
|
||||
char *p;
|
||||
|
||||
len = strlen(stext) + 1 ;
|
||||
if (!(text = (char*) malloc(sizeof(char)*len)))
|
||||
die("malloc");
|
||||
|
||||
p = text;
|
||||
memcpy(text, stext, len);
|
||||
|
||||
@ -811,41 +751,11 @@ drawstatusbar(Monitor *m, int bh, int extra, char* stext) {
|
||||
text = p;
|
||||
|
||||
if (extra) {
|
||||
w2 = 0;
|
||||
i = -1;
|
||||
while (text2[++i]) {
|
||||
if (text2[i] == '^') {
|
||||
if (!isCode2) {
|
||||
isCode2 = 1;
|
||||
text2[i] = '\0';
|
||||
w2 += TEXTW(text2) - lrpad;
|
||||
text2[i] = '^';
|
||||
if (text2[++i] == 'f')
|
||||
w2 += atoi(text2 + ++i);
|
||||
w = m->ww - 2 * gappx;
|
||||
ret = x = 0;
|
||||
} else {
|
||||
isCode2 = 0;
|
||||
text2 = text2 + i + 1;
|
||||
i = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isCode2)
|
||||
w2 += TEXTW(text2) - lrpad;
|
||||
else
|
||||
isCode2 = 0;
|
||||
text2 = p2;
|
||||
}
|
||||
|
||||
if (extra) {
|
||||
w = m->ww;
|
||||
w = m->ww - w - 2 * hpb;
|
||||
ret = m->ww - w;
|
||||
x = 0 - 1;
|
||||
x2 = m->ww - w2 - 2 * hpb;
|
||||
} else {
|
||||
// w += 2; /* 1px padding on both sides */
|
||||
ret = m->ww - w;
|
||||
x = ret - 2 * hpb;
|
||||
x = ret - 2 * gappx;
|
||||
}
|
||||
|
||||
drw_setscheme(drw, scheme[LENGTH(colors)]);
|
||||
@ -862,7 +772,7 @@ drawstatusbar(Monitor *m, int bh, int extra, char* stext) {
|
||||
|
||||
text[i] = '\0';
|
||||
w = TEXTW(text) - lrpad;
|
||||
drw_text(drw, x, vertpadstat, w, bh - 2 * vertpadstat, 0, text, 0);
|
||||
drw_text(drw, x, 0, w, bh, 0, text, 0);
|
||||
|
||||
x += w;
|
||||
|
||||
@ -904,73 +814,11 @@ drawstatusbar(Monitor *m, int bh, int extra, char* stext) {
|
||||
}
|
||||
}
|
||||
|
||||
if (extra) {
|
||||
drw_setscheme(drw, scheme[LENGTH(colors)]);
|
||||
drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
|
||||
drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
|
||||
drw_rect(drw, m->ww - w2, 0, w2, bh, 1, 1);
|
||||
x2++;
|
||||
|
||||
i = -1;
|
||||
while (text2[++i]) {
|
||||
if (text2[i] == '^' && !isCode2) {
|
||||
isCode2 = 1;
|
||||
|
||||
text2[i] = '\0';
|
||||
w2 = TEXTW(text2) - lrpad;
|
||||
drw_text(drw, x2, vertpadstat, w2, bh - 2 * vertpadstat, 0, text2, 0);
|
||||
|
||||
x2 += w2;
|
||||
|
||||
/* process code */
|
||||
while (text2[++i] != '^') {
|
||||
if (text2[i] == 'c') {
|
||||
char buf[8];
|
||||
memcpy(buf, (char*)text2+i+1, 7);
|
||||
buf[7] = '\0';
|
||||
drw_clr_create(drw, &drw->scheme[ColFg], buf);
|
||||
i += 7;
|
||||
} else if (text2[i] == 'b') {
|
||||
char buf[8];
|
||||
memcpy(buf, (char*)text2+i+1, 7);
|
||||
buf[7] = '\0';
|
||||
drw_clr_create(drw, &drw->scheme[ColBg], buf);
|
||||
i += 7;
|
||||
} else if (text2[i] == 'd') {
|
||||
drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
|
||||
drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
|
||||
} else if (text2[i] == 'r') {
|
||||
int rx = atoi(text2 + ++i);
|
||||
while (text2[++i] != ',');
|
||||
int ry = atoi(text2 + ++i);
|
||||
while (text2[++i] != ',');
|
||||
int rw = atoi(text2 + ++i);
|
||||
while (text2[++i] != ',');
|
||||
int rh = atoi(text2 + ++i);
|
||||
|
||||
drw_rect(drw, rx + x2, ry, rw, rh, 1, 0);
|
||||
} else if (text2[i] == 'f') {
|
||||
x2 += atoi(text2 + ++i);
|
||||
}
|
||||
}
|
||||
|
||||
text2 = text2 + i + 1;
|
||||
i=-1;
|
||||
isCode2 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isCode) {
|
||||
w = TEXTW(text) - lrpad;
|
||||
drw_text(drw, x, 0, w, bh, 0, text, 0);
|
||||
}
|
||||
|
||||
if (!isCode2) {
|
||||
w2 = TEXTW(text2) - lrpad;
|
||||
drw_text(drw, m->ww - w2 - hpb * 2, 0, w2, bh, 0, text2, 0);
|
||||
}
|
||||
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
free(p);
|
||||
|
||||
@ -981,15 +829,21 @@ void
|
||||
drawbar(Monitor *m)
|
||||
{
|
||||
int x, w, tw = 0;
|
||||
int boxs = drw->fonts->h / 9;
|
||||
int boxw = drw->fonts->h / 6 + 2;
|
||||
unsigned int i, occ = 0, urg = 0;
|
||||
Client *c;
|
||||
|
||||
if (m->showbar) {
|
||||
if (!m->showbar && !m->showextrabar)
|
||||
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[SchemeNorm]);
|
||||
// tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
|
||||
// drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
|
||||
tw = m->ww - drawstatusbar(m, bh, 0, stext);
|
||||
}
|
||||
}
|
||||
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
occ |= c->tags;
|
||||
@ -1001,15 +855,10 @@ drawbar(Monitor *m)
|
||||
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 + w / 3, 0, w / 3, 2, 0, 0);
|
||||
drw_rect(drw, x + w / 3, bh - 2, w / 3, 2, 0, 0);
|
||||
if (m == selmon && selmon->sel && selmon->sel->tags & 1 << i) {
|
||||
drw_rect(drw, x, 0, w, 2, 0, 0);
|
||||
drw_rect(drw, x, bh - 2, w, 2, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
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 = TEXTW(m->ltsymbol);
|
||||
@ -1018,21 +867,16 @@ drawbar(Monitor *m)
|
||||
|
||||
if ((w = m->ww - tw - x) > bh) {
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
drw_rect(drw, x, 0, w - 2 * hpb, bh, 1, 1);
|
||||
drw_rect(drw, x, 0, w - 2 * gappx, bh, 1, 1);
|
||||
}
|
||||
|
||||
if (m->showbar)
|
||||
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
|
||||
|
||||
if (m->showextrabar) {
|
||||
if (m == selmon) { /* extra status is only drawn on selected monitor */
|
||||
sw = drawstatusbar(m, bh, 1, estext);
|
||||
tw = drawstatusbar(m, bh, 1, estext);
|
||||
drw_map(drw, m->extrabarwin, 0, 0, m->ww, bh);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
drawbars(void)
|
||||
{
|
||||
@ -1106,20 +950,6 @@ focusin(XEvent *e)
|
||||
setfocus(selmon->sel);
|
||||
}
|
||||
|
||||
void
|
||||
focusmon(const Arg *arg)
|
||||
{
|
||||
Monitor *m;
|
||||
|
||||
if (!mons->next)
|
||||
return;
|
||||
if ((m = dirtomon(arg->i)) == selmon)
|
||||
return;
|
||||
unfocus(selmon->sel, 0);
|
||||
selmon = m;
|
||||
focus(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
focusstack(const Arg *arg)
|
||||
{
|
||||
@ -1239,22 +1069,33 @@ grabkeys(void)
|
||||
{
|
||||
updatenumlockmask();
|
||||
{
|
||||
unsigned int i, j;
|
||||
unsigned int i, j, k;
|
||||
unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask };
|
||||
KeyCode code;
|
||||
int start, end, skip;
|
||||
KeySym *syms;
|
||||
|
||||
XUngrabKey(dpy, AnyKey, AnyModifier, root);
|
||||
XDisplayKeycodes(dpy, &start, &end);
|
||||
syms = XGetKeyboardMapping(dpy, start, end - start + 1, &skip);
|
||||
if (!syms)
|
||||
return;
|
||||
for (k = start; k <= end; k++)
|
||||
for (i = 0; i < LENGTH(keys); i++)
|
||||
if ((code = XKeysymToKeycode(dpy, keys[i].keysym)))
|
||||
/* skip modifier codes, we do that ourselves */
|
||||
if (keys[i].keysym == syms[(k - start) * skip])
|
||||
for (j = 0; j < LENGTH(modifiers); j++)
|
||||
XGrabKey(dpy, code, keys[i].mod | modifiers[j], root,
|
||||
True, GrabModeAsync, GrabModeAsync);
|
||||
XGrabKey(dpy, k,
|
||||
keys[i].mod | modifiers[j],
|
||||
root, True,
|
||||
GrabModeAsync, GrabModeAsync);
|
||||
XFree(syms);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
incnmaster(const Arg *arg)
|
||||
{
|
||||
selmon->nmaster = MAX(selmon->nmaster + arg->i, 0);
|
||||
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag] = MAX(selmon->nmaster + arg->i, 0);
|
||||
arrange(selmon);
|
||||
}
|
||||
@ -1303,37 +1144,6 @@ killclient(const Arg *arg)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
loadxrdb()
|
||||
{
|
||||
Display *display;
|
||||
char * resm;
|
||||
XrmDatabase xrdb;
|
||||
char *type;
|
||||
XrmValue value;
|
||||
|
||||
display = XOpenDisplay(NULL);
|
||||
|
||||
if (display != NULL) {
|
||||
resm = XResourceManagerString(display);
|
||||
|
||||
if (resm != NULL) {
|
||||
xrdb = XrmGetStringDatabase(resm);
|
||||
|
||||
if (xrdb != NULL) {
|
||||
XRDB_LOAD_COLOR("dwm.normbordercolor", normbordercolor);
|
||||
XRDB_LOAD_COLOR("dwm.normbgcolor", normbgcolor);
|
||||
XRDB_LOAD_COLOR("dwm.normfgcolor", normfgcolor);
|
||||
XRDB_LOAD_COLOR("dwm.selbordercolor", selbordercolor);
|
||||
XRDB_LOAD_COLOR("dwm.selbgcolor", selbgcolor);
|
||||
XRDB_LOAD_COLOR("dwm.selfgcolor", selfgcolor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
XCloseDisplay(display);
|
||||
}
|
||||
|
||||
void
|
||||
manage(Window w, XWindowAttributes *wa)
|
||||
{
|
||||
@ -1552,27 +1362,26 @@ quit(const Arg *arg)
|
||||
void
|
||||
quitprompt(const Arg *arg)
|
||||
{
|
||||
FILE *pp = popen("echo \"lock\nrestart\nexit\nreboot\nshutdown\" | dmenu -i -sb red -p \"exit:\"", "r");
|
||||
|
||||
char buf[16];
|
||||
|
||||
if(pp == NULL || fscanf(pp, "%15[a-zA-Z -]", buf) == EOF) {
|
||||
fputs("Quitprompt: Error reading pipe!", stderr);
|
||||
goto close_streams;
|
||||
FILE *pp = popen("echo -e \"no\nrestart\nyes\" | dmenu -i -sb red -p \"Quit DWM?\"", "r");
|
||||
if(pp != NULL) {
|
||||
char buf[1024];
|
||||
if (fgets(buf, sizeof(buf), pp) == NULL) {
|
||||
fprintf(stderr, "Quitprompt: Error reading pipe!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
int sysret;
|
||||
|
||||
if(strcmp(buf, "lock") == 0) sysret = system("slock");
|
||||
else if(strcmp(buf, "restart") == 0) quit(&(const Arg){1});
|
||||
else if(strcmp(buf, "exit") == 0) quit(&(const Arg){0});
|
||||
else if(strcmp(buf, "reboot") == 0) sysret = system("systemctl reboot");
|
||||
else if(strcmp(buf, "shutdown") == 0) sysret = system("systemctl poweroff -i");
|
||||
|
||||
if(sysret);
|
||||
|
||||
close_streams:
|
||||
if (strcmp(buf, "yes\n") == 0) {
|
||||
pclose(pp);
|
||||
restart = 0;
|
||||
quit(NULL);
|
||||
} else if (strcmp(buf, "restart\n") == 0) {
|
||||
pclose(pp);
|
||||
restart = 1;
|
||||
quit(NULL);
|
||||
} else if (strcmp(buf, "no\n") == 0) {
|
||||
pclose(pp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Monitor *
|
||||
@ -1623,6 +1432,7 @@ resizemouse(const Arg *arg)
|
||||
int di;
|
||||
unsigned int dui;
|
||||
Window dummy;
|
||||
|
||||
Time lasttime = 0;
|
||||
|
||||
if (!(c = selmon->sel))
|
||||
@ -1637,7 +1447,6 @@ resizemouse(const Arg *arg)
|
||||
if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
||||
None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess)
|
||||
return;
|
||||
// XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
|
||||
if (!XQueryPointer (dpy, c->win, &dummy, &dummy, &di, &di, &nx, &ny, &dui))
|
||||
return;
|
||||
horizcorner = nx < c->w / 2;
|
||||
@ -1658,12 +1467,14 @@ resizemouse(const Arg *arg)
|
||||
continue;
|
||||
lasttime = ev.xmotion.time;
|
||||
|
||||
// nw = MAX(ev.xmotion.x - ocx - 2 * c->bw + 1, 1);
|
||||
// nh = MAX(ev.xmotion.y - ocy - 2 * c->bw + 1, 1);
|
||||
nx = horizcorner ? ev.xmotion.x : c->x;
|
||||
ny = vertcorner ? ev.xmotion.y : c->y;
|
||||
nx = horizcorner && ocx2 - ev.xmotion.x >= c->minw ? ev.xmotion.x : c->x;
|
||||
ny = vertcorner && ocy2 - ev.xmotion.y >= c->minh ? ev.xmotion.y : c->y;
|
||||
nw = MAX(horizcorner ? (ocx2 - nx) : (ev.xmotion.x - ocx - 2 * c->bw + 1), 1);
|
||||
nh = MAX(vertcorner ? (ocy2 - ny) : (ev.xmotion.y - ocy - 2 * c->bw + 1), 1);
|
||||
if (horizcorner && ev.xmotion.x > ocx2)
|
||||
nx = ocx2 - (nw = c->minw);
|
||||
if (vertcorner && ev.xmotion.y > ocy2)
|
||||
ny = ocy2 - (nh = c->minh);
|
||||
|
||||
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)
|
||||
@ -1673,12 +1484,10 @@ resizemouse(const Arg *arg)
|
||||
togglefloating(NULL);
|
||||
}
|
||||
if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
|
||||
// resize(c, c->x, c->y, nw, nh, 1);
|
||||
resize(c, nx, ny, nw, nh, 1);
|
||||
break;
|
||||
}
|
||||
} while (ev.type != ButtonRelease);
|
||||
// XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
|
||||
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0,
|
||||
horizcorner ? (-c->bw) : (c->w + c->bw - 1),
|
||||
vertcorner ? (-c->bw) : (c->h + c->bw - 1));
|
||||
@ -1703,17 +1512,6 @@ restack(Monitor *m)
|
||||
return;
|
||||
if (m->sel->isfloating || !m->lt[m->sellt]->arrange)
|
||||
XRaiseWindow(dpy, m->sel->win);
|
||||
|
||||
/* raise the aot window */
|
||||
for(Monitor *m_search = mons; m_search; m_search = m_search->next){
|
||||
for(c = m_search->clients; c; c = c->next){
|
||||
if(c->isalwaysontop){
|
||||
XRaiseWindow(dpy, c->win);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m->lt[m->sellt]->arrange) {
|
||||
wc.stack_mode = Below;
|
||||
wc.sibling = m->barwin;
|
||||
@ -1855,17 +1653,6 @@ 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)
|
||||
{
|
||||
@ -1901,9 +1688,16 @@ setup(void)
|
||||
int i;
|
||||
XSetWindowAttributes wa;
|
||||
Atom utf8string;
|
||||
struct sigaction sa;
|
||||
|
||||
/* clean up any zombies immediately */
|
||||
sigchld(0);
|
||||
/* do not transform children into zombies when they terminate */
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_flags = SA_NOCLDSTOP | SA_NOCLDWAIT | SA_RESTART;
|
||||
sa.sa_handler = SIG_IGN;
|
||||
sigaction(SIGCHLD, &sa, NULL);
|
||||
|
||||
/* clean up any zombies (inherited from .xinitrc etc) immediately */
|
||||
while (waitpid(-1, NULL, WNOHANG) > 0);
|
||||
|
||||
/* init screen */
|
||||
screen = DefaultScreen(dpy);
|
||||
@ -1915,8 +1709,6 @@ setup(void)
|
||||
die("no fonts could be loaded.");
|
||||
lrpad = drw->fonts->h + horizpadbar;
|
||||
bh = drw->fonts->h + vertpadbar;
|
||||
hpb = gappx;
|
||||
vpb = (topbar == 1) ? gappx : -gappx;
|
||||
updategeom();
|
||||
/* init atoms */
|
||||
utf8string = XInternAtom(dpy, "UTF8_STRING", False);
|
||||
@ -1999,21 +1791,23 @@ showhide(Client *c)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
sigchld(int unused)
|
||||
{
|
||||
if (signal(SIGCHLD, sigchld) == SIG_ERR)
|
||||
die("can't install SIGCHLD handler:");
|
||||
while (0 < waitpid(-1, NULL, WNOHANG));
|
||||
}
|
||||
|
||||
void
|
||||
spawn(const Arg *arg)
|
||||
{
|
||||
struct sigaction sa;
|
||||
|
||||
if (arg->v == dmenucmd)
|
||||
dmenumon[0] = '0' + selmon->num;
|
||||
if (fork() == 0) {
|
||||
if (dpy)
|
||||
close(ConnectionNumber(dpy));
|
||||
setsid();
|
||||
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_flags = 0;
|
||||
sa.sa_handler = SIG_DFL;
|
||||
sigaction(SIGCHLD, &sa, NULL);
|
||||
|
||||
execvp(((char **)arg->v)[0], (char **)arg->v);
|
||||
die("dwm: execvp '%s' failed:", ((char **)arg->v)[0]);
|
||||
}
|
||||
@ -2030,27 +1824,20 @@ tag(const Arg *arg)
|
||||
}
|
||||
|
||||
void
|
||||
tagmon(const Arg *arg)
|
||||
togglebar(const Arg *arg)
|
||||
{
|
||||
if (!selmon->sel || !mons->next)
|
||||
return;
|
||||
sendmon(selmon->sel, dirtomon(arg->i));
|
||||
selmon->showbar = selmon->pertag->showbars[selmon->pertag->curtag] = !selmon->showbar;
|
||||
updatebarpos(selmon);
|
||||
XMoveResizeWindow(dpy, selmon->barwin, selmon->wx + gappx, selmon->by + gappx, selmon->ww - 2 * gappx, bh);
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
void
|
||||
togglebar(const Arg *arg)
|
||||
toggleextrabar(const Arg *arg)
|
||||
{
|
||||
if (arg->i == 1 || arg->i == 0) {
|
||||
selmon->showbar = selmon->pertag->showbars[selmon->pertag->curtag] = !selmon->showbar;
|
||||
updatebarpos(selmon);
|
||||
XMoveResizeWindow(dpy, selmon->barwin, selmon->wx + hpb, selmon->by + vpb, selmon->ww - 2 * hpb, bh);
|
||||
}
|
||||
if (arg->i == 2 || arg->i == 0) {
|
||||
selmon->showextrabar = !selmon->showextrabar;
|
||||
updatebarpos(selmon);
|
||||
XMoveResizeWindow(dpy, selmon->extrabarwin, selmon->wx + hpb, selmon->eby - vpb, selmon->ww - 2 * hpb, bh);
|
||||
}
|
||||
|
||||
XMoveResizeWindow(dpy, selmon->extrabarwin, selmon->wx + gappx, selmon->eby - gappx, selmon->ww - 2 * gappx, bh);
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
@ -2065,8 +1852,6 @@ togglefloating(const Arg *arg)
|
||||
if (selmon->sel->isfloating)
|
||||
resize(selmon->sel, selmon->sel->x, selmon->sel->y,
|
||||
selmon->sel->w, selmon->sel->h, 0);
|
||||
else
|
||||
selmon->sel->isalwaysontop = 0; /* disabled, turn this off too */
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
@ -2077,29 +1862,6 @@ togglefullscr(const Arg *arg)
|
||||
setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
|
||||
}
|
||||
|
||||
void
|
||||
togglealwaysontop(const Arg *arg)
|
||||
{
|
||||
if (!selmon->sel)
|
||||
return;
|
||||
if (selmon->sel->isfullscreen)
|
||||
return;
|
||||
|
||||
if(selmon->sel->isalwaysontop){
|
||||
selmon->sel->isalwaysontop = 0;
|
||||
}else{
|
||||
/* disable others */
|
||||
for(Monitor *m = mons; m; m = m->next)
|
||||
for(Client *c = m->clients; c; c = c->next)
|
||||
c->isalwaysontop = 0;
|
||||
|
||||
/* turn on, make it float too */
|
||||
selmon->sel->isfloating = 1;
|
||||
selmon->sel->isalwaysontop = 1;
|
||||
}
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
void
|
||||
toggletag(const Arg *arg)
|
||||
{
|
||||
@ -2216,7 +1978,7 @@ updatebars(void)
|
||||
XClassHint ch = {"dwm", "dwm"};
|
||||
for (m = mons; m; m = m->next) {
|
||||
if (!m->barwin) {
|
||||
m->barwin = XCreateWindow(dpy, root, m->wx + hpb, m->by + vpb, m->ww - 2 * hpb, bh, 0, DefaultDepth(dpy, screen),
|
||||
m->barwin = XCreateWindow(dpy, root, m->wx + gappx, m->by + gappx, m->ww - 2 * gappx, bh, 0, DefaultDepth(dpy, screen),
|
||||
CopyFromParent, DefaultVisual(dpy, screen),
|
||||
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
|
||||
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
|
||||
@ -2224,13 +1986,21 @@ updatebars(void)
|
||||
XSetClassHint(dpy, m->barwin, &ch);
|
||||
}
|
||||
if (!m->extrabarwin) {
|
||||
m->extrabarwin = XCreateWindow(dpy, root, m->wx + hpb, m->eby - vpb, m->ww - 2 * hpb, bh, 0, DefaultDepth(dpy, screen),
|
||||
m->extrabarwin = XCreateWindow(dpy, root, m->wx + gappx, m->eby - gappx, m->ww - 2 * gappx, bh, 0, DefaultDepth(dpy, screen),
|
||||
CopyFromParent, DefaultVisual(dpy, screen),
|
||||
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
|
||||
XDefineCursor(dpy, m->extrabarwin, cursor[CurNormal]->cursor);
|
||||
XMapRaised(dpy, m->extrabarwin);
|
||||
XSetClassHint(dpy, m->extrabarwin, &ch);
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2239,23 +2009,23 @@ updatebarpos(Monitor *m)
|
||||
{
|
||||
m->wy = m->my;
|
||||
m->wh = m->mh;
|
||||
m->wh -= bh * m->showbar + bh * m->showextrabar;
|
||||
m->wy = m->showbar ? m->wy + bh + vpb : m->wy;
|
||||
m->wy = m->showbar ? m->wy + bh + gappx : m->wy;
|
||||
|
||||
if (m->showbar && m->showextrabar) {
|
||||
m->by = m->topbar ? m->wy - gappx - bh : m->wy + m->wh + gappx;
|
||||
m->eby = m->topbar ? m->wy + m->wh + gappx - vpb * 2 : m->wy - gappx - bh - vpb * 2;
|
||||
m->wy = topbar ? m->wy : m->wy - vpb * 2;
|
||||
m->wh = topbar ? m->wh - vpb * 2 : m->wh + vpb * 2;
|
||||
} else if (m->showbar || m->showextrabar) {
|
||||
m->by = m->topbar ? m->wy - gappx - bh : m->wy + m->wh + gappx;
|
||||
m->eby = m->topbar ? m->wy + m->wh + gappx - vpb : m->wy - gappx - bh - vpb;
|
||||
m->wy = topbar ? m->wy : m->wy - vpb;
|
||||
m->wh = topbar ? m->wh - vpb: m->wh + vpb;
|
||||
} else {
|
||||
m->by = -bh - vpb;
|
||||
m->eby = -bh + vpb;
|
||||
if (m->showbar) {
|
||||
m->wh -= bh * m->showbar;
|
||||
m->by = topbar ? m->wy - bh - gappx : m->wy + m->wh;
|
||||
m->wh = m->wh - gappx;
|
||||
}
|
||||
else
|
||||
m->by = topbar ? -bh - gappx : -bh + gappx;
|
||||
|
||||
if (m->showextrabar) {
|
||||
m->wh -= bh * m->showextrabar;
|
||||
m->eby = !topbar ? m->wy - bh - gappx : m->wy + m->wh;
|
||||
m->wh = m->wh - gappx;
|
||||
}
|
||||
else
|
||||
m->eby = !topbar ? -bh - gappx : -bh + gappx;
|
||||
}
|
||||
|
||||
void
|
||||
@ -2413,7 +2183,7 @@ updatesizehints(Client *c)
|
||||
void
|
||||
updatestatus(void)
|
||||
{
|
||||
char text[3072];
|
||||
char text[2048];
|
||||
if (!gettextprop(root, XA_WM_NAME, text, sizeof(text))) {
|
||||
strcpy(stext, "dwm-"VERSION);
|
||||
estext[0] = '\0';
|
||||
@ -2425,10 +2195,8 @@ updatestatus(void)
|
||||
} else {
|
||||
estext[0] = '\0';
|
||||
}
|
||||
|
||||
strncpy(stext, text, sizeof(stext) - 1);
|
||||
}
|
||||
|
||||
drawbar(selmon);
|
||||
}
|
||||
|
||||
@ -2491,8 +2259,7 @@ view(const Arg *arg)
|
||||
for (i = 0; !(arg->ui & 1 << i); i++) ;
|
||||
selmon->pertag->curtag = i + 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
tmptag = selmon->pertag->prevtag;
|
||||
selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
selmon->pertag->curtag = tmptag;
|
||||
@ -2577,17 +2344,6 @@ xerrorstart(Display *dpy, XErrorEvent *ee)
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
xrdb(const Arg *arg)
|
||||
{
|
||||
loadxrdb();
|
||||
int i;
|
||||
for (i = 0; i < LENGTH(colors); i++)
|
||||
scheme[i] = drw_scm_create(drw, colors[i], 3);
|
||||
focus(NULL);
|
||||
arrange(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
zoom(const Arg *arg)
|
||||
{
|
||||
@ -2612,8 +2368,6 @@ main(int argc, char *argv[])
|
||||
if (!(dpy = XOpenDisplay(NULL)))
|
||||
die("dwm: cannot open display");
|
||||
checkotherwm();
|
||||
XrmInitialize();
|
||||
loadxrdb();
|
||||
setup();
|
||||
#ifdef __OpenBSD__
|
||||
if (pledge("stdio rpath proc exec", NULL) == -1)
|
||||
|
107
layouts.c
107
layouts.c
@ -1,32 +1,46 @@
|
||||
// TODO: FIX GAPS IN GRID LAYOUT
|
||||
void
|
||||
grid(Monitor *m) {
|
||||
unsigned int i, n, cx, cy, cw, ch, aw, ah, cols, rows;
|
||||
tile(Monitor *m)
|
||||
{
|
||||
unsigned int i, n, h, mw, my, ty;
|
||||
Client *c;
|
||||
|
||||
for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next))
|
||||
n++;
|
||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
/* grid dimensions */
|
||||
for(rows = 0; rows <= n/2; rows++)
|
||||
if(rows*rows >= n)
|
||||
break;
|
||||
cols = (rows && (rows - 1) * rows >= n) ? rows - 1 : rows;
|
||||
|
||||
/* window geoms (cell height/width) */
|
||||
ch = (m->wh - m->gappx) / (rows ? rows : 1);
|
||||
cw = (m->ww - m->gappx) / (cols ? cols : 1);
|
||||
for(i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next)) {
|
||||
cx = m->wx + (i / rows) * cw;
|
||||
cy = m->wy + (i % rows) * ch;
|
||||
/* adjust height/width of last row/column's windows */
|
||||
ah = ((i + 1) % rows == 0) ? m->wh - m->gappx * (rows + 1) - ch * rows : 0;
|
||||
aw = (i >= rows * (cols - 1)) ? m->ww - m->gappx * (cols + 1) - cw * cols : 0;
|
||||
resize(c, cx + m->gappx * (i / rows + 1), cy + m->gappx * (i % rows + 1), cw - 2 * c->bw + aw, ch - 2 * c->bw + ah, False);
|
||||
i++;
|
||||
if (n > m->nmaster)
|
||||
mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||
else
|
||||
mw = m->ww - gappx;
|
||||
for (i = 0, my = ty = gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
if (i < m->nmaster) {
|
||||
h = (m->wh - my) / (MIN(n, m->nmaster) - i) - gappx;
|
||||
resize(c, m->wx + gappx, m->wy + my, mw - (2*c->bw) - gappx, h - (2*c->bw), 0);
|
||||
if (my + HEIGHT(c) + gappx < m->wh)
|
||||
my += HEIGHT(c) + gappx;
|
||||
} else {
|
||||
h = (m->wh - ty) / (n - i) - gappx;
|
||||
resize(c, m->wx + mw + gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*gappx, h - (2*c->bw), 0);
|
||||
if (ty + HEIGHT(c) + gappx < m->wh)
|
||||
ty += HEIGHT(c) + gappx;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
monocle(Monitor *m)
|
||||
{
|
||||
unsigned int n = 0;
|
||||
Client *c;
|
||||
|
||||
for (c = m->clients; c; c = c->next)
|
||||
if (ISVISIBLE(c))
|
||||
n++;
|
||||
if (n > 0) /* override layout symbol */
|
||||
snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
|
||||
for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
|
||||
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
|
||||
}
|
||||
|
||||
void
|
||||
gaplessgrid(Monitor *m) {
|
||||
unsigned int n, cols, rows, cn, rn, i, cx, cy, cw, ch;
|
||||
@ -45,16 +59,16 @@ gaplessgrid(Monitor *m) {
|
||||
rows = n/cols;
|
||||
|
||||
/* window geometries */
|
||||
cw = cols ? (m->ww - m->gappx) / cols : m->ww - m->gappx;
|
||||
cw = cols ? (m->ww - gappx) / cols : m->ww - gappx;
|
||||
cn = 0; /* current column number */
|
||||
rn = 0; /* current row number */
|
||||
for(i = 0, c = nexttiled(m->clients); c; i++, c = nexttiled(c->next)) {
|
||||
if(i/rows + 1 > cols - n%cols)
|
||||
rows = n/cols + 1;
|
||||
ch = rows ? (m->wh - m->gappx) / rows : m->wh - m->gappx;
|
||||
ch = rows ? (m->wh - gappx) / rows : m->wh - gappx;
|
||||
cx = m->wx + cn*cw;
|
||||
cy = m->wy + rn*ch;
|
||||
resize(c, cx + m->gappx, cy + m->gappx, cw - 2 * c->bw - m->gappx, ch - 2 * c->bw - m->gappx, False);
|
||||
resize(c, cx + gappx, cy + gappx, cw - 2 * c->bw - gappx, ch - 2 * c->bw - gappx, False);
|
||||
rn++;
|
||||
if(rn >= rows) {
|
||||
rn = 0;
|
||||
@ -62,46 +76,3 @@ gaplessgrid(Monitor *m) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tile(Monitor *m)
|
||||
{
|
||||
unsigned int i, n, h, mw, my, ty;
|
||||
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;
|
||||
else
|
||||
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) - 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) - 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;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
monocle(Monitor *m)
|
||||
{
|
||||
unsigned int n = 0;
|
||||
Client *c;
|
||||
|
||||
for (c = m->clients; c; c = c->next)
|
||||
if (ISVISIBLE(c))
|
||||
n++;
|
||||
if (n > 0) /* override layout symbol */
|
||||
snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
|
||||
for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
|
||||
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user