Compare commits
25 Commits
Author | SHA1 | Date |
---|---|---|
altffour | d4d4a8caf9 | |
realaltffour | 56b5a9f958 | |
altffour | a752b1b237 | |
altffour | 00574da349 | |
altffour | 2b480b5562 | |
altffour | c4f02778e7 | |
altffour | 5f5c7bedc0 | |
altffour | 7b996bd528 | |
altffour | 2b8e170bc5 | |
realaltffour | 44ae2e4c7f | |
realaltffour | f21eb96261 | |
realaltffour | 1622204a34 | |
realaltffour | 2ec5aff8b6 | |
realaltffour | 049c4e1f66 | |
realaltffour | 1c509d1e52 | |
realaltffour | cc937128ea | |
realaltffour | d329aaa2b4 | |
realaltffour | 57f78bf9dd | |
realaltffour | b3752ff756 | |
realaltffour | 585be283d3 | |
realaltffour | aa76446478 | |
realaltffour | 3136d7789b | |
realaltffour | 164d7179ed | |
realaltffour | af66a53e65 | |
realaltffour | a00158cf00 |
|
@ -0,0 +1,52 @@
|
|||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Object files
|
||||
*.o
|
||||
*.ko
|
||||
*.obj
|
||||
*.elf
|
||||
|
||||
# Linker output
|
||||
*.ilk
|
||||
*.map
|
||||
*.exp
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Libraries
|
||||
*.lib
|
||||
*.a
|
||||
*.la
|
||||
*.lo
|
||||
|
||||
# Shared objects (inc. Windows DLLs)
|
||||
*.dll
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
*.i*86
|
||||
*.x86_64
|
||||
*.hex
|
||||
|
||||
# Debug files
|
||||
*.dSYM/
|
||||
*.su
|
||||
*.idb
|
||||
*.pdb
|
||||
|
||||
# Kernel Module Compile Results
|
||||
*.mod*
|
||||
*.cmd
|
||||
.tmp_versions/
|
||||
modules.order
|
||||
Module.symvers
|
||||
Mkfile.old
|
||||
dkms.conf
|
|
@ -1,115 +1,183 @@
|
|||
|
||||
/* See LICENSE file for copyright and license details. */
|
||||
#include <X11/XF86keysym.h>
|
||||
|
||||
/* appearance */
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
static const unsigned int snap = 32; /* snap pixel */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
static const char *fonts[] = { "monospace:size=10" };
|
||||
static const char dmenufont[] = "monospace:size=10";
|
||||
static const char col_gray1[] = "#222222";
|
||||
static const char col_gray2[] = "#444444";
|
||||
static const char col_gray3[] = "#bbbbbb";
|
||||
static const char col_gray4[] = "#eeeeee";
|
||||
static const char col_cyan[] = "#005577";
|
||||
static const char *colors[][3] = {
|
||||
/* fg bg border */
|
||||
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
|
||||
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
static const unsigned int gappx = 0; /* gaps between windows */
|
||||
static const unsigned int snap = 16; /* snap pixel */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
static const char *fonts[] = {"Anonymice Nerd Font:size=10"};
|
||||
static const char dmenufont[] = "Anonymice Nerd Font:size=10";
|
||||
static const char col_gray1[] = "#222222";
|
||||
static const char col_gray2[] = "#444444";
|
||||
static const char col_gray3[] = "#bbbbbb";
|
||||
static const char col_gray4[] = "#eeeeee";
|
||||
static const char col_cyan[] = "#005577";
|
||||
static const char *colors[][3] = {
|
||||
/* fg bg border */
|
||||
[SchemeNorm] = {col_gray3, col_gray1, col_gray2},
|
||||
[SchemeSel] = {col_gray4, col_cyan, col_cyan},
|
||||
[SchemeHid] = {col_cyan, col_gray1, col_cyan},
|
||||
};
|
||||
|
||||
/* tagging */
|
||||
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||
static const char *tags[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9"};
|
||||
|
||||
static const Rule rules[] = {
|
||||
/* xprop(1):
|
||||
* WM_CLASS(STRING) = instance, class
|
||||
* WM_NAME(STRING) = title
|
||||
*/
|
||||
/* class instance title tags mask isfloating monitor */
|
||||
{ "Gimp", NULL, NULL, 0, 1, -1 },
|
||||
{ "Firefox", NULL, NULL, 1 << 8, 0, -1 },
|
||||
/* xprop(1):
|
||||
* WM_CLASS(STRING) = instance, class
|
||||
* WM_NAME(STRING) = title
|
||||
*/
|
||||
/* class instance title tags mask isfloating monitor */
|
||||
{"Gimp", NULL, NULL, 0, 1, -1},
|
||||
{"Firefox", NULL, NULL, 1 << 8, 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 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 Layout layouts[] = {
|
||||
/* symbol arrange function */
|
||||
{ "[]=", tile }, /* first entry is default */
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
{ "[M]", monocle },
|
||||
/* symbol arrange function */
|
||||
{"[]=", tile}, /* first entry is default */
|
||||
{"><>", NULL}, /* no layout function means floating behavior */
|
||||
{"[M]", monocle},
|
||||
{"TTT", bstack},
|
||||
{"===", bstackhoriz},
|
||||
{"|M|", centeredmaster},
|
||||
{">M>", centeredfloatingmaster},
|
||||
};
|
||||
|
||||
/* key definitions */
|
||||
#define MODKEY Mod1Mask
|
||||
#define TAGKEYS(KEY,TAG) \
|
||||
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
|
||||
#define MODKEY Mod4Mask
|
||||
#define TAGKEYS(KEY, TAG) \
|
||||
{MODKEY, KEY, view, {.ui = 1 << TAG}}, \
|
||||
{MODKEY | ControlMask, KEY, toggleview, {.ui = 1 << TAG}}, \
|
||||
{MODKEY | ShiftMask, KEY, tag, {.ui = 1 << TAG}}, \
|
||||
{MODKEY | 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 } }
|
||||
#define SHCMD(cmd) \
|
||||
{ \
|
||||
.v = (const char *[]) { "/bin/sh", "-c", cmd, NULL } \
|
||||
}
|
||||
|
||||
/* 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[] = { "st", 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 *passmenucmd[] = {"passmenu", NULL};
|
||||
static const char *greenclip[] = {"rofi",
|
||||
"-theme",
|
||||
"solarized",
|
||||
"-font",
|
||||
"hack 11",
|
||||
"-modi",
|
||||
"clipboard:greenclip print",
|
||||
"-show",
|
||||
"clipboard",
|
||||
"-run-command",
|
||||
"'{cmd}'"};
|
||||
static const char *rofi_calc[] = {"rofi", "-theme", "solarized",
|
||||
"-font", "hack 11", "-show",
|
||||
"calc", "-no-show-match", "-no-sort"};
|
||||
static const char *termcmd[] = {"alacritty", NULL};
|
||||
|
||||
static const char *volmute[] = {"amixer", "-q", "set",
|
||||
"Master", "toggle", NULL};
|
||||
static const char *volup[] = {"amixer", "-q", "set", "Master",
|
||||
"5%+", "unmute", NULL};
|
||||
static const char *voldown[] = {"amixer", "-q", "set", "Master",
|
||||
"5%-", "unmute", NULL};
|
||||
|
||||
static const char *brupcmd[] = {"xbacklight", "-inc", "5%", NULL};
|
||||
static const char *brdowncmd[] = {"xbacklight", "-dec", "5%", NULL};
|
||||
static const char *lockcmd[] = {"slock", NULL};
|
||||
|
||||
static const char *playplaypause[] = {"playerctl", "play-pause"};
|
||||
static const char *playnext[] = {"playerctl", "next"};
|
||||
static const char *playprev[] = {"playerctl", "previous"};
|
||||
|
||||
static const char *browser[] = {"firefox", NULL};
|
||||
|
||||
static const char *screenshot[] = {"flameshot", "gui", NULL};
|
||||
|
||||
static Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
||||
{ MODKEY, XK_b, togglebar, {0} },
|
||||
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
||||
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
|
||||
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||
{ MODKEY, XK_Return, zoom, {0} },
|
||||
{ MODKEY, XK_Tab, view, {0} },
|
||||
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
||||
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||
{ MODKEY, XK_space, setlayout, {0} },
|
||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
||||
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||
TAGKEYS( XK_1, 0)
|
||||
TAGKEYS( XK_2, 1)
|
||||
TAGKEYS( XK_3, 2)
|
||||
TAGKEYS( XK_4, 3)
|
||||
TAGKEYS( XK_5, 4)
|
||||
TAGKEYS( XK_6, 5)
|
||||
TAGKEYS( XK_7, 6)
|
||||
TAGKEYS( XK_8, 7)
|
||||
TAGKEYS( XK_9, 8)
|
||||
{ MODKEY|ShiftMask, XK_q, quit, {0} },
|
||||
/* modifier key function argument */
|
||||
{MODKEY, XK_u, spawn, {.v = dmenucmd}},
|
||||
{MODKEY, XK_p, spawn, {.v = passmenucmd}},
|
||||
{MODKEY | ShiftMask, XK_u, spawn, {.v = greenclip}},
|
||||
{MODKEY | ShiftMask, XK_a, spawn, {.v = rofi_calc}},
|
||||
{MODKEY, XK_Return, spawn, {.v = termcmd}},
|
||||
{MODKEY | ShiftMask, XK_s, spawn, {.v = lockcmd}},
|
||||
{MODKEY | ShiftMask, XK_d, spawn, {.v = screenshot}},
|
||||
{MODKEY, XK_b, togglebar, {0}},
|
||||
{MODKEY, XK_j, focusstack, {.i = +1}},
|
||||
{MODKEY, XK_k, focusstack, {.i = -1}},
|
||||
{MODKEY, XK_greater, incnmaster, {.i = +1}},
|
||||
{MODKEY, XK_less, incnmaster, {.i = -1}},
|
||||
{MODKEY, XK_h, setmfact, {.f = -0.05}},
|
||||
{MODKEY, XK_l, setmfact, {.f = +0.05}},
|
||||
{MODKEY, XK_z, zoom, {0}},
|
||||
{MODKEY, XK_Tab, view, {0}},
|
||||
{MODKEY | ShiftMask, XK_c, 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_y, setlayout, {.v = &layouts[3]}},
|
||||
{MODKEY | ShiftMask, XK_y, setlayout, {.v = &layouts[4]}},
|
||||
{MODKEY, XK_i, setlayout, {.v = &layouts[5]}},
|
||||
{MODKEY | ShiftMask, XK_i, setlayout, {.v = &layouts[6]}},
|
||||
{MODKEY, XK_space, setlayout, {0}},
|
||||
{MODKEY | ShiftMask, XK_space, togglefloating, {0}},
|
||||
{MODKEY, XK_0, view, {.ui = ~0}},
|
||||
{MODKEY | ShiftMask, XK_0, tag, {.ui = ~0}},
|
||||
{MODKEY, XK_comma, focusmon, {.i = -1}},
|
||||
{MODKEY, XK_period, focusmon, {.i = +1}},
|
||||
{MODKEY | ShiftMask, XK_comma, tagmon, {.i = -1}},
|
||||
{MODKEY | ShiftMask, XK_period, tagmon, {.i = +1}},
|
||||
{MODKEY, XK_minus, setgaps, {.i = -1}},
|
||||
{MODKEY, XK_equal, setgaps, {.i = +1}},
|
||||
{MODKEY | ShiftMask, XK_equal, setgaps, {.i = 0}},
|
||||
{MODKEY, XK_w, spawn, {.v = browser}},
|
||||
{MODKEY | ControlMask, XK_j, pushdown, {0}},
|
||||
{MODKEY | ControlMask, XK_k, pushup, {0}},
|
||||
TAGKEYS(XK_1, 0) TAGKEYS(XK_2, 1) TAGKEYS(XK_3, 2) TAGKEYS(XK_4, 3)
|
||||
TAGKEYS(XK_5, 4) TAGKEYS(XK_6, 5) TAGKEYS(XK_7, 6) TAGKEYS(XK_8, 7)
|
||||
TAGKEYS(XK_9, 8){MODKEY | ShiftMask, XK_q, quit, {0}},
|
||||
{0, XF86XK_AudioRaiseVolume, spawn, {.v = volup}},
|
||||
{0, XF86XK_AudioLowerVolume, spawn, {.v = voldown}},
|
||||
{0, XF86XK_AudioMute, spawn, {.v = volmute}},
|
||||
{0, XF86XK_MonBrightnessUp, spawn, {.v = brupcmd}},
|
||||
{0, XF86XK_MonBrightnessDown, spawn, {.v = brdowncmd}},
|
||||
{0, XF86XK_AudioPlay, spawn, {.v = playplaypause}},
|
||||
{0, XF86XK_AudioNext, spawn, {.v = playnext}},
|
||||
{0, XF86XK_AudioPrev, spawn, {.v = playprev}},
|
||||
};
|
||||
|
||||
/* button definitions */
|
||||
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
|
||||
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
|
||||
* ClkClientWin, or ClkRootWin */
|
||||
static Button buttons[] = {
|
||||
/* click event mask button function argument */
|
||||
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
||||
{ ClkWinTitle, 0, Button2, zoom, {0} },
|
||||
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
||||
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
||||
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
||||
{ ClkTagBar, 0, Button1, view, {0} },
|
||||
{ ClkTagBar, 0, Button3, toggleview, {0} },
|
||||
{ ClkTagBar, MODKEY, Button1, tag, {0} },
|
||||
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
|
||||
/* click event mask button function argument
|
||||
*/
|
||||
{ClkLtSymbol, 0, Button1, setlayout, {0}},
|
||||
{ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]}},
|
||||
{ClkWinTitle, 0, Button1, togglewin, {0}},
|
||||
{ClkWinTitle, 0, Button2, zoom, {0}},
|
||||
{ClkStatusText, 0, Button2, spawn, {.v = termcmd}},
|
||||
{ClkClientWin, MODKEY, Button1, movemouse, {0}},
|
||||
{ClkClientWin, MODKEY, Button2, togglefloating, {0}},
|
||||
{ClkClientWin, MODKEY, Button3, resizemouse, {0}},
|
||||
{ClkTagBar, 0, Button1, view, {0}},
|
||||
{ClkTagBar, 0, Button3, toggleview, {0}},
|
||||
{ClkTagBar, MODKEY, Button1, tag, {0}},
|
||||
{ClkTagBar, MODKEY, Button3, toggletag, {0}},
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,183 @@
|
|||
|
||||
/* See LICENSE file for copyright and license details. */
|
||||
#include <X11/XF86keysym.h>
|
||||
|
||||
/* appearance */
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
static const unsigned int gappx = 0; /* gaps between windows */
|
||||
static const unsigned int snap = 16; /* snap pixel */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
static const char *fonts[] = {"Anonymice Nerd Font:size=10"};
|
||||
static const char dmenufont[] = "Anonymice Nerd Font:size=10";
|
||||
static const char col_gray1[] = "#222222";
|
||||
static const char col_gray2[] = "#444444";
|
||||
static const char col_gray3[] = "#bbbbbb";
|
||||
static const char col_gray4[] = "#eeeeee";
|
||||
static const char col_cyan[] = "#005577";
|
||||
static const char *colors[][3] = {
|
||||
/* fg bg border */
|
||||
[SchemeNorm] = {col_gray3, col_gray1, col_gray2},
|
||||
[SchemeSel] = {col_gray4, col_cyan, col_cyan},
|
||||
[SchemeHid] = {col_cyan, col_gray1, col_cyan},
|
||||
};
|
||||
|
||||
/* tagging */
|
||||
static const char *tags[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9"};
|
||||
|
||||
static const Rule rules[] = {
|
||||
/* xprop(1):
|
||||
* WM_CLASS(STRING) = instance, class
|
||||
* WM_NAME(STRING) = title
|
||||
*/
|
||||
/* class instance title tags mask isfloating monitor */
|
||||
{"Gimp", NULL, NULL, 0, 1, -1},
|
||||
{"Firefox", NULL, NULL, 1 << 8, 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 Layout layouts[] = {
|
||||
/* symbol arrange function */
|
||||
{"[]=", tile}, /* first entry is default */
|
||||
{"><>", NULL}, /* no layout function means floating behavior */
|
||||
{"[M]", monocle},
|
||||
{"TTT", bstack},
|
||||
{"===", bstackhoriz},
|
||||
{"|M|", centeredmaster},
|
||||
{">M>", centeredfloatingmaster},
|
||||
};
|
||||
|
||||
/* key definitions */
|
||||
#define MODKEY Mod4Mask
|
||||
#define TAGKEYS(KEY, TAG) \
|
||||
{MODKEY, KEY, view, {.ui = 1 << TAG}}, \
|
||||
{MODKEY | ControlMask, KEY, toggleview, {.ui = 1 << TAG}}, \
|
||||
{MODKEY | ShiftMask, KEY, tag, {.ui = 1 << TAG}}, \
|
||||
{MODKEY | 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 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 *passmenucmd[] = {"passmenu", NULL};
|
||||
static const char *greenclip[] = {"rofi",
|
||||
"-theme",
|
||||
"solarized",
|
||||
"-font",
|
||||
"hack 11",
|
||||
"-modi",
|
||||
"clipboard:greenclip print",
|
||||
"-show",
|
||||
"clipboard",
|
||||
"-run-command",
|
||||
"'{cmd}'"};
|
||||
static const char *rofi_calc[] = {"rofi", "-theme", "solarized",
|
||||
"-font", "hack 11", "-show",
|
||||
"calc", "-no-show-match", "-no-sort"};
|
||||
static const char *termcmd[] = {"alacritty", NULL};
|
||||
|
||||
static const char *volmute[] = {"amixer", "-q", "set",
|
||||
"Master", "toggle", NULL};
|
||||
static const char *volup[] = {"amixer", "-q", "set", "Master",
|
||||
"5%+", "unmute", NULL};
|
||||
static const char *voldown[] = {"amixer", "-q", "set", "Master",
|
||||
"5%-", "unmute", NULL};
|
||||
|
||||
static const char *brupcmd[] = {"xbacklight", "-inc", "5%", NULL};
|
||||
static const char *brdowncmd[] = {"xbacklight", "-dec", "5%", NULL};
|
||||
static const char *lockcmd[] = {"slock", NULL};
|
||||
|
||||
static const char *playplaypause[] = {"playerctl", "play-pause"};
|
||||
static const char *playnext[] = {"playerctl", "next"};
|
||||
static const char *playprev[] = {"playerctl", "previous"};
|
||||
|
||||
static const char *browser[] = {"firefox", NULL};
|
||||
|
||||
static const char *screenshot[] = {"flameshot", "gui", NULL};
|
||||
|
||||
static Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
{MODKEY, XK_u, spawn, {.v = dmenucmd}},
|
||||
{MODKEY, XK_p, spawn, {.v = passmenucmd}},
|
||||
{MODKEY | ShiftMask, XK_u, spawn, {.v = greenclip}},
|
||||
{MODKEY | ShiftMask, XK_a, spawn, {.v = rofi_calc}},
|
||||
{MODKEY, XK_Return, spawn, {.v = termcmd}},
|
||||
{MODKEY | ShiftMask, XK_s, spawn, {.v = lockcmd}},
|
||||
{MODKEY | ShiftMask, XK_d, spawn, {.v = screenshot}},
|
||||
{MODKEY, XK_b, togglebar, {0}},
|
||||
{MODKEY, XK_j, focusstack, {.i = +1}},
|
||||
{MODKEY, XK_k, focusstack, {.i = -1}},
|
||||
{MODKEY, XK_greater, incnmaster, {.i = +1}},
|
||||
{MODKEY, XK_less, incnmaster, {.i = -1}},
|
||||
{MODKEY, XK_h, setmfact, {.f = -0.05}},
|
||||
{MODKEY, XK_l, setmfact, {.f = +0.05}},
|
||||
{MODKEY, XK_z, zoom, {0}},
|
||||
{MODKEY, XK_Tab, view, {0}},
|
||||
{MODKEY | ShiftMask, XK_c, 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_y, setlayout, {.v = &layouts[3]}},
|
||||
{MODKEY | ShiftMask, XK_y, setlayout, {.v = &layouts[4]}},
|
||||
{MODKEY, XK_i, setlayout, {.v = &layouts[5]}},
|
||||
{MODKEY | ShiftMask, XK_i, setlayout, {.v = &layouts[6]}},
|
||||
{MODKEY, XK_space, setlayout, {0}},
|
||||
{MODKEY | ShiftMask, XK_space, togglefloating, {0}},
|
||||
{MODKEY, XK_0, view, {.ui = ~0}},
|
||||
{MODKEY | ShiftMask, XK_0, tag, {.ui = ~0}},
|
||||
{MODKEY, XK_comma, focusmon, {.i = -1}},
|
||||
{MODKEY, XK_period, focusmon, {.i = +1}},
|
||||
{MODKEY | ShiftMask, XK_comma, tagmon, {.i = -1}},
|
||||
{MODKEY | ShiftMask, XK_period, tagmon, {.i = +1}},
|
||||
{MODKEY, XK_minus, setgaps, {.i = -1}},
|
||||
{MODKEY, XK_equal, setgaps, {.i = +1}},
|
||||
{MODKEY | ShiftMask, XK_equal, setgaps, {.i = 0}},
|
||||
{MODKEY, XK_w, spawn, {.v = browser}},
|
||||
{MODKEY | ControlMask, XK_j, pushdown, {0}},
|
||||
{MODKEY | ControlMask, XK_k, pushup, {0}},
|
||||
TAGKEYS(XK_1, 0) TAGKEYS(XK_2, 1) TAGKEYS(XK_3, 2) TAGKEYS(XK_4, 3)
|
||||
TAGKEYS(XK_5, 4) TAGKEYS(XK_6, 5) TAGKEYS(XK_7, 6) TAGKEYS(XK_8, 7)
|
||||
TAGKEYS(XK_9, 8){MODKEY | ShiftMask, XK_q, quit, {0}},
|
||||
{0, XF86XK_AudioRaiseVolume, spawn, {.v = volup}},
|
||||
{0, XF86XK_AudioLowerVolume, spawn, {.v = voldown}},
|
||||
{0, XF86XK_AudioMute, spawn, {.v = volmute}},
|
||||
{0, XF86XK_MonBrightnessUp, spawn, {.v = brupcmd}},
|
||||
{0, XF86XK_MonBrightnessDown, spawn, {.v = brdowncmd}},
|
||||
{0, XF86XK_AudioPlay, spawn, {.v = playplaypause}},
|
||||
{0, XF86XK_AudioNext, spawn, {.v = playnext}},
|
||||
{0, XF86XK_AudioPrev, spawn, {.v = playprev}},
|
||||
};
|
||||
|
||||
/* button definitions */
|
||||
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
|
||||
* ClkClientWin, or ClkRootWin */
|
||||
static Button buttons[] = {
|
||||
/* click event mask button function argument
|
||||
*/
|
||||
{ClkLtSymbol, 0, Button1, setlayout, {0}},
|
||||
{ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]}},
|
||||
{ClkWinTitle, 0, Button1, togglewin, {0}},
|
||||
{ClkWinTitle, 0, Button2, zoom, {0}},
|
||||
{ClkStatusText, 0, Button2, spawn, {.v = termcmd}},
|
||||
{ClkClientWin, MODKEY, Button1, movemouse, {0}},
|
||||
{ClkClientWin, MODKEY, Button2, togglefloating, {0}},
|
||||
{ClkClientWin, MODKEY, Button3, resizemouse, {0}},
|
||||
{ClkTagBar, 0, Button1, view, {0}},
|
||||
{ClkTagBar, 0, Button3, toggleview, {0}},
|
||||
{ClkTagBar, MODKEY, Button1, tag, {0}},
|
||||
{ClkTagBar, MODKEY, Button3, toggletag, {0}},
|
||||
};
|
||||
|
|
@ -50,6 +50,7 @@
|
|||
#define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \
|
||||
* MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy)))
|
||||
#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]))
|
||||
#define HIDDEN(C) ((getstate(C->win) == IconicState))
|
||||
#define LENGTH(X) (sizeof X / sizeof X[0])
|
||||
#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
|
||||
#define WIDTH(X) ((X)->w + 2 * (X)->bw)
|
||||
|
@ -59,7 +60,7 @@
|
|||
|
||||
/* enums */
|
||||
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
|
||||
enum { SchemeNorm, SchemeSel }; /* color schemes */
|
||||
enum { SchemeNorm, SchemeSel, SchemeHid }; /* color schemes */
|
||||
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
|
||||
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
|
||||
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
|
||||
|
@ -111,14 +112,18 @@ 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 btw; /* width of tasks portion of bar */
|
||||
int bt; /* number of tasks */
|
||||
int mx, my, mw, mh; /* screen size */
|
||||
int wx, wy, ww, wh; /* window area */
|
||||
int gappx; /* gaps between windows */
|
||||
unsigned int seltags;
|
||||
unsigned int sellt;
|
||||
unsigned int tagset[2];
|
||||
|
@ -130,6 +135,7 @@ struct Monitor {
|
|||
Monitor *next;
|
||||
Window barwin;
|
||||
const Layout *lt[2];
|
||||
Pertag *pertag;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
@ -174,6 +180,7 @@ static long getstate(Window w);
|
|||
static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
|
||||
static void grabbuttons(Client *c, int focused);
|
||||
static void grabkeys(void);
|
||||
static void hide(Client *c);
|
||||
static void incnmaster(const Arg *arg);
|
||||
static void keypress(XEvent *e);
|
||||
static void killclient(const Arg *arg);
|
||||
|
@ -185,7 +192,10 @@ static void motionnotify(XEvent *e);
|
|||
static void movemouse(const Arg *arg);
|
||||
static Client *nexttiled(Client *c);
|
||||
static void pop(Client *);
|
||||
static Client *prevtiled(Client *c);
|
||||
static void propertynotify(XEvent *e);
|
||||
static void pushdown(const Arg *arg);
|
||||
static void pushup(const Arg *arg);
|
||||
static void quit(const Arg *arg);
|
||||
static Monitor *recttomon(int x, int y, int w, int h);
|
||||
static void resize(Client *c, int x, int y, int w, int h, int interact);
|
||||
|
@ -193,16 +203,19 @@ static void resizeclient(Client *c, int x, int y, int w, int h);
|
|||
static void resizemouse(const Arg *arg);
|
||||
static void restack(Monitor *m);
|
||||
static void run(void);
|
||||
static void runAutostart(void);
|
||||
static void scan(void);
|
||||
static int sendevent(Client *c, Atom proto);
|
||||
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 show(Client *c);
|
||||
static void showhide(Client *c);
|
||||
static void sigchld(int unused);
|
||||
static void spawn(const Arg *arg);
|
||||
|
@ -213,6 +226,7 @@ static void togglebar(const Arg *arg);
|
|||
static void togglefloating(const Arg *arg);
|
||||
static void toggletag(const Arg *arg);
|
||||
static void toggleview(const Arg *arg);
|
||||
static void togglewin(const Arg *arg);
|
||||
static void unfocus(Client *c, int setfocus);
|
||||
static void unmanage(Client *c, int destroyed);
|
||||
static void unmapnotify(XEvent *e);
|
||||
|
@ -233,6 +247,10 @@ static int xerror(Display *dpy, XErrorEvent *ee);
|
|||
static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
||||
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||
static void zoom(const Arg *arg);
|
||||
static void bstack(Monitor *m);
|
||||
static void bstackhoriz(Monitor *m);
|
||||
static void centeredmaster(Monitor *m);
|
||||
static void centeredfloatingmaster(Monitor *m);
|
||||
|
||||
/* variables */
|
||||
static const char broken[] = "broken";
|
||||
|
@ -271,6 +289,15 @@ static Window root, wmcheckwin;
|
|||
/* configuration, allows nested code to access above variables */
|
||||
#include "config.h"
|
||||
|
||||
struct Pertag {
|
||||
unsigned int curtag, prevtag; /* current and previous tag */
|
||||
int nmasters[LENGTH(tags) + 1]; /* number of windows in master area */
|
||||
float mfacts[LENGTH(tags) + 1]; /* mfacts per tag */
|
||||
unsigned int sellts[LENGTH(tags) + 1]; /* selected layouts */
|
||||
const Layout *ltidxs[LENGTH(tags) + 1][2]; /* matrix of tags and layouts indexes */
|
||||
int showbars[LENGTH(tags) + 1]; /* display bar for the current tag */
|
||||
};
|
||||
|
||||
/* compile-time check if all tags fit into an unsigned int bit array. */
|
||||
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
|
||||
|
||||
|
@ -439,10 +466,25 @@ buttonpress(XEvent *e)
|
|||
arg.ui = 1 << i;
|
||||
} else if (ev->x < x + blw)
|
||||
click = ClkLtSymbol;
|
||||
else if (ev->x > selmon->ww - TEXTW(stext))
|
||||
/* 2px right padding */
|
||||
else if (ev->x > selmon->ww - TEXTW(stext) + lrpad - 2)
|
||||
click = ClkStatusText;
|
||||
else
|
||||
click = ClkWinTitle;
|
||||
else {
|
||||
x += blw;
|
||||
c = m->clients;
|
||||
|
||||
do {
|
||||
if (!ISVISIBLE(c))
|
||||
continue;
|
||||
else
|
||||
x += (1.0 / (double)m->bt) * m->btw;
|
||||
} while (ev->x > x && (c = c->next));
|
||||
|
||||
if (c) {
|
||||
click = ClkWinTitle;
|
||||
arg.v = c;
|
||||
}
|
||||
}
|
||||
} else if ((c = wintoclient(ev->window))) {
|
||||
focus(c);
|
||||
restack(selmon);
|
||||
|
@ -452,7 +494,7 @@ buttonpress(XEvent *e)
|
|||
for (i = 0; i < LENGTH(buttons); i++)
|
||||
if (click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button
|
||||
&& CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state))
|
||||
buttons[i].func(click == ClkTagBar && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg);
|
||||
buttons[i].func((click == ClkTagBar || click == ClkWinTitle) && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -631,6 +673,7 @@ Monitor *
|
|||
createmon(void)
|
||||
{
|
||||
Monitor *m;
|
||||
unsigned int i;
|
||||
|
||||
m = ecalloc(1, sizeof(Monitor));
|
||||
m->tagset[0] = m->tagset[1] = 1;
|
||||
|
@ -638,9 +681,24 @@ createmon(void)
|
|||
m->nmaster = nmaster;
|
||||
m->showbar = showbar;
|
||||
m->topbar = topbar;
|
||||
m->gappx = gappx;
|
||||
m->lt[0] = &layouts[0];
|
||||
m->lt[1] = &layouts[1 % LENGTH(layouts)];
|
||||
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
|
||||
m->pertag = ecalloc(1, sizeof(Pertag));
|
||||
m->pertag->curtag = m->pertag->prevtag = 1;
|
||||
|
||||
for (i = 0; i <= LENGTH(tags); i++) {
|
||||
m->pertag->nmasters[i] = m->nmaster;
|
||||
m->pertag->mfacts[i] = m->mfact;
|
||||
|
||||
m->pertag->ltidxs[i][0] = m->lt[0];
|
||||
m->pertag->ltidxs[i][1] = m->lt[1];
|
||||
m->pertag->sellts[i] = m->sellt;
|
||||
|
||||
m->pertag->showbars[i] = m->showbar;
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
|
@ -695,9 +753,8 @@ dirtomon(int dir)
|
|||
void
|
||||
drawbar(Monitor *m)
|
||||
{
|
||||
int x, w, sw = 0;
|
||||
int boxs = drw->fonts->h / 9;
|
||||
int boxw = drw->fonts->h / 6 + 2;
|
||||
int x, w, sw = 0, n = 0, scm;
|
||||
int boxw = drw->fonts->h / 6;
|
||||
unsigned int i, occ = 0, urg = 0;
|
||||
Client *c;
|
||||
|
||||
|
@ -709,6 +766,8 @@ drawbar(Monitor *m)
|
|||
}
|
||||
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
if (ISVISIBLE(c))
|
||||
n++;
|
||||
occ |= c->tags;
|
||||
if (c->isurgent)
|
||||
urg |= c->tags;
|
||||
|
@ -719,9 +778,10 @@ drawbar(Monitor *m)
|
|||
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
|
||||
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
|
||||
if (occ & 1 << i)
|
||||
drw_rect(drw, x + boxs, boxs, boxw, boxw,
|
||||
m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
|
||||
urg & 1 << i);
|
||||
drw_rect(drw, x + boxw, 0, w - ( 2 * boxw + 1), boxw,
|
||||
m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
|
||||
urg & 1 << i);
|
||||
|
||||
x += w;
|
||||
}
|
||||
w = blw = TEXTW(m->ltsymbol);
|
||||
|
@ -729,16 +789,28 @@ drawbar(Monitor *m)
|
|||
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
||||
|
||||
if ((w = m->ww - sw - x) > bh) {
|
||||
if (m->sel) {
|
||||
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
|
||||
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
|
||||
if (m->sel->isfloating)
|
||||
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
|
||||
if (n > 0) {
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
if (!ISVISIBLE(c))
|
||||
continue;
|
||||
if (m->sel == c)
|
||||
scm = SchemeSel;
|
||||
else if (HIDDEN(c))
|
||||
scm = SchemeHid;
|
||||
else
|
||||
scm = SchemeNorm;
|
||||
drw_setscheme(drw, scheme[scm]);
|
||||
drw_text(drw, x, 0, (1.0 / (double)n) * w, bh, lrpad / 2, c->name, 0);
|
||||
x += (1.0 / (double)n) * w;
|
||||
}
|
||||
} else {
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
m->bt = n;
|
||||
m->btw = w;
|
||||
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
|
||||
}
|
||||
|
||||
|
@ -783,8 +855,8 @@ expose(XEvent *e)
|
|||
void
|
||||
focus(Client *c)
|
||||
{
|
||||
if (!c || !ISVISIBLE(c))
|
||||
for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
|
||||
if (!c || !ISVISIBLE(c) || HIDDEN(c))
|
||||
for (c = selmon->stack; c && (!ISVISIBLE(c) || HIDDEN(c)); c = c->snext);
|
||||
if (selmon->sel && selmon->sel != c)
|
||||
unfocus(selmon->sel, 0);
|
||||
if (c) {
|
||||
|
@ -963,10 +1035,35 @@ grabkeys(void)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
hide(Client *c) {
|
||||
if (!c || HIDDEN(c))
|
||||
return;
|
||||
|
||||
Window w = c->win;
|
||||
static XWindowAttributes ra, ca;
|
||||
|
||||
// more or less taken directly from blackbox's hide() function
|
||||
XGrabServer(dpy);
|
||||
XGetWindowAttributes(dpy, root, &ra);
|
||||
XGetWindowAttributes(dpy, w, &ca);
|
||||
// prevent UnmapNotify events
|
||||
XSelectInput(dpy, root, ra.your_event_mask & ~SubstructureNotifyMask);
|
||||
XSelectInput(dpy, w, ca.your_event_mask & ~StructureNotifyMask);
|
||||
XUnmapWindow(dpy, w);
|
||||
setclientstate(c, IconicState);
|
||||
XSelectInput(dpy, root, ra.your_event_mask);
|
||||
XSelectInput(dpy, w, ca.your_event_mask);
|
||||
XUngrabServer(dpy);
|
||||
|
||||
focus(c->snext);
|
||||
arrange(c->mon);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -1067,12 +1164,14 @@ manage(Window w, XWindowAttributes *wa)
|
|||
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
|
||||
(unsigned char *) &(c->win), 1);
|
||||
XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* some windows require this */
|
||||
setclientstate(c, NormalState);
|
||||
if (!HIDDEN(c))
|
||||
setclientstate(c, NormalState);
|
||||
if (c->mon == selmon)
|
||||
unfocus(selmon->sel, 0);
|
||||
c->mon->sel = c;
|
||||
arrange(c->mon);
|
||||
XMapWindow(dpy, c->win);
|
||||
if (!HIDDEN(c))
|
||||
XMapWindow(dpy, c->win);
|
||||
focus(NULL);
|
||||
}
|
||||
|
||||
|
@ -1195,7 +1294,7 @@ movemouse(const Arg *arg)
|
|||
Client *
|
||||
nexttiled(Client *c)
|
||||
{
|
||||
for (; c && (c->isfloating || !ISVISIBLE(c)); c = c->next);
|
||||
for (; c && (c->isfloating || !ISVISIBLE(c) || HIDDEN(c)); c = c->next);
|
||||
return c;
|
||||
}
|
||||
|
||||
|
@ -1208,6 +1307,16 @@ pop(Client *c)
|
|||
arrange(c->mon);
|
||||
}
|
||||
|
||||
Client *
|
||||
prevtiled(Client *c) {
|
||||
Client *p, *r;
|
||||
|
||||
for(p = selmon->clients, r = NULL; p && p != c; p = p->next)
|
||||
if(!p->isfloating && ISVISIBLE(p))
|
||||
r = p;
|
||||
return r;
|
||||
}
|
||||
|
||||
void
|
||||
propertynotify(XEvent *e)
|
||||
{
|
||||
|
@ -1245,6 +1354,37 @@ propertynotify(XEvent *e)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
pushdown(const Arg *arg) {
|
||||
Client *sel = selmon->sel, *c;
|
||||
|
||||
if(!sel || sel->isfloating || sel == nexttiled(selmon->clients))
|
||||
return;
|
||||
if((c = nexttiled(sel->next))) {
|
||||
detach(sel);
|
||||
sel->next = c->next;
|
||||
c->next = sel;
|
||||
}
|
||||
focus(sel);
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
void
|
||||
pushup(const Arg *arg) {
|
||||
Client *sel = selmon->sel, *c;
|
||||
|
||||
if(!sel || sel->isfloating)
|
||||
return;
|
||||
if((c = prevtiled(sel)) && c != nexttiled(selmon->clients)) {
|
||||
detach(sel);
|
||||
sel->next = c;
|
||||
for(c = selmon->clients; c->next != sel->next; c = c->next);
|
||||
c->next = sel;
|
||||
}
|
||||
focus(sel);
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
void
|
||||
quit(const Arg *arg)
|
||||
{
|
||||
|
@ -1380,6 +1520,13 @@ run(void)
|
|||
handler[ev.type](&ev); /* call handler */
|
||||
}
|
||||
|
||||
void
|
||||
runAutostart(void) {
|
||||
if (!system("cd ~/.config/dwm; ./autostart_blocking.sh") ||
|
||||
!system("cd ~/.config/dwm; ./autostart.sh &"))
|
||||
fputs("Could not run start scripts", stdout);
|
||||
}
|
||||
|
||||
void
|
||||
scan(void)
|
||||
{
|
||||
|
@ -1497,13 +1644,23 @@ 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)
|
||||
{
|
||||
if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
|
||||
selmon->sellt ^= 1;
|
||||
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag] ^= 1;
|
||||
if (arg && arg->v)
|
||||
selmon->lt[selmon->sellt] = (Layout *)arg->v;
|
||||
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt] = (Layout *)arg->v;
|
||||
strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
|
||||
if (selmon->sel)
|
||||
arrange(selmon);
|
||||
|
@ -1522,7 +1679,7 @@ setmfact(const Arg *arg)
|
|||
f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
|
||||
if (f < 0.1 || f > 0.9)
|
||||
return;
|
||||
selmon->mfact = f;
|
||||
selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag] = f;
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
|
@ -1610,6 +1767,17 @@ seturgent(Client *c, int urg)
|
|||
XFree(wmh);
|
||||
}
|
||||
|
||||
void
|
||||
show(Client *c)
|
||||
{
|
||||
if (!c || !HIDDEN(c))
|
||||
return;
|
||||
|
||||
XMapWindow(dpy, c->win);
|
||||
setclientstate(c, NormalState);
|
||||
arrange(c->mon);
|
||||
}
|
||||
|
||||
void
|
||||
showhide(Client *c)
|
||||
{
|
||||
|
@ -1683,23 +1851,23 @@ tile(Monitor *m)
|
|||
if (n > m->nmaster)
|
||||
mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||
else
|
||||
mw = m->ww;
|
||||
for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
mw = m->ww - m->gappx;
|
||||
for (i = 0, my = ty = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
if (i < m->nmaster) {
|
||||
h = (m->wh - my) / (MIN(n, m->nmaster) - i);
|
||||
resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
|
||||
my += HEIGHT(c);
|
||||
h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx;
|
||||
resize(c, m->wx + m->gappx, m->wy + my, mw - (2*c->bw) - m->gappx, h - (2*c->bw), 0);
|
||||
my += HEIGHT(c) + m->gappx;
|
||||
} else {
|
||||
h = (m->wh - ty) / (n - i);
|
||||
resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
|
||||
ty += HEIGHT(c);
|
||||
h = (m->wh - ty) / (n - i) - m->gappx;
|
||||
resize(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappx, h - (2*c->bw), 0);
|
||||
ty += HEIGHT(c) + m->gappx;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
togglebar(const Arg *arg)
|
||||
{
|
||||
selmon->showbar = !selmon->showbar;
|
||||
selmon->showbar = selmon->pertag->showbars[selmon->pertag->curtag] = !selmon->showbar;
|
||||
updatebarpos(selmon);
|
||||
XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
|
||||
arrange(selmon);
|
||||
|
@ -1738,14 +1906,52 @@ void
|
|||
toggleview(const Arg *arg)
|
||||
{
|
||||
unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
|
||||
int i;
|
||||
|
||||
if (newtagset) {
|
||||
selmon->tagset[selmon->seltags] = newtagset;
|
||||
|
||||
if (newtagset == ~0) {
|
||||
selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
selmon->pertag->curtag = 0;
|
||||
}
|
||||
|
||||
/* test if the user did not select the same tag */
|
||||
if (!(newtagset & 1 << (selmon->pertag->curtag - 1))) {
|
||||
selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
for (i = 0; !(newtagset & 1 << i); i++) ;
|
||||
selmon->pertag->curtag = i + 1;
|
||||
}
|
||||
|
||||
/* apply settings for this view */
|
||||
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
|
||||
selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
|
||||
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
|
||||
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
||||
selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
|
||||
|
||||
if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
|
||||
togglebar(NULL);
|
||||
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
togglewin(const Arg *arg)
|
||||
{
|
||||
Client *c = (Client*)arg->v;
|
||||
if (c == selmon->sel)
|
||||
hide(c);
|
||||
else {
|
||||
if (HIDDEN(c))
|
||||
show(c);
|
||||
focus(c);
|
||||
restack(selmon);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
unfocus(Client *c, int setfocus)
|
||||
{
|
||||
|
@ -2035,11 +2241,37 @@ updatewmhints(Client *c)
|
|||
void
|
||||
view(const Arg *arg)
|
||||
{
|
||||
int i;
|
||||
unsigned int tmptag;
|
||||
|
||||
if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
|
||||
return;
|
||||
selmon->seltags ^= 1; /* toggle sel tagset */
|
||||
if (arg->ui & TAGMASK)
|
||||
if (arg->ui & TAGMASK) {
|
||||
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
|
||||
selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
|
||||
if (arg->ui == ~0)
|
||||
selmon->pertag->curtag = 0;
|
||||
else {
|
||||
for (i = 0; !(arg->ui & 1 << i); i++) ;
|
||||
selmon->pertag->curtag = i + 1;
|
||||
}
|
||||
} else {
|
||||
tmptag = selmon->pertag->prevtag;
|
||||
selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
selmon->pertag->curtag = tmptag;
|
||||
}
|
||||
|
||||
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
|
||||
selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
|
||||
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
|
||||
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
||||
selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
|
||||
|
||||
if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
|
||||
togglebar(NULL);
|
||||
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
}
|
||||
|
@ -2142,8 +2374,171 @@ main(int argc, char *argv[])
|
|||
die("pledge");
|
||||
#endif /* __OpenBSD__ */
|
||||
scan();
|
||||
runAutostart();
|
||||
run();
|
||||
cleanup();
|
||||
XCloseDisplay(dpy);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
bstack(Monitor *m) {
|
||||
int w, h, mh, mx, tx, ty, tw;
|
||||
unsigned int i, n;
|
||||
Client *c;
|
||||
|
||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||
if (n == 0)
|
||||
return;
|
||||
if (n > m->nmaster) {
|
||||
mh = m->nmaster ? m->mfact * m->wh : 0;
|
||||
tw = m->ww / (n - m->nmaster);
|
||||
ty = m->wy + mh;
|
||||
} else {
|
||||
mh = m->wh;
|
||||
tw = m->ww;
|
||||
ty = m->wy;
|
||||
}
|
||||
for (i = mx = 0, tx = m->wx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
||||
if (i < m->nmaster) {
|
||||
w = (m->ww - mx) / (MIN(n, m->nmaster) - i);
|
||||
resize(c, m->wx + mx, m->wy, w - (2 * c->bw), mh - (2 * c->bw), 0);
|
||||
mx += WIDTH(c);
|
||||
} else {
|
||||
h = m->wh - mh;
|
||||
resize(c, tx, ty, tw - (2 * c->bw), h - (2 * c->bw), 0);
|
||||
if (tw != m->ww)
|
||||
tx += WIDTH(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
bstackhoriz(Monitor *m) {
|
||||
int w, mh, mx, tx, ty, th;
|
||||
unsigned int i, n;
|
||||
Client *c;
|
||||
|
||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||
if (n == 0)
|
||||
return;
|
||||
if (n > m->nmaster) {
|
||||
mh = m->nmaster ? m->mfact * m->wh : 0;
|
||||
th = (m->wh - mh) / (n - m->nmaster);
|
||||
ty = m->wy + mh;
|
||||
} else {
|
||||
th = mh = m->wh;
|
||||
ty = m->wy;
|
||||
}
|
||||
for (i = mx = 0, tx = m->wx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
||||
if (i < m->nmaster) {
|
||||
w = (m->ww - mx) / (MIN(n, m->nmaster) - i);
|
||||
resize(c, m->wx + mx, m->wy, w - (2 * c->bw), mh - (2 * c->bw), 0);
|
||||
mx += WIDTH(c);
|
||||
} else {
|
||||
resize(c, tx, ty, m->ww - (2 * c->bw), th - (2 * c->bw), 0);
|
||||
if (th != m->wh)
|
||||
ty += HEIGHT(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
void centeredmaster(Monitor *m) {
|
||||
unsigned int i, n, h, mw, mx, my, oty, ety, tw;
|
||||
Client *c;
|
||||
|
||||
/* count number of clients in the selected monitor */
|
||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
/* initialize areas */
|
||||
mw = m->ww;
|
||||
mx = 0;
|
||||
my = 0;
|
||||
tw = mw;
|
||||
|
||||
if (n > m->nmaster) {
|
||||
/* go mfact box in the center if more than nmaster clients */
|
||||
mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||
tw = m->ww - mw;
|
||||
|
||||
if (n - m->nmaster > 1) {
|
||||
/* only one client */
|
||||
mx = (m->ww - mw) / 2;
|
||||
tw = (m->ww - mw) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
oty = 0;
|
||||
ety = 0;
|
||||
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
if (i < m->nmaster) {
|
||||
/* nmaster clients are stacked vertically, in the center
|
||||
* of the screen */
|
||||
h = (m->wh - my) / (MIN(n, m->nmaster) - i);
|
||||
resize(c, m->wx + mx, m->wy + my, mw - (2*c->bw),
|
||||
+ h - (2*c->bw), 0);
|
||||
my += HEIGHT(c);
|
||||
} else {
|
||||
/* stack clients are stacked vertically */
|
||||
if ((i - m->nmaster) % 2 ) {
|
||||
h = (m->wh - ety) / ( (1 + n - i) / 2);
|
||||
resize(c, m->wx, m->wy + ety, tw - (2*c->bw),
|
||||
h - (2*c->bw), 0);
|
||||
ety += HEIGHT(c);
|
||||
} else {
|
||||
h = (m->wh - oty) / ((1 + n - i) / 2);
|
||||
resize(c, m->wx + mx + mw, m->wy + oty,
|
||||
+ tw - (2*c->bw), h - (2*c->bw), 0);
|
||||
oty += HEIGHT(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
centeredfloatingmaster(Monitor *m)
|
||||
{
|
||||
unsigned int i, n, w, mh, mw, mx, mxo, my, myo, tx;
|
||||
Client *c;
|
||||
|
||||
/* count number of clients in the selected monitor */
|
||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
/* initialize nmaster area */
|
||||
if (n > m->nmaster) {
|
||||
/* go mfact box in the center if more than nmaster clients */
|
||||
if (m->ww > m->wh) {
|
||||
mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||
mh = m->nmaster ? m->wh * 0.9 : 0;
|
||||
} else {
|
||||
mh = m->nmaster ? m->wh * m->mfact : 0;
|
||||
mw = m->nmaster ? m->ww * 0.9 : 0;
|
||||
}
|
||||
mx = mxo = (m->ww - mw) / 2;
|
||||
my = myo = (m->wh - mh) / 2;
|
||||
} else {
|
||||
/* go fullscreen if all clients are in the master area */
|
||||
mh = m->wh;
|
||||
mw = m->ww;
|
||||
mx = mxo = 0;
|
||||
my = myo = 0;
|
||||
}
|
||||
|
||||
for(i = tx = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
if (i < m->nmaster) {
|
||||
/* nmaster clients are stacked horizontally, in the center
|
||||
* of the screen */
|
||||
w = (mw + mxo - mx) / (MIN(n, m->nmaster) - i);
|
||||
resize(c, m->wx + mx, m->wy + my, w - (2*c->bw),
|
||||
mh - (2*c->bw), 0);
|
||||
mx += WIDTH(c);
|
||||
} else {
|
||||
/* stack clients are stacked horizontally */
|
||||
w = (m->ww - tx) / (n - i);
|
||||
resize(c, m->wx + tx, m->wy, w - (2*c->bw),
|
||||
m->wh - (2*c->bw), 0);
|
||||
tx += WIDTH(c);
|
||||
}
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 373 B After Width: | Height: | Size: 373 B |
|
@ -0,0 +1,272 @@
|
|||
diff --git a/config.def.h b/config.def.h
|
||||
index 1c0b587..1e62218 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -16,6 +16,7 @@ static const char *colors[][3] = {
|
||||
/* fg bg border */
|
||||
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
|
||||
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
||||
+ [SchemeHid] = { col_cyan, col_gray1, col_cyan },
|
||||
};
|
||||
|
||||
/* tagging */
|
||||
@@ -102,6 +103,7 @@ static Button buttons[] = {
|
||||
/* click event mask button function argument */
|
||||
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
||||
+ { ClkWinTitle, 0, Button1, togglewin, {0} },
|
||||
{ ClkWinTitle, 0, Button2, zoom, {0} },
|
||||
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
||||
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index 4465af1..be9582d 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -50,6 +50,7 @@
|
||||
#define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \
|
||||
* MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy)))
|
||||
#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]))
|
||||
+#define HIDDEN(C) ((getstate(C->win) == IconicState))
|
||||
#define LENGTH(X) (sizeof X / sizeof X[0])
|
||||
#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
|
||||
#define WIDTH(X) ((X)->w + 2 * (X)->bw)
|
||||
@@ -59,7 +60,7 @@
|
||||
|
||||
/* enums */
|
||||
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
|
||||
-enum { SchemeNorm, SchemeSel }; /* color schemes */
|
||||
+enum { SchemeNorm, SchemeSel, SchemeHid }; /* color schemes */
|
||||
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
|
||||
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
|
||||
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
|
||||
@@ -117,6 +118,8 @@ struct Monitor {
|
||||
int nmaster;
|
||||
int num;
|
||||
int by; /* bar geometry */
|
||||
+ int btw; /* width of tasks portion of bar */
|
||||
+ int bt; /* number of tasks */
|
||||
int mx, my, mw, mh; /* screen size */
|
||||
int wx, wy, ww, wh; /* window area */
|
||||
unsigned int seltags;
|
||||
@@ -174,6 +177,7 @@ static long getstate(Window w);
|
||||
static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
|
||||
static void grabbuttons(Client *c, int focused);
|
||||
static void grabkeys(void);
|
||||
+static void hide(Client *c);
|
||||
static void incnmaster(const Arg *arg);
|
||||
static void keypress(XEvent *e);
|
||||
static void killclient(const Arg *arg);
|
||||
@@ -203,6 +207,7 @@ 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 show(Client *c);
|
||||
static void showhide(Client *c);
|
||||
static void sigchld(int unused);
|
||||
static void spawn(const Arg *arg);
|
||||
@@ -213,6 +218,7 @@ static void togglebar(const Arg *arg);
|
||||
static void togglefloating(const Arg *arg);
|
||||
static void toggletag(const Arg *arg);
|
||||
static void toggleview(const Arg *arg);
|
||||
+static void togglewin(const Arg *arg);
|
||||
static void unfocus(Client *c, int setfocus);
|
||||
static void unmanage(Client *c, int destroyed);
|
||||
static void unmapnotify(XEvent *e);
|
||||
@@ -439,10 +445,25 @@ buttonpress(XEvent *e)
|
||||
arg.ui = 1 << i;
|
||||
} else if (ev->x < x + blw)
|
||||
click = ClkLtSymbol;
|
||||
- else if (ev->x > selmon->ww - TEXTW(stext))
|
||||
+ /* 2px right padding */
|
||||
+ else if (ev->x > selmon->ww - TEXTW(stext) + lrpad - 2)
|
||||
click = ClkStatusText;
|
||||
- else
|
||||
- click = ClkWinTitle;
|
||||
+ else {
|
||||
+ x += blw;
|
||||
+ c = m->clients;
|
||||
+
|
||||
+ do {
|
||||
+ if (!ISVISIBLE(c))
|
||||
+ continue;
|
||||
+ else
|
||||
+ x += (1.0 / (double)m->bt) * m->btw;
|
||||
+ } while (ev->x > x && (c = c->next));
|
||||
+
|
||||
+ if (c) {
|
||||
+ click = ClkWinTitle;
|
||||
+ arg.v = c;
|
||||
+ }
|
||||
+ }
|
||||
} else if ((c = wintoclient(ev->window))) {
|
||||
focus(c);
|
||||
restack(selmon);
|
||||
@@ -452,7 +473,7 @@ buttonpress(XEvent *e)
|
||||
for (i = 0; i < LENGTH(buttons); i++)
|
||||
if (click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button
|
||||
&& CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state))
|
||||
- buttons[i].func(click == ClkTagBar && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg);
|
||||
+ buttons[i].func((click == ClkTagBar || click == ClkWinTitle) && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -695,7 +716,7 @@ dirtomon(int dir)
|
||||
void
|
||||
drawbar(Monitor *m)
|
||||
{
|
||||
- int x, w, sw = 0;
|
||||
+ int x, w, sw = 0, n = 0, scm;
|
||||
int boxs = drw->fonts->h / 9;
|
||||
int boxw = drw->fonts->h / 6 + 2;
|
||||
unsigned int i, occ = 0, urg = 0;
|
||||
@@ -709,6 +730,8 @@ drawbar(Monitor *m)
|
||||
}
|
||||
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
+ if (ISVISIBLE(c))
|
||||
+ n++;
|
||||
occ |= c->tags;
|
||||
if (c->isurgent)
|
||||
urg |= c->tags;
|
||||
@@ -729,16 +752,28 @@ drawbar(Monitor *m)
|
||||
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
||||
|
||||
if ((w = m->ww - sw - x) > bh) {
|
||||
- if (m->sel) {
|
||||
- drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
|
||||
- drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
|
||||
- if (m->sel->isfloating)
|
||||
- drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
|
||||
+ if (n > 0) {
|
||||
+ for (c = m->clients; c; c = c->next) {
|
||||
+ if (!ISVISIBLE(c))
|
||||
+ continue;
|
||||
+ if (m->sel == c)
|
||||
+ scm = SchemeSel;
|
||||
+ else if (HIDDEN(c))
|
||||
+ scm = SchemeHid;
|
||||
+ else
|
||||
+ scm = SchemeNorm;
|
||||
+ drw_setscheme(drw, scheme[scm]);
|
||||
+ drw_text(drw, x, 0, (1.0 / (double)n) * w, bh, lrpad / 2, c->name, 0);
|
||||
+ x += (1.0 / (double)n) * w;
|
||||
+ }
|
||||
} else {
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ m->bt = n;
|
||||
+ m->btw = w;
|
||||
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
|
||||
}
|
||||
|
||||
@@ -783,8 +818,8 @@ expose(XEvent *e)
|
||||
void
|
||||
focus(Client *c)
|
||||
{
|
||||
- if (!c || !ISVISIBLE(c))
|
||||
- for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
|
||||
+ if (!c || !ISVISIBLE(c) || HIDDEN(c))
|
||||
+ for (c = selmon->stack; c && (!ISVISIBLE(c) || HIDDEN(c)); c = c->snext);
|
||||
if (selmon->sel && selmon->sel != c)
|
||||
unfocus(selmon->sel, 0);
|
||||
if (c) {
|
||||
@@ -963,6 +998,31 @@ grabkeys(void)
|
||||
}
|
||||
}
|
||||
|
||||
+void
|
||||
+hide(Client *c) {
|
||||
+ if (!c || HIDDEN(c))
|
||||
+ return;
|
||||
+
|
||||
+ Window w = c->win;
|
||||
+ static XWindowAttributes ra, ca;
|
||||
+
|
||||
+ // more or less taken directly from blackbox's hide() function
|
||||
+ XGrabServer(dpy);
|
||||
+ XGetWindowAttributes(dpy, root, &ra);
|
||||
+ XGetWindowAttributes(dpy, w, &ca);
|
||||
+ // prevent UnmapNotify events
|
||||
+ XSelectInput(dpy, root, ra.your_event_mask & ~SubstructureNotifyMask);
|
||||
+ XSelectInput(dpy, w, ca.your_event_mask & ~StructureNotifyMask);
|
||||
+ XUnmapWindow(dpy, w);
|
||||
+ setclientstate(c, IconicState);
|
||||
+ XSelectInput(dpy, root, ra.your_event_mask);
|
||||
+ XSelectInput(dpy, w, ca.your_event_mask);
|
||||
+ XUngrabServer(dpy);
|
||||
+
|
||||
+ focus(c->snext);
|
||||
+ arrange(c->mon);
|
||||
+}
|
||||
+
|
||||
void
|
||||
incnmaster(const Arg *arg)
|
||||
{
|
||||
@@ -1067,12 +1127,14 @@ manage(Window w, XWindowAttributes *wa)
|
||||
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
|
||||
(unsigned char *) &(c->win), 1);
|
||||
XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* some windows require this */
|
||||
- setclientstate(c, NormalState);
|
||||
+ if (!HIDDEN(c))
|
||||
+ setclientstate(c, NormalState);
|
||||
if (c->mon == selmon)
|
||||
unfocus(selmon->sel, 0);
|
||||
c->mon->sel = c;
|
||||
arrange(c->mon);
|
||||
- XMapWindow(dpy, c->win);
|
||||
+ if (!HIDDEN(c))
|
||||
+ XMapWindow(dpy, c->win);
|
||||
focus(NULL);
|
||||
}
|
||||
|
||||
@@ -1195,7 +1257,7 @@ movemouse(const Arg *arg)
|
||||
Client *
|
||||
nexttiled(Client *c)
|
||||
{
|
||||
- for (; c && (c->isfloating || !ISVISIBLE(c)); c = c->next);
|
||||
+ for (; c && (c->isfloating || !ISVISIBLE(c) || HIDDEN(c)); c = c->next);
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -1610,6 +1672,17 @@ seturgent(Client *c, int urg)
|
||||
XFree(wmh);
|
||||
}
|
||||
|
||||
+void
|
||||
+show(Client *c)
|
||||
+{
|
||||
+ if (!c || !HIDDEN(c))
|
||||
+ return;
|
||||
+
|
||||
+ XMapWindow(dpy, c->win);
|
||||
+ setclientstate(c, NormalState);
|
||||
+ arrange(c->mon);
|
||||
+}
|
||||
+
|
||||
void
|
||||
showhide(Client *c)
|
||||
{
|
||||
@@ -1746,6 +1819,20 @@ toggleview(const Arg *arg)
|
||||
}
|
||||
}
|
||||
|
||||
+void
|
||||
+togglewin(const Arg *arg)
|
||||
+{
|
||||
+ Client *c = (Client*)arg->v;
|
||||
+ if (c == selmon->sel)
|
||||
+ hide(c);
|
||||
+ else {
|
||||
+ if (HIDDEN(c))
|
||||
+ show(c);
|
||||
+ focus(c);
|
||||
+ restack(selmon);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void
|
||||
unfocus(Client *c, int setfocus)
|
||||
{
|
|
@ -0,0 +1,95 @@
|
|||
diff --git a/config.def.h b/config.def.h
|
||||
index 1c0b587..38d2f6c 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
/* appearance */
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
+static const unsigned int gappx = 5; /* gaps between windows */
|
||||
static const unsigned int snap = 32; /* snap pixel */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
@@ -84,6 +85,9 @@ static Key keys[] = {
|
||||
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||
+ { MODKEY, XK_minus, setgaps, {.i = -1 } },
|
||||
+ { MODKEY, XK_equal, setgaps, {.i = +1 } },
|
||||
+ { MODKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } },
|
||||
TAGKEYS( XK_1, 0)
|
||||
TAGKEYS( XK_2, 1)
|
||||
TAGKEYS( XK_3, 2)
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index 4465af1..4363627 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -119,6 +119,7 @@ struct Monitor {
|
||||
int by; /* bar geometry */
|
||||
int mx, my, mw, mh; /* screen size */
|
||||
int wx, wy, ww, wh; /* window area */
|
||||
+ int gappx; /* gaps between windows */
|
||||
unsigned int seltags;
|
||||
unsigned int sellt;
|
||||
unsigned int tagset[2];
|
||||
@@ -199,6 +200,7 @@ static void sendmon(Client *c, Monitor *m);
|
||||
static void setclientstate(Client *c, long state);
|
||||
static void setfocus(Client *c);
|
||||
static void setfullscreen(Client *c, int fullscreen);
|
||||
+static void setgaps(const Arg *arg);
|
||||
static void setlayout(const Arg *arg);
|
||||
static void setmfact(const Arg *arg);
|
||||
static void setup(void);
|
||||
@@ -638,6 +640,7 @@ createmon(void)
|
||||
m->nmaster = nmaster;
|
||||
m->showbar = showbar;
|
||||
m->topbar = topbar;
|
||||
+ m->gappx = gappx;
|
||||
m->lt[0] = &layouts[0];
|
||||
m->lt[1] = &layouts[1 % LENGTH(layouts)];
|
||||
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
|
||||
@@ -1497,6 +1500,16 @@ setfullscreen(Client *c, int fullscreen)
|
||||
}
|
||||
}
|
||||
|
||||
+void
|
||||
+setgaps(const Arg *arg)
|
||||
+{
|
||||
+ if ((arg->i == 0) || (selmon->gappx + arg->i < 0))
|
||||
+ selmon->gappx = 0;
|
||||
+ else
|
||||
+ selmon->gappx += arg->i;
|
||||
+ arrange(selmon);
|
||||
+}
|
||||
+
|
||||
void
|
||||
setlayout(const Arg *arg)
|
||||
{
|
||||
@@ -1683,16 +1696,16 @@ tile(Monitor *m)
|
||||
if (n > m->nmaster)
|
||||
mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||
else
|
||||
- mw = m->ww;
|
||||
- for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
+ mw = m->ww - m->gappx;
|
||||
+ for (i = 0, my = ty = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
if (i < m->nmaster) {
|
||||
- h = (m->wh - my) / (MIN(n, m->nmaster) - i);
|
||||
- resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
|
||||
- my += HEIGHT(c);
|
||||
+ h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx;
|
||||
+ resize(c, m->wx + m->gappx, m->wy + my, mw - (2*c->bw) - m->gappx, h - (2*c->bw), 0);
|
||||
+ my += HEIGHT(c) + m->gappx;
|
||||
} else {
|
||||
- h = (m->wh - ty) / (n - i);
|
||||
- resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
|
||||
- ty += HEIGHT(c);
|
||||
+ h = (m->wh - ty) / (n - i) - m->gappx;
|
||||
+ resize(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappx, h - (2*c->bw), 0);
|
||||
+ ty += HEIGHT(c) + m->gappx;
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.20.1
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
diff -up dwm-a/dwm.c dwm-b/dwm.c
|
||||
--- dwm-a/dwm.c 2019-02-02 06:55:28.000000000 -0600
|
||||
+++ dwm-b/dwm.c 2019-02-23 21:43:13.359179100 -0600
|
||||
@@ -719,9 +719,10 @@ drawbar(Monitor *m)
|
||||
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
|
||||
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
|
||||
if (occ & 1 << i)
|
||||
- drw_rect(drw, x + boxs, boxs, boxw, boxw,
|
||||
- m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
|
||||
- urg & 1 << i);
|
||||
+ drw_rect(drw, x + boxw, 0, w - ( 2 * boxw + 1), boxw,
|
||||
+ m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
|
||||
+ urg & 1 << i);
|
||||
+
|
||||
x += w;
|
||||
}
|
||||
w = blw = TEXTW(m->ltsymbol);
|
|
@ -0,0 +1,40 @@
|
|||
commit 5918623c5bd7fda155bf9dc3d33890c4ae1722d0
|
||||
Author: Simon Bremer <simon.bremer@tum.de>
|
||||
Date: Thu Dec 22 17:31:07 2016 +0100
|
||||
|
||||
Applied and fixed autostart patch for previous version;
|
||||
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index d27cb67..066ed71 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -194,6 +194,7 @@ static void resizeclient(Client *c, int x, int y, int w, int h);
|
||||
static void resizemouse(const Arg *arg);
|
||||
static void restack(Monitor *m);
|
||||
static void run(void);
|
||||
+static void runAutostart(void);
|
||||
static void scan(void);
|
||||
static int sendevent(Client *c, Atom proto);
|
||||
static void sendmon(Client *c, Monitor *m);
|
||||
@@ -1386,6 +1388,13 @@ run(void)
|
||||
}
|
||||
|
||||
void
|
||||
+runAutostart(void) {
|
||||
+ if (!system("cd ~/.config/dwm; ./autostart_blocking.sh") ||
|
||||
+ !system("cd ~/.config/dwm; ./autostart.sh &"))
|
||||
+ fputs("Could not run start scripts", stdout);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
scan(void)
|
||||
{
|
||||
unsigned int i, num;
|
||||
@@ -2145,6 +2152,7 @@ main(int argc, char *argv[])
|
||||
checkotherwm();
|
||||
setup();
|
||||
scan();
|
||||
+ runAutostart();
|
||||
run();
|
||||
cleanup();
|
||||
XCloseDisplay(dpy);
|
|
@ -0,0 +1,177 @@
|
|||
diff --git a/dwm.c b/dwm.c
|
||||
index 4465af1..6474055 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -111,6 +111,7 @@ typedef struct {
|
||||
void (*arrange)(Monitor *);
|
||||
} Layout;
|
||||
|
||||
+typedef struct Pertag Pertag;
|
||||
struct Monitor {
|
||||
char ltsymbol[16];
|
||||
float mfact;
|
||||
@@ -130,6 +131,7 @@ struct Monitor {
|
||||
Monitor *next;
|
||||
Window barwin;
|
||||
const Layout *lt[2];
|
||||
+ Pertag *pertag;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
@@ -271,6 +273,15 @@ static Window root, wmcheckwin;
|
||||
/* configuration, allows nested code to access above variables */
|
||||
#include "config.h"
|
||||
|
||||
+struct Pertag {
|
||||
+ unsigned int curtag, prevtag; /* current and previous tag */
|
||||
+ int nmasters[LENGTH(tags) + 1]; /* number of windows in master area */
|
||||
+ float mfacts[LENGTH(tags) + 1]; /* mfacts per tag */
|
||||
+ unsigned int sellts[LENGTH(tags) + 1]; /* selected layouts */
|
||||
+ const Layout *ltidxs[LENGTH(tags) + 1][2]; /* matrix of tags and layouts indexes */
|
||||
+ int showbars[LENGTH(tags) + 1]; /* display bar for the current tag */
|
||||
+};
|
||||
+
|
||||
/* compile-time check if all tags fit into an unsigned int bit array. */
|
||||
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
|
||||
|
||||
@@ -631,6 +642,7 @@ Monitor *
|
||||
createmon(void)
|
||||
{
|
||||
Monitor *m;
|
||||
+ unsigned int i;
|
||||
|
||||
m = ecalloc(1, sizeof(Monitor));
|
||||
m->tagset[0] = m->tagset[1] = 1;
|
||||
@@ -641,6 +653,20 @@ createmon(void)
|
||||
m->lt[0] = &layouts[0];
|
||||
m->lt[1] = &layouts[1 % LENGTH(layouts)];
|
||||
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
|
||||
+ m->pertag = ecalloc(1, sizeof(Pertag));
|
||||
+ m->pertag->curtag = m->pertag->prevtag = 1;
|
||||
+
|
||||
+ for (i = 0; i <= LENGTH(tags); i++) {
|
||||
+ m->pertag->nmasters[i] = m->nmaster;
|
||||
+ m->pertag->mfacts[i] = m->mfact;
|
||||
+
|
||||
+ m->pertag->ltidxs[i][0] = m->lt[0];
|
||||
+ m->pertag->ltidxs[i][1] = m->lt[1];
|
||||
+ m->pertag->sellts[i] = m->sellt;
|
||||
+
|
||||
+ m->pertag->showbars[i] = m->showbar;
|
||||
+ }
|
||||
+
|
||||
return m;
|
||||
}
|
||||
|
||||
@@ -966,7 +992,7 @@ grabkeys(void)
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -1501,9 +1527,9 @@ void
|
||||
setlayout(const Arg *arg)
|
||||
{
|
||||
if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
|
||||
- selmon->sellt ^= 1;
|
||||
+ selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag] ^= 1;
|
||||
if (arg && arg->v)
|
||||
- selmon->lt[selmon->sellt] = (Layout *)arg->v;
|
||||
+ selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt] = (Layout *)arg->v;
|
||||
strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
|
||||
if (selmon->sel)
|
||||
arrange(selmon);
|
||||
@@ -1522,7 +1548,7 @@ setmfact(const Arg *arg)
|
||||
f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
|
||||
if (f < 0.1 || f > 0.9)
|
||||
return;
|
||||
- selmon->mfact = f;
|
||||
+ selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag] = f;
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
@@ -1699,7 +1725,7 @@ tile(Monitor *m)
|
||||
void
|
||||
togglebar(const Arg *arg)
|
||||
{
|
||||
- selmon->showbar = !selmon->showbar;
|
||||
+ selmon->showbar = selmon->pertag->showbars[selmon->pertag->curtag] = !selmon->showbar;
|
||||
updatebarpos(selmon);
|
||||
XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
|
||||
arrange(selmon);
|
||||
@@ -1738,9 +1764,33 @@ void
|
||||
toggleview(const Arg *arg)
|
||||
{
|
||||
unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
|
||||
+ int i;
|
||||
|
||||
if (newtagset) {
|
||||
selmon->tagset[selmon->seltags] = newtagset;
|
||||
+
|
||||
+ if (newtagset == ~0) {
|
||||
+ selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
+ selmon->pertag->curtag = 0;
|
||||
+ }
|
||||
+
|
||||
+ /* test if the user did not select the same tag */
|
||||
+ if (!(newtagset & 1 << (selmon->pertag->curtag - 1))) {
|
||||
+ selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
+ for (i = 0; !(newtagset & 1 << i); i++) ;
|
||||
+ selmon->pertag->curtag = i + 1;
|
||||
+ }
|
||||
+
|
||||
+ /* apply settings for this view */
|
||||
+ selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
|
||||
+ selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
|
||||
+ selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
|
||||
+ selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
||||
+ selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
|
||||
+
|
||||
+ if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
|
||||
+ togglebar(NULL);
|
||||
+
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
}
|
||||
@@ -2035,11 +2085,37 @@ updatewmhints(Client *c)
|
||||
void
|
||||
view(const Arg *arg)
|
||||
{
|
||||
+ int i;
|
||||
+ unsigned int tmptag;
|
||||
+
|
||||
if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
|
||||
return;
|
||||
selmon->seltags ^= 1; /* toggle sel tagset */
|
||||
- if (arg->ui & TAGMASK)
|
||||
+ if (arg->ui & TAGMASK) {
|
||||
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
|
||||
+ selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
+
|
||||
+ if (arg->ui == ~0)
|
||||
+ selmon->pertag->curtag = 0;
|
||||
+ else {
|
||||
+ for (i = 0; !(arg->ui & 1 << i); i++) ;
|
||||
+ selmon->pertag->curtag = i + 1;
|
||||
+ }
|
||||
+ } else {
|
||||
+ tmptag = selmon->pertag->prevtag;
|
||||
+ selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
+ selmon->pertag->curtag = tmptag;
|
||||
+ }
|
||||
+
|
||||
+ selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
|
||||
+ selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
|
||||
+ selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
|
||||
+ selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
||||
+ selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
|
||||
+
|
||||
+ if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
|
||||
+ togglebar(NULL);
|
||||
+
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
diff --git a/config.def.h b/config.def.h
|
||||
index 7054c06..554f1db 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -39,6 +39,8 @@ static const Layout layouts[] = {
|
||||
{ "[]=", tile }, /* first entry is default */
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
{ "[M]", monocle },
|
||||
+ { "TTT", bstack },
|
||||
+ { "===", bstackhoriz },
|
||||
};
|
||||
|
||||
/* key definitions */
|
||||
@@ -74,6 +76,8 @@ static Key keys[] = {
|
||||
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||
+ { MODKEY, XK_u, setlayout, {.v = &layouts[3]} },
|
||||
+ { MODKEY, XK_o, setlayout, {.v = &layouts[4]} },
|
||||
{ MODKEY, XK_space, setlayout, {0} },
|
||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index 0362114..c313b5e 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -233,6 +233,8 @@ static int xerror(Display *dpy, XErrorEvent *ee);
|
||||
static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
||||
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||
static void zoom(const Arg *arg);
|
||||
+static void bstack(Monitor *m);
|
||||
+static void bstackhoriz(Monitor *m);
|
||||
|
||||
/* variables */
|
||||
static const char broken[] = "broken";
|
||||
@@ -2139,3 +2141,65 @@ main(int argc, char *argv[])
|
||||
XCloseDisplay(dpy);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
+
|
||||
+static void
|
||||
+bstack(Monitor *m) {
|
||||
+ int w, h, mh, mx, tx, ty, tw;
|
||||
+ unsigned int i, n;
|
||||
+ Client *c;
|
||||
+
|
||||
+ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||
+ if (n == 0)
|
||||
+ return;
|
||||
+ if (n > m->nmaster) {
|
||||
+ mh = m->nmaster ? m->mfact * m->wh : 0;
|
||||
+ tw = m->ww / (n - m->nmaster);
|
||||
+ ty = m->wy + mh;
|
||||
+ } else {
|
||||
+ mh = m->wh;
|
||||
+ tw = m->ww;
|
||||
+ ty = m->wy;
|
||||
+ }
|
||||
+ for (i = mx = 0, tx = m->wx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
||||
+ if (i < m->nmaster) {
|
||||
+ w = (m->ww - mx) / (MIN(n, m->nmaster) - i);
|
||||
+ resize(c, m->wx + mx, m->wy, w - (2 * c->bw), mh - (2 * c->bw), 0);
|
||||
+ mx += WIDTH(c);
|
||||
+ } else {
|
||||
+ h = m->wh - mh;
|
||||
+ resize(c, tx, ty, tw - (2 * c->bw), h - (2 * c->bw), 0);
|
||||
+ if (tw != m->ww)
|
||||
+ tx += WIDTH(c);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+bstackhoriz(Monitor *m) {
|
||||
+ int w, mh, mx, tx, ty, th;
|
||||
+ unsigned int i, n;
|
||||
+ Client *c;
|
||||
+
|
||||
+ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||
+ if (n == 0)
|
||||
+ return;
|
||||
+ if (n > m->nmaster) {
|
||||
+ mh = m->nmaster ? m->mfact * m->wh : 0;
|
||||
+ th = (m->wh - mh) / (n - m->nmaster);
|
||||
+ ty = m->wy + mh;
|
||||
+ } else {
|
||||
+ th = mh = m->wh;
|
||||
+ ty = m->wy;
|
||||
+ }
|
||||
+ for (i = mx = 0, tx = m->wx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
|
||||
+ if (i < m->nmaster) {
|
||||
+ w = (m->ww - mx) / (MIN(n, m->nmaster) - i);
|
||||
+ resize(c, m->wx + mx, m->wy, w - (2 * c->bw), mh - (2 * c->bw), 0);
|
||||
+ mx += WIDTH(c);
|
||||
+ } else {
|
||||
+ resize(c, tx, ty, m->ww - (2 * c->bw), th - (2 * c->bw), 0);
|
||||
+ if (th != m->wh)
|
||||
+ ty += HEIGHT(c);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
|
@ -0,0 +1,115 @@
|
|||
--- dwm.c 2020-05-25 20:18:32.786733660 +0300
|
||||
+++ dwm.c.orig 2020-05-25 20:11:57.780060152 +0300
|
||||
@@ -246,8 +246,6 @@
|
||||
static void zoom(const Arg *arg);
|
||||
static void bstack(Monitor *m);
|
||||
static void bstackhoriz(Monitor *m);
|
||||
-static void centeredmaster(Monitor *m);
|
||||
-static void centeredfloatingmaster(Monitor *m);
|
||||
|
||||
/* variables */
|
||||
static const char broken[] = "broken";
|
||||
@@ -2398,103 +2396,3 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
-void centeredmaster(Monitor *m) {
|
||||
- unsigned int i, n, h, mw, mx, my, oty, ety, tw;
|
||||
- Client *c;
|
||||
-
|
||||
- /* count number of clients in the selected monitor */
|
||||
- for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||
- if (n == 0)
|
||||
- return;
|
||||
-
|
||||
- /* initialize areas */
|
||||
- mw = m->ww;
|
||||
- mx = 0;
|
||||
- my = 0;
|
||||
- tw = mw;
|
||||
-
|
||||
- if (n > m->nmaster) {
|
||||
- /* go mfact box in the center if more than nmaster clients */
|
||||
- mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||
- tw = m->ww - mw;
|
||||
-
|
||||
- if (n - m->nmaster > 1) {
|
||||
- /* only one client */
|
||||
- mx = (m->ww - mw) / 2;
|
||||
- tw = (m->ww - mw) / 2;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- oty = 0;
|
||||
- ety = 0;
|
||||
- for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
- if (i < m->nmaster) {
|
||||
- /* nmaster clients are stacked vertically, in the center
|
||||
- * of the screen */
|
||||
- h = (m->wh - my) / (MIN(n, m->nmaster) - i);
|
||||
- resize(c, m->wx + mx, m->wy + my, mw - (2*c->bw),
|
||||
- + h - (2*c->bw), 0);
|
||||
- my += HEIGHT(c);
|
||||
- } else {
|
||||
- /* stack clients are stacked vertically */
|
||||
- if ((i - m->nmaster) % 2 ) {
|
||||
- h = (m->wh - ety) / ( (1 + n - i) / 2);
|
||||
- resize(c, m->wx, m->wy + ety, tw - (2*c->bw),
|
||||
- h - (2*c->bw), 0);
|
||||
- ety += HEIGHT(c);
|
||||
- } else {
|
||||
- h = (m->wh - oty) / ((1 + n - i) / 2);
|
||||
- resize(c, m->wx + mx + mw, m->wy + oty,
|
||||
- + tw - (2*c->bw), h - (2*c->bw), 0);
|
||||
- oty += HEIGHT(c);
|
||||
- }
|
||||
- }
|
||||
-}
|
||||
-
|
||||
- void
|
||||
-centeredfloatingmaster(Monitor *m)
|
||||
-{
|
||||
- unsigned int i, n, w, mh, mw, mx, mxo, my, myo, tx;
|
||||
- Client *c;
|
||||
-
|
||||
- /* count number of clients in the selected monitor */
|
||||
- for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||
- if (n == 0)
|
||||
- return;
|
||||
-
|
||||
- /* initialize nmaster area */
|
||||
- if (n > m->nmaster) {
|
||||
- /* go mfact box in the center if more than nmaster clients */
|
||||
- if (m->ww > m->wh) {
|
||||
- mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||
- mh = m->nmaster ? m->wh * 0.9 : 0;
|
||||
- } else {
|
||||
- mh = m->nmaster ? m->wh * m->mfact : 0;
|
||||
- mw = m->nmaster ? m->ww * 0.9 : 0;
|
||||
- }
|
||||
- mx = mxo = (m->ww - mw) / 2;
|
||||
- my = myo = (m->wh - mh) / 2;
|
||||
- } else {
|
||||
- /* go fullscreen if all clients are in the master area */
|
||||
- mh = m->wh;
|
||||
- mw = m->ww;
|
||||
- mx = mxo = 0;
|
||||
- my = myo = 0;
|
||||
- }
|
||||
-
|
||||
- for(i = tx = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||
- if (i < m->nmaster) {
|
||||
- /* nmaster clients are stacked horizontally, in the center
|
||||
- * of the screen */
|
||||
- w = (mw + mxo - mx) / (MIN(n, m->nmaster) - i);
|
||||
- resize(c, m->wx + mx, m->wy + my, w - (2*c->bw),
|
||||
- mh - (2*c->bw), 0);
|
||||
- mx += WIDTH(c);
|
||||
- } else {
|
||||
- /* stack clients are stacked horizontally */
|
||||
- w = (m->ww - tx) / (n - i);
|
||||
- resize(c, m->wx + tx, m->wy, w - (2*c->bw),
|
||||
- m->wh - (2*c->bw), 0);
|
||||
- tx += WIDTH(c);
|
||||
- }
|
||||
-}
|
|
@ -0,0 +1,70 @@
|
|||
diff --git a/dwm.c b/dwm.c
|
||||
index 4465af1..49e63f0 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -185,7 +185,10 @@ static void motionnotify(XEvent *e);
|
||||
static void movemouse(const Arg *arg);
|
||||
static Client *nexttiled(Client *c);
|
||||
static void pop(Client *);
|
||||
+static Client *prevtiled(Client *c);
|
||||
static void propertynotify(XEvent *e);
|
||||
+static void pushdown(const Arg *arg);
|
||||
+static void pushup(const Arg *arg);
|
||||
static void quit(const Arg *arg);
|
||||
static Monitor *recttomon(int x, int y, int w, int h);
|
||||
static void resize(Client *c, int x, int y, int w, int h, int interact);
|
||||
@@ -1208,6 +1211,16 @@ pop(Client *c)
|
||||
arrange(c->mon);
|
||||
}
|
||||
|
||||
+Client *
|
||||
+prevtiled(Client *c) {
|
||||
+ Client *p, *r;
|
||||
+
|
||||
+ for(p = selmon->clients, r = NULL; p && p != c; p = p->next)
|
||||
+ if(!p->isfloating && ISVISIBLE(p))
|
||||
+ r = p;
|
||||
+ return r;
|
||||
+}
|
||||
+
|
||||
void
|
||||
propertynotify(XEvent *e)
|
||||
{
|
||||
@@ -1245,6 +1258,37 @@ propertynotify(XEvent *e)
|
||||
}
|
||||
}
|
||||
|
||||
+void
|
||||
+pushdown(const Arg *arg) {
|
||||
+ Client *sel = selmon->sel, *c;
|
||||
+
|
||||
+ if(!sel || sel->isfloating || sel == nexttiled(selmon->clients))
|
||||
+ return;
|
||||
+ if((c = nexttiled(sel->next))) {
|
||||
+ detach(sel);
|
||||
+ sel->next = c->next;
|
||||
+ c->next = sel;
|
||||
+ }
|
||||
+ focus(sel);
|
||||
+ arrange(selmon);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+pushup(const Arg *arg) {
|
||||
+ Client *sel = selmon->sel, *c;
|
||||
+
|
||||
+ if(!sel || sel->isfloating)
|
||||
+ return;
|
||||
+ if((c = prevtiled(sel)) && c != nexttiled(selmon->clients)) {
|
||||
+ detach(sel);
|
||||
+ sel->next = c;
|
||||
+ for(c = selmon->clients; c->next != sel->next; c = c->next);
|
||||
+ c->next = sel;
|
||||
+ }
|
||||
+ focus(sel);
|
||||
+ arrange(selmon);
|
||||
+}
|
||||
+
|
||||
void
|
||||
quit(const Arg *arg)
|
||||
{
|
Loading…
Reference in New Issue