mirror of
https://github.com/tiyn/dwm.git
synced 2025-10-15 20:31:18 +02:00
Compare commits
135 Commits
quitprompt
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
f58d147e39 | ||
|
35271b171c | ||
2d72ffe932 | |||
7458dff00f | |||
76e7f12b7d | |||
2b6678b993 | |||
3b66ee89b0 | |||
00aaef36c5 | |||
06edec0e26 | |||
d7971a2924 | |||
5fb1ba1806 | |||
09cd0a6931 | |||
58c2988f12 | |||
6255476d24 | |||
dd78bfd8a9 | |||
a46043c632 | |||
81d1901820 | |||
e38f510fc7 | |||
914f84af4d | |||
299cb5e508 | |||
002df98ae2 | |||
19a055a06e | |||
9026191666 | |||
47c3b32cab | |||
227f42d6ca | |||
95c85e8ae6 | |||
b5e01d916b | |||
004afb329b | |||
cd9ac60b08 | |||
d4829e7085 | |||
6901b39847 | |||
f8d402ce8d | |||
815a70b24f | |||
05e733d26e | |||
26cfaf6afd | |||
ce70e24278 | |||
bf8cdd278a | |||
920f45062d | |||
eef5c85efb | |||
51b7183477 | |||
4b8ff6766a | |||
1530ffb968 | |||
3f4743c9d0 | |||
5eb0da07cf | |||
126b944c0b | |||
02965e8877 | |||
2924da9f7d | |||
433f1bf6f1 | |||
a3a49e464d | |||
0494606e7e | |||
037b9cf74d | |||
1901bd5482 | |||
26d21333e3 | |||
3beddc02ad | |||
60f78e1cac | |||
6df99308c1 | |||
3547e19c2c | |||
2b1a66653d | |||
c6a2e45ba3 | |||
17c777a9ac | |||
40315fc237 | |||
|
00ee4b8ce3 | ||
|
e4fd77302c | ||
|
6658ba76bc | ||
|
ce693a4872 | ||
|
fbf5d9caed | ||
|
b032290d42 | ||
|
6a06afc78c | ||
|
cd37e83e8b | ||
|
33d3e50efd | ||
|
444722a469 | ||
|
99187318cf | ||
|
a4474f29ad | ||
|
abf9180efe | ||
|
9b2cb71c00 | ||
|
1e28cca03d | ||
|
ced44422e9 | ||
|
b1d1ff8e46 | ||
|
5a92ec4807 | ||
|
116548d4a1 | ||
|
fbd7aa1468 | ||
|
2ab6d4df92 | ||
|
9228d0d79f | ||
|
0da1eba5da | ||
|
848eb29268 | ||
|
8c87d02376 | ||
|
b5bb901fea | ||
|
ce8e36d874 | ||
|
8fc905a914 | ||
|
e173a53c7f | ||
|
0edb06f677 | ||
|
7be627aa05 | ||
|
0e09a836d3 | ||
|
9170e1e2f2 | ||
|
a3cbe17ccf | ||
|
e94c3b8bcd | ||
|
2af267744c | ||
|
483b197eb5 | ||
|
da3b3a372c | ||
|
f0d878b8a2 | ||
|
92abb3b304 | ||
|
3807c7106d | ||
|
37fa8a2f71 | ||
|
9ea35a00a9 | ||
|
e2877b3a04 | ||
|
8c92c1941d | ||
|
685c69599e | ||
|
137c32d0f2 | ||
|
2314f013d8 | ||
|
83d050ecdf | ||
|
b1d4290a00 | ||
|
f06f83bd57 | ||
|
90d5ce64d7 | ||
|
eb0271878b | ||
|
c98f008b1e | ||
|
e93e6fb5a3 | ||
|
c40dc12e8c | ||
|
fb9efccff1 | ||
|
08c631234c | ||
|
4c2c587c0a | ||
|
1eb5dafe1d | ||
|
643db6de4c | ||
|
d4c979c649 | ||
|
d1fb53de7d | ||
|
9e0818634f | ||
|
ed5afc2a28 | ||
|
71a8ed6bb0 | ||
|
66c73c08ab | ||
|
b7c7db8d3d | ||
|
fd23800043 | ||
|
5e34669153 | ||
|
a862f85599 | ||
|
eb34580110 | ||
|
41598088e8 | ||
|
bd524f38f4 |
76
README.md
Normal file
76
README.md
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
# dwm
|
||||||
|
|
||||||
|
This is my patched version of dwm. The base version is directly from
|
||||||
|
suckless.org.
|
||||||
|
This belongs to my larbs installation script and depends heavily on its scripts
|
||||||
|
and programs.
|
||||||
|
It is supposed to work in the environment after the larbs-base-installation.
|
||||||
|
This is my patched version of dwm. The base version is directly from suckless.org.
|
||||||
|
This repository is set up according to the
|
||||||
|
[suckless entry of my wiki](https://github.com/tiyn/wiki/blob/master/wiki/linux/suckless.md).
|
||||||
|
|
||||||
|
## Patches
|
||||||
|
|
||||||
|
The list below shows the currently applied patches to the master branch.
|
||||||
|
|
||||||
|
- dwm-activetagindicatorbar-6.2.diff (show bar as window indicator)
|
||||||
|
- dwm-actualfullscreen-20191112-cb3f58a.diff (enables true fullscreen)
|
||||||
|
- dwm-alpha-20180613-b69c870.diff (adds transparency)
|
||||||
|
- dwm-bottomstack-20160719-56a31dc.diff (adds bottomstack and bottomstackhorizontal layout)
|
||||||
|
- dwm-center-6.1.diff (adds ability to center floating windows at launch)
|
||||||
|
- dwm-cyclelayouts-20180524-6.2.diff (adds ability to cycle through layouts)
|
||||||
|
- dwm-deck-6.0.diff (adds deck layout)
|
||||||
|
- dwm-noborder-6.2.diff (removes border if there is only one window)
|
||||||
|
- dwm-notitle-6.2.diff (removes window title in the middle of the bar)
|
||||||
|
- dwm-pertag-20170513-ceac8c9.diff (allows having a layout/mwfact/barpos/nmaster per tag)
|
||||||
|
- dwm-quitprompt-20220718-6613d9f.diff (adds a confirmation prompt before exiting dwm)
|
||||||
|
- dwm-status2d-6.2.diff (adds colors and ability to draw rectangles)
|
||||||
|
- dwm-statusallmons-6.2.diff (display statusbar on every monitors)
|
||||||
|
- dwm-statuscmd-6.2.diff (enables dwmblocks compatibility)
|
||||||
|
- dwm-systray-6.2.diff (adds a systray to statusbar)
|
||||||
|
- dwm-zeroastag-22032023-0aea805.diff (adds a tenth tag on 0)
|
||||||
|
|
||||||
|
## Hotkeys
|
||||||
|
|
||||||
|
There are various shortcuts and hotkeys used in this version. Included in my
|
||||||
|
build are the following.
|
||||||
|
|
||||||
|
| ModKey | Shift | Key | Function |
|
||||||
|
| ------ | ----- | --- | -------- |
|
||||||
|
| Super | | h | (Tiling/Deck) Focus window higher in stack than current |
|
||||||
|
| Super | | j | (Tiling/Deck) Focus window lower in stack than current |
|
||||||
|
| Super | | k | (Tiling/Deck) Focus window higher in stack than current |
|
||||||
|
| Super | | l | (Tiling/Deck) Focus window lower in stack than current |
|
||||||
|
| Super | | 1/2/.../9/0 | Show tag 1/2/.../9/0 |
|
||||||
|
| Super | | . | Show monitor lower in stack |
|
||||||
|
| Super | | , | Show monitor higher in stack |
|
||||||
|
| Super | Shift | Escape | Quit dwm with call for confirmation |
|
||||||
|
| Super | Shift | b | Toggle dwmbar |
|
||||||
|
| Super | Shift | c | Enable deck(/card) layout |
|
||||||
|
| Super | Shift | d | Toggle floating/tiled for selected window |
|
||||||
|
| Super | Shift | f | Toggle fullscreen |
|
||||||
|
| Super | Shift | h | (Tiling/Deck) Make current window the master window |
|
||||||
|
| Super | Shift | j | (Tiling/Deck) Make current window the master window |
|
||||||
|
| Super | Shift | k | (Tiling/Deck) Make current window the master window |
|
||||||
|
| Super | Shift | m | Enable monocle layout |
|
||||||
|
| Super | Shift | o | (Tiling/Deck) Increase master window size |
|
||||||
|
| Super | Shift | q | Close current window |
|
||||||
|
| Super | Shift | t | Enable tiling layout |
|
||||||
|
| Super | Shift | u | Enable bottomstack layout |
|
||||||
|
| Super | Shift | v | Enable bottomstackhorizontal layout |
|
||||||
|
| Super | Shift | z | (Tiling/Deck) Decrease master window size |
|
||||||
|
| Super | Shift | 1/2/.../9/0 | Add current window to tag 1/2/.../9/0 |
|
||||||
|
| Super | Shift | . | Add to monitor lower in stack |
|
||||||
|
| Super | Shift | , | Add to monitor higher in stack |
|
||||||
|
| Alt | | Tab | (Tiling/Deck) Focus window lower in stack than current |
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
The following programs are required to be installed for full functionality.
|
||||||
|
|
||||||
|
- [dmenu](https://github.com/tiyn/dmenu)
|
||||||
|
|
||||||
|
The most basic way is to clone the repository and then invoke make.
|
||||||
|
|
||||||
|
- `git clone https://github.com/tiyn/dwm`
|
||||||
|
- `make clean install`
|
194
config.def.h
194
config.def.h
@@ -1,115 +1,151 @@
|
|||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
|
/* for media keys */
|
||||||
|
#include <X11/XF86keysym.h>
|
||||||
|
|
||||||
/* appearance */
|
/* appearance */
|
||||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
static const unsigned int snap = 32; /* snap pixel */
|
static const unsigned int snap = 32; /* snap pixel */
|
||||||
static const int showbar = 1; /* 0 means no bar */
|
static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
|
||||||
static const int topbar = 1; /* 0 means bottom bar */
|
static const unsigned int systrayspacing = 2; /* systray spacing */
|
||||||
static const char *fonts[] = { "monospace:size=10" };
|
static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/
|
||||||
static const char dmenufont[] = "monospace:size=10";
|
static const int showsystray = 1; /* 0 means no systray */
|
||||||
static const char col_gray1[] = "#222222";
|
static const int showbar = 1; /* 0 means no bar */
|
||||||
static const char col_gray2[] = "#444444";
|
static const int topbar = 1; /* 0 means bottom bar */
|
||||||
static const char col_gray3[] = "#bbbbbb";
|
static const char *fonts[] = { "monospace:size=10" };
|
||||||
static const char col_gray4[] = "#eeeeee";
|
static const char normbgcolor[] = "#0e0f14";
|
||||||
static const char col_cyan[] = "#005577";
|
static const char normbordercolor[] = "#363b47";
|
||||||
|
static const char normfgcolor[] = "#dfdfdf";
|
||||||
|
static const char selfgcolor[] = "#eeeeee";
|
||||||
|
static const char selbordercolor[] = "#555a63";
|
||||||
|
static const char selbgcolor[] = "#282828";
|
||||||
|
static const unsigned int baralpha = 0xff;
|
||||||
|
static const unsigned int borderalpha = OPAQUE;
|
||||||
|
|
||||||
static const char *colors[][3] = {
|
static const char *colors[][3] = {
|
||||||
/* fg bg border */
|
/* fg bg border */
|
||||||
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
|
[SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor },
|
||||||
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
[SchemeSel] = { selfgcolor, selbgcolor, selbordercolor },
|
||||||
|
};
|
||||||
|
|
||||||
|
static const unsigned int alphas[][3] = {
|
||||||
|
/* fg bg border */
|
||||||
|
[SchemeNorm] = { OPAQUE, baralpha, borderalpha },
|
||||||
|
[SchemeSel] = { OPAQUE, baralpha, borderalpha },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* tagging */
|
/* tagging */
|
||||||
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
static const char *tags[] = { "", "", "", "", "", "", "", "", "", "" };
|
||||||
|
|
||||||
static const Rule rules[] = {
|
static const Rule rules[] = {
|
||||||
/* xprop(1):
|
/* xprop(1):
|
||||||
* WM_CLASS(STRING) = instance, class
|
* WM_CLASS(STRING) = instance, class
|
||||||
* WM_NAME(STRING) = title
|
* WM_NAME(STRING) = title
|
||||||
*/
|
*/
|
||||||
/* class instance title tags mask isfloating monitor */
|
/* class instance title tags center float mon */
|
||||||
{ "Gimp", NULL, NULL, 0, 1, -1 },
|
{ "firefox", 0, 0, 1 << 1, 0, 0, -1 },
|
||||||
{ "Firefox", NULL, NULL, 1 << 8, 0, -1 },
|
{ "zen", 0, 0, 1 << 1, 0, 0, -1 },
|
||||||
|
{ "Lutris", 0, 0, 1 << 2, 0, 0, 0 },
|
||||||
|
{ "zenity", 0, 0, 0, 0, 1, -1 },
|
||||||
|
{ "steam", 0, 0, 1 << 2, 0, 0, 0 },
|
||||||
|
{ "discord", 0, 0, 1 << 2, 0, 0, 1 },
|
||||||
|
{ "TeamSpeak", 0, 0, 1 << 2, 0, 0, 1 },
|
||||||
|
{ "Element", 0, 0, 1 << 2, 0, 0, 1 },
|
||||||
|
{ "Signal", 0, 0, 1 << 4, 0, 0, 1 },
|
||||||
|
{ "TelegramDesktop", 0, 0, 1 << 4, 0, 0, 1 },
|
||||||
|
{ "threema-web", 0, 0, 1 << 4, 0, 0, 1 },
|
||||||
|
{ "thunderbird", 0, 0, 1 << 4, 0, 0, 1 },
|
||||||
|
{ "Sonixd", 0, 0, 1 << 8, 0, 0, 1 },
|
||||||
|
{ "KeePassXC", 0, "Unlock Database - KeePassXC", 1 << 1, 0, 0, 0 },
|
||||||
|
{ "KeePassXC", 0, 0, 1 << 9, 0, 0, 0 },
|
||||||
|
{ "easyeffects", 0, 0, 1 << 9, 0, 0, 1 },
|
||||||
|
{ "pavucontrol", 0, 0, 1 << 9, 0, 0, 1 },
|
||||||
|
{ "Onboard", 0, 0, 0, 0, 1, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* layout(s) */
|
/* layout(s) */
|
||||||
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
static const float mfact = 0.5; /* factor of master area size [0.05..0.95] */
|
||||||
static const int nmaster = 1; /* number of clients in master area */
|
static const int nmaster = 1; /* number of clients in master area */
|
||||||
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
||||||
|
|
||||||
static const Layout layouts[] = {
|
static const Layout layouts[] = {
|
||||||
/* symbol arrange function */
|
/* symbol arrange function */
|
||||||
{ "[]=", tile }, /* first entry is default */
|
{ "M", monocle },
|
||||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
{ "T", tile }, /* first entry is default */
|
||||||
{ "[M]", monocle },
|
{ "D", deck },
|
||||||
|
{ "B", bstack },
|
||||||
|
{ "B", bstackhoriz },
|
||||||
|
{ "F", NULL }, /* no layout function means floating behavior */
|
||||||
|
{ NULL, NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* key definitions */
|
/* key definitions */
|
||||||
#define MODKEY Mod1Mask
|
#define MODKEY Mod4Mask
|
||||||
#define TAGKEYS(KEY,TAG) \
|
#define TAGKEYS(KEY,TAG) \
|
||||||
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||||
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||||
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
|
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
|
||||||
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
|
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
|
||||||
|
|
||||||
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
|
/* 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 Key keys[] = {
|
static Key keys[] = {
|
||||||
/* modifier key function argument */
|
/* modifier key function argument */
|
||||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
{ MODKEY|ShiftMask, XK_Escape, quitprompt, {0} },
|
||||||
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
{ MODKEY|ShiftMask, XK_b, togglebar, {0} },
|
||||||
{ MODKEY, XK_b, togglebar, {0} },
|
{ MODKEY|ShiftMask, XK_c, setlayout, {.v = &layouts[2]} },
|
||||||
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
{ MODKEY|ShiftMask, XK_d, togglefloating, {0} },
|
||||||
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
{ MODKEY|ShiftMask, XK_f, togglefullscr, {0} },
|
||||||
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
|
{ MODKEY, XK_h, focusstack, {.i = -1} },
|
||||||
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
{ MODKEY|ShiftMask, XK_h, zoom, {0} },
|
||||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
{ MODKEY, XK_j, focusstack, {.i = +1} },
|
||||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
{ MODKEY|ShiftMask, XK_j, zoom, {0} },
|
||||||
{ MODKEY, XK_Return, zoom, {0} },
|
{ MODKEY, XK_k, focusstack, {.i = -1} },
|
||||||
{ MODKEY, XK_Tab, view, {0} },
|
{ MODKEY|ShiftMask, XK_k, zoom, {0} },
|
||||||
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
{ MODKEY, XK_l, focusstack, {.i = +1} },
|
||||||
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
{ MODKEY|ShiftMask, XK_m, setlayout, {.v = &layouts[0]} },
|
||||||
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
{ MODKEY|ShiftMask, XK_o, setmfact, {.f = +0.05} },
|
||||||
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
{ MODKEY|ShiftMask, XK_q, killclient, {0} },
|
||||||
{ MODKEY, XK_space, setlayout, {0} },
|
{ MODKEY|ShiftMask, XK_t, setlayout, {.v = &layouts[1]} },
|
||||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
{ MODKEY|ShiftMask, XK_u, setlayout, {.v = &layouts[3]} },
|
||||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
{ MODKEY|ShiftMask, XK_v, setlayout, {.v = &layouts[4]} },
|
||||||
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
{ MODKEY|ShiftMask, XK_z, setmfact, {.f = -0.05} },
|
||||||
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
{ MODKEY, XK_0, view, {.ui = ~0} },
|
||||||
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0} },
|
||||||
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
{ MODKEY, XK_comma, focusmon, {.i = -1} },
|
||||||
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
{ MODKEY, XK_period, focusmon, {.i = +1} },
|
||||||
TAGKEYS( XK_1, 0)
|
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1} },
|
||||||
TAGKEYS( XK_2, 1)
|
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1} },
|
||||||
TAGKEYS( XK_3, 2)
|
{ Mod1Mask, XK_Tab, focusstack, {.i = +1} },
|
||||||
TAGKEYS( XK_4, 3)
|
|
||||||
TAGKEYS( XK_5, 4)
|
TAGKEYS(XK_1, 0)
|
||||||
TAGKEYS( XK_6, 5)
|
TAGKEYS(XK_2, 1)
|
||||||
TAGKEYS( XK_7, 6)
|
TAGKEYS(XK_3, 2)
|
||||||
TAGKEYS( XK_8, 7)
|
TAGKEYS(XK_4, 3)
|
||||||
TAGKEYS( XK_9, 8)
|
TAGKEYS(XK_5, 4)
|
||||||
{ MODKEY|ShiftMask, XK_q, quitprompt, {0} },
|
TAGKEYS(XK_6, 5)
|
||||||
|
TAGKEYS(XK_7, 6)
|
||||||
|
TAGKEYS(XK_8, 7)
|
||||||
|
TAGKEYS(XK_9, 8)
|
||||||
|
TAGKEYS(XK_0, 9)
|
||||||
};
|
};
|
||||||
|
|
||||||
/* button definitions */
|
/* button definitions */
|
||||||
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
|
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkClientWin, or ClkRootWin */
|
||||||
static Button buttons[] = {
|
static Button buttons[] = {
|
||||||
/* click event mask button function argument */
|
/* click event mask button function argument */
|
||||||
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
{ ClkLtSymbol, 0, Button1, cyclelayout, {.i = +1} },
|
||||||
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
{ ClkLtSymbol, 0, Button2, focusstack, {.i = +1} },
|
||||||
{ ClkWinTitle, 0, Button2, zoom, {0} },
|
{ ClkLtSymbol, 0, Button3, cyclelayout, {.i = -1} },
|
||||||
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
{ ClkStatusText, 0, Button1, sigdwmblocks, {.i = 1} },
|
||||||
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
{ ClkStatusText, 0, Button2, sigdwmblocks, {.i = 2} },
|
||||||
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
{ ClkStatusText, 0, Button3, sigdwmblocks, {.i = 3} },
|
||||||
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||||
{ ClkTagBar, 0, Button1, view, {0} },
|
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
||||||
{ ClkTagBar, 0, Button3, toggleview, {0} },
|
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
||||||
{ ClkTagBar, MODKEY, Button1, tag, {0} },
|
{ ClkTagBar, 0, Button1, view, {0} },
|
||||||
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
|
{ ClkTagBar, 0, Button3, toggleview, {0} },
|
||||||
|
{ ClkTagBar, MODKEY, Button1, tag, {0} },
|
||||||
|
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -22,7 +22,7 @@ FREETYPEINC = /usr/include/freetype2
|
|||||||
|
|
||||||
# includes and libs
|
# includes and libs
|
||||||
INCS = -I${X11INC} -I${FREETYPEINC}
|
INCS = -I${X11INC} -I${FREETYPEINC}
|
||||||
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}
|
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lXrender
|
||||||
|
|
||||||
# flags
|
# flags
|
||||||
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
|
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
|
||||||
|
30
drw.c
30
drw.c
@@ -61,7 +61,7 @@ utf8decode(const char *c, long *u, size_t clen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Drw *
|
Drw *
|
||||||
drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h)
|
drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap)
|
||||||
{
|
{
|
||||||
Drw *drw = ecalloc(1, sizeof(Drw));
|
Drw *drw = ecalloc(1, sizeof(Drw));
|
||||||
|
|
||||||
@@ -70,8 +70,11 @@ drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h
|
|||||||
drw->root = root;
|
drw->root = root;
|
||||||
drw->w = w;
|
drw->w = w;
|
||||||
drw->h = h;
|
drw->h = h;
|
||||||
drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen));
|
drw->visual = visual;
|
||||||
drw->gc = XCreateGC(dpy, root, 0, NULL);
|
drw->depth = depth;
|
||||||
|
drw->cmap = cmap;
|
||||||
|
drw->drawable = XCreatePixmap(dpy, root, w, h, depth);
|
||||||
|
drw->gc = XCreateGC(dpy, drw->drawable, 0, NULL);
|
||||||
XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
|
XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
|
||||||
|
|
||||||
return drw;
|
return drw;
|
||||||
@@ -87,7 +90,7 @@ drw_resize(Drw *drw, unsigned int w, unsigned int h)
|
|||||||
drw->h = h;
|
drw->h = h;
|
||||||
if (drw->drawable)
|
if (drw->drawable)
|
||||||
XFreePixmap(drw->dpy, drw->drawable);
|
XFreePixmap(drw->dpy, drw->drawable);
|
||||||
drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen));
|
drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, drw->depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -139,11 +142,11 @@ xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
|
|||||||
* https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916349
|
* https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916349
|
||||||
* and lots more all over the internet.
|
* and lots more all over the internet.
|
||||||
*/
|
*/
|
||||||
FcBool iscol;
|
/*FcBool iscol;
|
||||||
if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) {
|
if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) {
|
||||||
XftFontClose(drw->dpy, xfont);
|
XftFontClose(drw->dpy, xfont);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
font = ecalloc(1, sizeof(Fnt));
|
font = ecalloc(1, sizeof(Fnt));
|
||||||
font->xfont = xfont;
|
font->xfont = xfont;
|
||||||
@@ -193,21 +196,22 @@ drw_fontset_free(Fnt *font)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
|
drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha)
|
||||||
{
|
{
|
||||||
if (!drw || !dest || !clrname)
|
if (!drw || !dest || !clrname)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
|
if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap,
|
||||||
DefaultColormap(drw->dpy, drw->screen),
|
|
||||||
clrname, dest))
|
clrname, dest))
|
||||||
die("error, cannot allocate color '%s'", clrname);
|
die("error, cannot allocate color '%s'", clrname);
|
||||||
|
|
||||||
|
dest->pixel = (dest->pixel & 0x00ffffffU) | (alpha << 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wrapper to create color schemes. The caller has to call free(3) on the
|
/* Wrapper to create color schemes. The caller has to call free(3) on the
|
||||||
* returned color scheme when done using it. */
|
* returned color scheme when done using it. */
|
||||||
Clr *
|
Clr *
|
||||||
drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
|
drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
Clr *ret;
|
Clr *ret;
|
||||||
@@ -217,7 +221,7 @@ drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = 0; i < clrcount; i++)
|
for (i = 0; i < clrcount; i++)
|
||||||
drw_clr_create(drw, &ret[i], clrnames[i]);
|
drw_clr_create(drw, &ret[i], clrnames[i], alphas[i]);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,9 +277,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
|||||||
} else {
|
} else {
|
||||||
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
|
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
|
||||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
|
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
|
||||||
d = XftDrawCreate(drw->dpy, drw->drawable,
|
d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap);
|
||||||
DefaultVisual(drw->dpy, drw->screen),
|
|
||||||
DefaultColormap(drw->dpy, drw->screen));
|
|
||||||
x += lpad;
|
x += lpad;
|
||||||
w -= lpad;
|
w -= lpad;
|
||||||
}
|
}
|
||||||
|
9
drw.h
9
drw.h
@@ -20,6 +20,9 @@ typedef struct {
|
|||||||
Display *dpy;
|
Display *dpy;
|
||||||
int screen;
|
int screen;
|
||||||
Window root;
|
Window root;
|
||||||
|
Visual *visual;
|
||||||
|
unsigned int depth;
|
||||||
|
Colormap cmap;
|
||||||
Drawable drawable;
|
Drawable drawable;
|
||||||
GC gc;
|
GC gc;
|
||||||
Clr *scheme;
|
Clr *scheme;
|
||||||
@@ -27,7 +30,7 @@ typedef struct {
|
|||||||
} Drw;
|
} Drw;
|
||||||
|
|
||||||
/* Drawable abstraction */
|
/* Drawable abstraction */
|
||||||
Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h);
|
Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap);
|
||||||
void drw_resize(Drw *drw, unsigned int w, unsigned int h);
|
void drw_resize(Drw *drw, unsigned int w, unsigned int h);
|
||||||
void drw_free(Drw *drw);
|
void drw_free(Drw *drw);
|
||||||
|
|
||||||
@@ -38,8 +41,8 @@ unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
|
|||||||
void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
|
void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
|
||||||
|
|
||||||
/* Colorscheme abstraction */
|
/* Colorscheme abstraction */
|
||||||
void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
|
void drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha);
|
||||||
Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount);
|
Clr *drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount);
|
||||||
|
|
||||||
/* Cursor abstraction */
|
/* Cursor abstraction */
|
||||||
Cur *drw_cur_create(Drw *drw, int shape);
|
Cur *drw_cur_create(Drw *drw, int shape);
|
||||||
|
17
dwm-activetagindicatorbar-6.2.diff
Normal file
17
dwm-activetagindicatorbar-6.2.diff
Normal file
@@ -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);
|
53
dwm-actualfullscreen-20191112-cb3f58a.diff
Normal file
53
dwm-actualfullscreen-20191112-cb3f58a.diff
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
From 3a16816a6f5d38014c2a06ce395873c545c8789a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Soenke Lambert <s.lambert@mittwald.de>
|
||||||
|
Date: Tue, 12 Nov 2019 10:44:02 +0100
|
||||||
|
Subject: [PATCH] Fullscreen current window with [Alt]+[Shift]+[f]
|
||||||
|
|
||||||
|
This actually fullscreens a window, instead of just hiding the statusbar
|
||||||
|
and applying the monocle layout.
|
||||||
|
---
|
||||||
|
config.def.h | 1 +
|
||||||
|
dwm.c | 8 ++++++++
|
||||||
|
2 files changed, 9 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 1c0b587..8cd3204 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -78,6 +78,7 @@ static Key keys[] = {
|
||||||
|
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||||
|
{ MODKEY, XK_space, setlayout, {0} },
|
||||||
|
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||||
|
+ { MODKEY|ShiftMask, XK_f, togglefullscr, {0} },
|
||||||
|
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
||||||
|
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||||
|
diff --git a/dwm.c b/dwm.c
|
||||||
|
index 4465af1..c1b899a 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -211,6 +211,7 @@ static void tagmon(const Arg *arg);
|
||||||
|
static void tile(Monitor *);
|
||||||
|
static void togglebar(const Arg *arg);
|
||||||
|
static void togglefloating(const Arg *arg);
|
||||||
|
+static void togglefullscr(const Arg *arg);
|
||||||
|
static void toggletag(const Arg *arg);
|
||||||
|
static void toggleview(const Arg *arg);
|
||||||
|
static void unfocus(Client *c, int setfocus);
|
||||||
|
@@ -1719,6 +1720,13 @@ togglefloating(const Arg *arg)
|
||||||
|
arrange(selmon);
|
||||||
|
}
|
||||||
|
|
||||||
|
+void
|
||||||
|
+togglefullscr(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ if(selmon->sel)
|
||||||
|
+ setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
toggletag(const Arg *arg)
|
||||||
|
{
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
289
dwm-alpha-20180613-b69c870.diff
Normal file
289
dwm-alpha-20180613-b69c870.diff
Normal file
@@ -0,0 +1,289 @@
|
|||||||
|
From f699934b8c8a9c15988ad359bf8fedd6c55abd53 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Thomas Oltmann <thomas.oltmann.hhg@gmail.com>
|
||||||
|
Date: Wed, 13 Jun 2018 19:46:26 +0200
|
||||||
|
Subject: [PATCH] Allow dwm to have translucent bars, while keeping all the
|
||||||
|
text on it opaque, just like the alpha-patch for st. Updated for b69c870.
|
||||||
|
|
||||||
|
---
|
||||||
|
config.def.h | 7 ++++++
|
||||||
|
config.mk | 2 +-
|
||||||
|
drw.c | 26 ++++++++++++-----------
|
||||||
|
drw.h | 9 +++++---
|
||||||
|
dwm.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++------
|
||||||
|
5 files changed, 82 insertions(+), 22 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 1c0b587..4f68fe8 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -12,11 +12,18 @@ 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 unsigned int baralpha = 0xd0;
|
||||||
|
+static const unsigned int borderalpha = OPAQUE;
|
||||||
|
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 alphas[][3] = {
|
||||||
|
+ /* fg bg border */
|
||||||
|
+ [SchemeNorm] = { OPAQUE, baralpha, borderalpha },
|
||||||
|
+ [SchemeSel] = { OPAQUE, baralpha, borderalpha },
|
||||||
|
+};
|
||||||
|
|
||||||
|
/* tagging */
|
||||||
|
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||||
|
diff --git a/config.mk b/config.mk
|
||||||
|
index 25e2685..bef8de0 100644
|
||||||
|
--- a/config.mk
|
||||||
|
+++ b/config.mk
|
||||||
|
@@ -22,7 +22,7 @@ FREETYPEINC = /usr/include/freetype2
|
||||||
|
|
||||||
|
# includes and libs
|
||||||
|
INCS = -I${X11INC} -I${FREETYPEINC}
|
||||||
|
-LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}
|
||||||
|
+LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lXrender
|
||||||
|
|
||||||
|
# flags
|
||||||
|
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
|
||||||
|
diff --git a/drw.c b/drw.c
|
||||||
|
index c638323..77fc113 100644
|
||||||
|
--- a/drw.c
|
||||||
|
+++ b/drw.c
|
||||||
|
@@ -61,7 +61,7 @@ utf8decode(const char *c, long *u, size_t clen)
|
||||||
|
}
|
||||||
|
|
||||||
|
Drw *
|
||||||
|
-drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h)
|
||||||
|
+drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap)
|
||||||
|
{
|
||||||
|
Drw *drw = ecalloc(1, sizeof(Drw));
|
||||||
|
|
||||||
|
@@ -70,8 +70,11 @@ drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h
|
||||||
|
drw->root = root;
|
||||||
|
drw->w = w;
|
||||||
|
drw->h = h;
|
||||||
|
- drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen));
|
||||||
|
- drw->gc = XCreateGC(dpy, root, 0, NULL);
|
||||||
|
+ drw->visual = visual;
|
||||||
|
+ drw->depth = depth;
|
||||||
|
+ drw->cmap = cmap;
|
||||||
|
+ drw->drawable = XCreatePixmap(dpy, root, w, h, depth);
|
||||||
|
+ drw->gc = XCreateGC(dpy, drw->drawable, 0, NULL);
|
||||||
|
XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
|
||||||
|
|
||||||
|
return drw;
|
||||||
|
@@ -87,7 +90,7 @@ drw_resize(Drw *drw, unsigned int w, unsigned int h)
|
||||||
|
drw->h = h;
|
||||||
|
if (drw->drawable)
|
||||||
|
XFreePixmap(drw->dpy, drw->drawable);
|
||||||
|
- drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen));
|
||||||
|
+ drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, drw->depth);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
@@ -180,21 +183,22 @@ drw_fontset_free(Fnt *font)
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
-drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
|
||||||
|
+drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha)
|
||||||
|
{
|
||||||
|
if (!drw || !dest || !clrname)
|
||||||
|
return;
|
||||||
|
|
||||||
|
- if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
|
||||||
|
- DefaultColormap(drw->dpy, drw->screen),
|
||||||
|
+ if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap,
|
||||||
|
clrname, dest))
|
||||||
|
die("error, cannot allocate color '%s'", clrname);
|
||||||
|
+
|
||||||
|
+ dest->pixel = (dest->pixel & 0x00ffffffU) | (alpha << 24);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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, const char *clrnames[], size_t clrcount)
|
||||||
|
+drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
Clr *ret;
|
||||||
|
@@ -204,7 +208,7 @@ drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
for (i = 0; i < clrcount; i++)
|
||||||
|
- drw_clr_create(drw, &ret[i], clrnames[i]);
|
||||||
|
+ drw_clr_create(drw, &ret[i], clrnames[i], alphas[i]);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -260,9 +264,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
||||||
|
} else {
|
||||||
|
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
|
||||||
|
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
|
||||||
|
- d = XftDrawCreate(drw->dpy, drw->drawable,
|
||||||
|
- DefaultVisual(drw->dpy, drw->screen),
|
||||||
|
- DefaultColormap(drw->dpy, drw->screen));
|
||||||
|
+ d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap);
|
||||||
|
x += lpad;
|
||||||
|
w -= lpad;
|
||||||
|
}
|
||||||
|
diff --git a/drw.h b/drw.h
|
||||||
|
index 4bcd5ad..a56f523 100644
|
||||||
|
--- a/drw.h
|
||||||
|
+++ b/drw.h
|
||||||
|
@@ -20,6 +20,9 @@ typedef struct {
|
||||||
|
Display *dpy;
|
||||||
|
int screen;
|
||||||
|
Window root;
|
||||||
|
+ Visual *visual;
|
||||||
|
+ unsigned int depth;
|
||||||
|
+ Colormap cmap;
|
||||||
|
Drawable drawable;
|
||||||
|
GC gc;
|
||||||
|
Clr *scheme;
|
||||||
|
@@ -27,7 +30,7 @@ typedef struct {
|
||||||
|
} Drw;
|
||||||
|
|
||||||
|
/* Drawable abstraction */
|
||||||
|
-Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h);
|
||||||
|
+Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap);
|
||||||
|
void drw_resize(Drw *drw, unsigned int w, unsigned int h);
|
||||||
|
void drw_free(Drw *drw);
|
||||||
|
|
||||||
|
@@ -38,8 +41,8 @@ unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
|
||||||
|
void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
|
||||||
|
|
||||||
|
/* Colorscheme abstraction */
|
||||||
|
-void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
|
||||||
|
-Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount);
|
||||||
|
+void drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha);
|
||||||
|
+Clr *drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount);
|
||||||
|
|
||||||
|
/* Cursor abstraction */
|
||||||
|
Cur *drw_cur_create(Drw *drw, int shape);
|
||||||
|
diff --git a/dwm.c b/dwm.c
|
||||||
|
index 4465af1..20f8309 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -57,6 +57,8 @@
|
||||||
|
#define TAGMASK ((1 << LENGTH(tags)) - 1)
|
||||||
|
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
|
||||||
|
|
||||||
|
+#define OPAQUE 0xffU
|
||||||
|
+
|
||||||
|
/* enums */
|
||||||
|
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
|
||||||
|
enum { SchemeNorm, SchemeSel }; /* color schemes */
|
||||||
|
@@ -232,6 +234,7 @@ 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 xinitvisual();
|
||||||
|
static void zoom(const Arg *arg);
|
||||||
|
|
||||||
|
/* variables */
|
||||||
|
@@ -268,6 +271,11 @@ static Drw *drw;
|
||||||
|
static Monitor *mons, *selmon;
|
||||||
|
static Window root, wmcheckwin;
|
||||||
|
|
||||||
|
+static int useargb = 0;
|
||||||
|
+static Visual *visual;
|
||||||
|
+static int depth;
|
||||||
|
+static Colormap cmap;
|
||||||
|
+
|
||||||
|
/* configuration, allows nested code to access above variables */
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
@@ -1541,7 +1549,8 @@ setup(void)
|
||||||
|
sw = DisplayWidth(dpy, screen);
|
||||||
|
sh = DisplayHeight(dpy, screen);
|
||||||
|
root = RootWindow(dpy, screen);
|
||||||
|
- drw = drw_create(dpy, screen, root, sw, sh);
|
||||||
|
+ xinitvisual();
|
||||||
|
+ drw = drw_create(dpy, screen, root, sw, sh, visual, depth, cmap);
|
||||||
|
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
|
||||||
|
die("no fonts could be loaded.");
|
||||||
|
lrpad = drw->fonts->h;
|
||||||
|
@@ -1569,7 +1578,7 @@ setup(void)
|
||||||
|
/* init appearance */
|
||||||
|
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
|
||||||
|
for (i = 0; i < LENGTH(colors); i++)
|
||||||
|
- scheme[i] = drw_scm_create(drw, colors[i], 3);
|
||||||
|
+ scheme[i] = drw_scm_create(drw, colors[i], alphas[i], 3);
|
||||||
|
/* init bars */
|
||||||
|
updatebars();
|
||||||
|
updatestatus();
|
||||||
|
@@ -1804,16 +1813,18 @@ updatebars(void)
|
||||||
|
Monitor *m;
|
||||||
|
XSetWindowAttributes wa = {
|
||||||
|
.override_redirect = True,
|
||||||
|
- .background_pixmap = ParentRelative,
|
||||||
|
+ .background_pixel = 0,
|
||||||
|
+ .border_pixel = 0,
|
||||||
|
+ .colormap = cmap,
|
||||||
|
.event_mask = ButtonPressMask|ExposureMask
|
||||||
|
};
|
||||||
|
XClassHint ch = {"dwm", "dwm"};
|
||||||
|
for (m = mons; m; m = m->next) {
|
||||||
|
if (m->barwin)
|
||||||
|
continue;
|
||||||
|
- m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),
|
||||||
|
- CopyFromParent, DefaultVisual(dpy, screen),
|
||||||
|
- CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
|
||||||
|
+ m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, depth,
|
||||||
|
+ InputOutput, visual,
|
||||||
|
+ CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa);
|
||||||
|
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
|
||||||
|
XMapRaised(dpy, m->barwin);
|
||||||
|
XSetClassHint(dpy, m->barwin, &ch);
|
||||||
|
@@ -2110,6 +2121,43 @@ xerrorstart(Display *dpy, XErrorEvent *ee)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+void
|
||||||
|
+xinitvisual()
|
||||||
|
+{
|
||||||
|
+ XVisualInfo *infos;
|
||||||
|
+ XRenderPictFormat *fmt;
|
||||||
|
+ int nitems;
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ XVisualInfo tpl = {
|
||||||
|
+ .screen = screen,
|
||||||
|
+ .depth = 32,
|
||||||
|
+ .class = TrueColor
|
||||||
|
+ };
|
||||||
|
+ long masks = VisualScreenMask | VisualDepthMask | VisualClassMask;
|
||||||
|
+
|
||||||
|
+ infos = XGetVisualInfo(dpy, masks, &tpl, &nitems);
|
||||||
|
+ visual = NULL;
|
||||||
|
+ for(i = 0; i < nitems; i ++) {
|
||||||
|
+ fmt = XRenderFindVisualFormat(dpy, infos[i].visual);
|
||||||
|
+ if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) {
|
||||||
|
+ visual = infos[i].visual;
|
||||||
|
+ depth = infos[i].depth;
|
||||||
|
+ cmap = XCreateColormap(dpy, root, visual, AllocNone);
|
||||||
|
+ useargb = 1;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ XFree(infos);
|
||||||
|
+
|
||||||
|
+ if (! visual) {
|
||||||
|
+ visual = DefaultVisual(dpy, screen);
|
||||||
|
+ depth = DefaultDepth(dpy, screen);
|
||||||
|
+ cmap = DefaultColormap(dpy, screen);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
zoom(const Arg *arg)
|
||||||
|
{
|
||||||
|
--
|
||||||
|
2.17.0
|
||||||
|
|
101
dwm-bottomstack-20160719-56a31dc.diff
Normal file
101
dwm-bottomstack-20160719-56a31dc.diff
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index fd77a07..c3a044b 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -41,6 +41,8 @@ static const Layout layouts[] = {
|
||||||
|
{ "[]=", tile }, /* first entry is default */
|
||||||
|
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||||
|
{ "[M]", monocle },
|
||||||
|
+ { "TTT", bstack },
|
||||||
|
+ { "===", bstackhoriz },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* key definitions */
|
||||||
|
@@ -76,6 +78,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 b2bc9bd..8b74165 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -234,6 +234,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";
|
||||||
|
@@ -2138,3 +2140,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);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
58
dwm-center-6.1.diff
Normal file
58
dwm-center-6.1.diff
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 7054c06..e0cdcf3 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -24,9 +24,9 @@ static const Rule rules[] = {
|
||||||
|
* 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 },
|
||||||
|
+ /* class instance title tags mask iscentered isfloating monitor */
|
||||||
|
+ { "Gimp", NULL, NULL, 0, 0, 1, -1 },
|
||||||
|
+ { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1 },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* layout(s) */
|
||||||
|
diff --git a/dwm.c b/dwm.c
|
||||||
|
index 0362114..4aaaa60 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -92,7 +92,7 @@ struct Client {
|
||||||
|
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
||||||
|
int bw, oldbw;
|
||||||
|
unsigned int tags;
|
||||||
|
- int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
|
||||||
|
+ int isfixed, iscentered, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
|
||||||
|
Client *next;
|
||||||
|
Client *snext;
|
||||||
|
Monitor *mon;
|
||||||
|
@@ -137,6 +137,7 @@ typedef struct {
|
||||||
|
const char *instance;
|
||||||
|
const char *title;
|
||||||
|
unsigned int tags;
|
||||||
|
+ int iscentered;
|
||||||
|
int isfloating;
|
||||||
|
int monitor;
|
||||||
|
} Rule;
|
||||||
|
@@ -296,6 +297,7 @@ applyrules(Client *c)
|
||||||
|
&& (!r->class || strstr(class, r->class))
|
||||||
|
&& (!r->instance || strstr(instance, r->instance)))
|
||||||
|
{
|
||||||
|
+ c->iscentered = r->iscentered;
|
||||||
|
c->isfloating = r->isfloating;
|
||||||
|
c->tags |= r->tags;
|
||||||
|
for (m = mons; m && m->num != r->monitor; m = m->next);
|
||||||
|
@@ -1063,6 +1065,11 @@ manage(Window w, XWindowAttributes *wa)
|
||||||
|
&& (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
|
||||||
|
c->bw = borderpx;
|
||||||
|
|
||||||
|
+ if(c->iscentered) {
|
||||||
|
+ c->x = (c->mon->mw - WIDTH(c)) / 2;
|
||||||
|
+ c->y = (c->mon->mh - HEIGHT(c)) / 2;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
wc.border_width = c->bw;
|
||||||
|
XConfigureWindow(dpy, w, CWBorderWidth, &wc);
|
||||||
|
XSetWindowBorder(dpy, w, scheme[SchemeNorm].border->pix);
|
93
dwm-cyclelayouts-20180524-6.2.diff
Normal file
93
dwm-cyclelayouts-20180524-6.2.diff
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
From a09e766a4342f580582082a92b2de65f33208eb4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Christopher Drelich <cd@cdrakka.com>
|
||||||
|
Date: Thu, 24 May 2018 00:56:56 -0400
|
||||||
|
Subject: [PATCH] Function to cycle through available layouts.
|
||||||
|
|
||||||
|
MOD-CTRL-, and MOD-CTRL-.
|
||||||
|
cycle backwards and forwards through available layouts.
|
||||||
|
Probably only useful if you have a lot of additional layouts.
|
||||||
|
The NULL, NULL layout should always be the last layout in your list,
|
||||||
|
in order to guarantee consistent behavior.
|
||||||
|
---
|
||||||
|
config.def.h | 3 +++
|
||||||
|
dwm.1 | 6 ++++++
|
||||||
|
dwm.c | 18 ++++++++++++++++++
|
||||||
|
3 files changed, 27 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index a9ac303..153b880 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -41,6 +41,7 @@ static const Layout layouts[] = {
|
||||||
|
{ "[]=", tile }, /* first entry is default */
|
||||||
|
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||||
|
{ "[M]", monocle },
|
||||||
|
+ { NULL, NULL },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* key definitions */
|
||||||
|
@@ -76,6 +77,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|ControlMask, XK_comma, cyclelayout, {.i = -1 } },
|
||||||
|
+ { MODKEY|ControlMask, XK_period, cyclelayout, {.i = +1 } },
|
||||||
|
{ MODKEY, XK_space, setlayout, {0} },
|
||||||
|
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||||
|
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||||
|
diff --git a/dwm.1 b/dwm.1
|
||||||
|
index 13b3729..165891b 100644
|
||||||
|
--- a/dwm.1
|
||||||
|
+++ b/dwm.1
|
||||||
|
@@ -92,6 +92,12 @@ Sets monocle layout.
|
||||||
|
.B Mod1\-space
|
||||||
|
Toggles between current and previous layout.
|
||||||
|
.TP
|
||||||
|
+.B Mod1\-Control\-,
|
||||||
|
+Cycles backwards in layout list.
|
||||||
|
+.TP
|
||||||
|
+.B Mod1\-Control\-.
|
||||||
|
+Cycles forwards in layout list.
|
||||||
|
+.TP
|
||||||
|
.B Mod1\-j
|
||||||
|
Focus next window.
|
||||||
|
.TP
|
||||||
|
diff --git a/dwm.c b/dwm.c
|
||||||
|
index bb95e26..db73000 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -157,6 +157,7 @@ static void configure(Client *c);
|
||||||
|
static void configurenotify(XEvent *e);
|
||||||
|
static void configurerequest(XEvent *e);
|
||||||
|
static Monitor *createmon(void);
|
||||||
|
+static void cyclelayout(const Arg *arg);
|
||||||
|
static void destroynotify(XEvent *e);
|
||||||
|
static void detach(Client *c);
|
||||||
|
static void detachstack(Client *c);
|
||||||
|
@@ -645,6 +646,23 @@ createmon(void)
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
+cyclelayout(const Arg *arg) {
|
||||||
|
+ Layout *l;
|
||||||
|
+ for(l = (Layout *)layouts; l != selmon->lt[selmon->sellt]; l++);
|
||||||
|
+ if(arg->i > 0) {
|
||||||
|
+ if(l->symbol && (l + 1)->symbol)
|
||||||
|
+ setlayout(&((Arg) { .v = (l + 1) }));
|
||||||
|
+ else
|
||||||
|
+ setlayout(&((Arg) { .v = layouts }));
|
||||||
|
+ } else {
|
||||||
|
+ if(l != layouts && (l - 1)->symbol)
|
||||||
|
+ setlayout(&((Arg) { .v = (l - 1) }));
|
||||||
|
+ else
|
||||||
|
+ setlayout(&((Arg) { .v = &layouts[LENGTH(layouts) - 2] }));
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
destroynotify(XEvent *e)
|
||||||
|
{
|
||||||
|
Client *c;
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
90
dwm-deck-6.0.diff
Normal file
90
dwm-deck-6.0.diff
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
From cb3cac91db32403bb581aecbc2957b00bb49c898 Mon Sep 17 00:00:00 2001
|
||||||
|
From: aleks <aleks.stier@icloud.com>
|
||||||
|
Date: Mon, 6 May 2019 16:34:58 +0200
|
||||||
|
Subject: [PATCH] Add deck-layout
|
||||||
|
|
||||||
|
deck is a dwm-layout which is inspired by the TTWM window manager.
|
||||||
|
It applies the monocle-layout to the clients in the stack.
|
||||||
|
The master-client is still visible. The stacked clients are like
|
||||||
|
a deck of cards, hence the name.
|
||||||
|
|
||||||
|
The vanilla patch doesn't work properly with patches which add gaps.
|
||||||
|
This means that when the deck-layout is activated gaps are omitted.
|
||||||
|
To make it work with the tilegap-patch apply the dwm-deck-tilegap patch
|
||||||
|
on top of the dwm-deck patch.
|
||||||
|
|
||||||
|
The vanilla patch doesn't respect the master-area which is defined by
|
||||||
|
the rmaster-patch. To make it work with the rmaster-patch apply the
|
||||||
|
dwm-deck-rmaster patch on top of the dwm-deck patch.
|
||||||
|
---
|
||||||
|
config.def.h | 2 ++
|
||||||
|
dwm.c | 26 ++++++++++++++++++++++++++
|
||||||
|
2 files changed, 28 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 77ff358..55d8a07 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -32,6 +32,7 @@ static const Layout layouts[] = {
|
||||||
|
{ "[]=", tile }, /* first entry is default */
|
||||||
|
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||||
|
{ "[M]", monocle },
|
||||||
|
+ { "[D]", deck },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* key definitions */
|
||||||
|
@@ -66,6 +67,7 @@ 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_c, setlayout, {.v = &layouts[3]} },
|
||||||
|
{ 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 1d78655..356ab44 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -171,6 +171,7 @@ static void configure(Client *c);
|
||||||
|
static void configurenotify(XEvent *e);
|
||||||
|
static void configurerequest(XEvent *e);
|
||||||
|
static Monitor *createmon(void);
|
||||||
|
+static void deck(Monitor *m);
|
||||||
|
static void destroynotify(XEvent *e);
|
||||||
|
static void detach(Client *c);
|
||||||
|
static void detachstack(Client *c);
|
||||||
|
@@ -669,6 +670,31 @@ destroynotify(XEvent *e) {
|
||||||
|
unmanage(c, True);
|
||||||
|
}
|
||||||
|
|
||||||
|
+void
|
||||||
|
+deck(Monitor *m) {
|
||||||
|
+ unsigned int i, n, h, mw, my;
|
||||||
|
+ 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;
|
||||||
|
+ snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ mw = m->ww;
|
||||||
|
+ for(i = my = 0, 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), False);
|
||||||
|
+ my += HEIGHT(c);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ resize(c, m->wx + mw, m->wy, m->ww - mw - (2*c->bw), m->wh - (2*c->bw), False);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
detach(Client *c) {
|
||||||
|
Client **tc;
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
30
dwm-noborder-6.2.diff
Normal file
30
dwm-noborder-6.2.diff
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
From 9102fdb9c670218373bbe83c891c8e8138d6a6f4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: redacted <redacted@example.com>
|
||||||
|
Date: Tue, 23 Apr 2019 00:39:27 +0100
|
||||||
|
Subject: [PATCH] added noborder patch
|
||||||
|
|
||||||
|
---
|
||||||
|
dwm.c | 7 +++++++
|
||||||
|
1 file changed, 7 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/dwm.c b/dwm.c
|
||||||
|
index 4465af1..685eca1 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -1282,6 +1282,13 @@ resizeclient(Client *c, int x, int y, int w, int h)
|
||||||
|
c->oldw = c->w; c->w = wc.width = w;
|
||||||
|
c->oldh = c->h; c->h = wc.height = h;
|
||||||
|
wc.border_width = c->bw;
|
||||||
|
+ if (((nexttiled(c->mon->clients) == c && !nexttiled(c->next))
|
||||||
|
+ || &monocle == c->mon->lt[c->mon->sellt]->arrange)
|
||||||
|
+ && !c->isfullscreen && !c->isfloating) {
|
||||||
|
+ c->w = wc.width += c->bw * 2;
|
||||||
|
+ c->h = wc.height += c->bw * 2;
|
||||||
|
+ wc.border_width = 0;
|
||||||
|
+ }
|
||||||
|
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
|
||||||
|
configure(c);
|
||||||
|
XSync(dpy, False);
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
81
dwm-notitle-6.2.diff
Normal file
81
dwm-notitle-6.2.diff
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
From 969dbbc548f16da5d94630e3d54e9c96c5296520 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ryan Kes <alrayyes@gmail.com>
|
||||||
|
Date: Thu, 28 Mar 2019 14:36:07 +0100
|
||||||
|
Subject: [PATCH] dwm-notitle-6.2
|
||||||
|
|
||||||
|
---
|
||||||
|
config.def.h | 1 -
|
||||||
|
dwm.c | 20 ++++----------------
|
||||||
|
2 files changed, 4 insertions(+), 17 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 1c0b587..19330cd 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -102,7 +102,6 @@ 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} },
|
||||||
|
diff --git a/dwm.c b/dwm.c
|
||||||
|
index 4465af1..bcf5cb1 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -64,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, ClkWinTitle,
|
||||||
|
- ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
|
||||||
|
+enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkClientWin,
|
||||||
|
+ ClkRootWin, ClkLast }; /* clicks */
|
||||||
|
|
||||||
|
typedef union {
|
||||||
|
int i;
|
||||||
|
@@ -439,10 +439,8 @@ buttonpress(XEvent *e)
|
||||||
|
arg.ui = 1 << i;
|
||||||
|
} else if (ev->x < x + blw)
|
||||||
|
click = ClkLtSymbol;
|
||||||
|
- else if (ev->x > selmon->ww - TEXTW(stext))
|
||||||
|
- click = ClkStatusText;
|
||||||
|
else
|
||||||
|
- click = ClkWinTitle;
|
||||||
|
+ click = ClkStatusText;
|
||||||
|
} else if ((c = wintoclient(ev->window))) {
|
||||||
|
focus(c);
|
||||||
|
restack(selmon);
|
||||||
|
@@ -729,15 +727,8 @@ 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);
|
||||||
|
- } else {
|
||||||
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
|
drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
|
||||||
|
}
|
||||||
|
@@ -1235,11 +1226,8 @@ propertynotify(XEvent *e)
|
||||||
|
drawbars();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
- if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
|
||||||
|
+ if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName])
|
||||||
|
updatetitle(c);
|
||||||
|
- if (c == c->mon->sel)
|
||||||
|
- drawbar(c->mon);
|
||||||
|
- }
|
||||||
|
if (ev->atom == netatom[NetWMWindowType])
|
||||||
|
updatewindowtype(c);
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
177
dwm-pertag-20170513-ceac8c9.diff
Normal file
177
dwm-pertag-20170513-ceac8c9.diff
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
diff --git a/dwm.c b/dwm.c
|
||||||
|
index a5ce993..45f1e27 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -112,6 +112,7 @@ typedef struct {
|
||||||
|
void (*arrange)(Monitor *);
|
||||||
|
} Layout;
|
||||||
|
|
||||||
|
+typedef struct Pertag Pertag;
|
||||||
|
struct Monitor {
|
||||||
|
char ltsymbol[16];
|
||||||
|
float mfact;
|
||||||
|
@@ -131,6 +132,7 @@ struct Monitor {
|
||||||
|
Monitor *next;
|
||||||
|
Window barwin;
|
||||||
|
const Layout *lt[2];
|
||||||
|
+ Pertag *pertag;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
@@ -272,6 +274,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]; };
|
||||||
|
|
||||||
|
@@ -632,6 +643,7 @@ Monitor *
|
||||||
|
createmon(void)
|
||||||
|
{
|
||||||
|
Monitor *m;
|
||||||
|
+ unsigned int i;
|
||||||
|
|
||||||
|
m = ecalloc(1, sizeof(Monitor));
|
||||||
|
m->tagset[0] = m->tagset[1] = 1;
|
||||||
|
@@ -642,6 +654,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;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -968,7 +994,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);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1503,9 +1529,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);
|
||||||
|
@@ -1524,7 +1550,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);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1701,7 +1727,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);
|
||||||
|
@@ -1740,9 +1766,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);
|
||||||
|
}
|
||||||
|
@@ -2036,11 +2086,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);
|
||||||
|
}
|
166
dwm-status2d-6.2.diff
Normal file
166
dwm-status2d-6.2.diff
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
diff --git a/dwm.c b/dwm.c
|
||||||
|
index d27cb67..464c9d6 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -163,6 +163,7 @@ static void detach(Client *c);
|
||||||
|
static Monitor *dirtomon(int dir);
|
||||||
|
static void drawbar(Monitor *m);
|
||||||
|
static void drawbars(void);
|
||||||
|
+static int drawstatusbar(Monitor *m, int bh, char* text);
|
||||||
|
static void enternotify(XEvent *e);
|
||||||
|
static void expose(XEvent *e);
|
||||||
|
static void focus(Client *c);
|
||||||
|
@@ -237,7 +238,7 @@ static void zoom(const Arg *arg);
|
||||||
|
|
||||||
|
/* variables */
|
||||||
|
static const char broken[] = "broken";
|
||||||
|
-static char stext[256];
|
||||||
|
+static char stext[1024];
|
||||||
|
static int screen;
|
||||||
|
static int sw, sh; /* X display screen geometry width, height */
|
||||||
|
static int bh, blw = 0; /* bar geometry */
|
||||||
|
@@ -483,7 +484,7 @@ cleanup(void)
|
||||||
|
cleanupmon(mons);
|
||||||
|
for (i = 0; i < CurLast; i++)
|
||||||
|
drw_cur_free(drw, cursor[i]);
|
||||||
|
- for (i = 0; i < LENGTH(colors); i++)
|
||||||
|
+ for (i = 0; i < LENGTH(colors) + 1; i++)
|
||||||
|
free(scheme[i]);
|
||||||
|
XDestroyWindow(dpy, wmcheckwin);
|
||||||
|
drw_free(drw);
|
||||||
|
@@ -690,6 +691,114 @@ dirtomon(int dir)
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
+int
|
||||||
|
+drawstatusbar(Monitor *m, int bh, char* stext) {
|
||||||
|
+ 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);
|
||||||
|
+
|
||||||
|
+ /* compute width of the status text */
|
||||||
|
+ w = 0;
|
||||||
|
+ i = -1;
|
||||||
|
+ while (text[++i]) {
|
||||||
|
+ if (text[i] == '^') {
|
||||||
|
+ if (!isCode) {
|
||||||
|
+ isCode = 1;
|
||||||
|
+ text[i] = '\0';
|
||||||
|
+ w += TEXTW(text) - lrpad;
|
||||||
|
+ text[i] = '^';
|
||||||
|
+ if (text[++i] == 'f')
|
||||||
|
+ w += atoi(text + ++i);
|
||||||
|
+ } else {
|
||||||
|
+ isCode = 0;
|
||||||
|
+ text = text + i + 1;
|
||||||
|
+ i = -1;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ if (!isCode)
|
||||||
|
+ w += TEXTW(text) - lrpad;
|
||||||
|
+ else
|
||||||
|
+ isCode = 0;
|
||||||
|
+ text = p;
|
||||||
|
+
|
||||||
|
+ w += 2; /* 1px padding on both sides */
|
||||||
|
+ ret = x = m->ww - w;
|
||||||
|
+
|
||||||
|
+ drw_setscheme(drw, scheme[LENGTH(colors)]);
|
||||||
|
+ drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
|
||||||
|
+ drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
|
||||||
|
+ drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||||
|
+ x++;
|
||||||
|
+
|
||||||
|
+ /* process status text */
|
||||||
|
+ i = -1;
|
||||||
|
+ while (text[++i]) {
|
||||||
|
+ if (text[i] == '^' && !isCode) {
|
||||||
|
+ isCode = 1;
|
||||||
|
+
|
||||||
|
+ text[i] = '\0';
|
||||||
|
+ w = TEXTW(text) - lrpad;
|
||||||
|
+ drw_text(drw, x, 0, w, bh, 0, text, 0);
|
||||||
|
+
|
||||||
|
+ x += w;
|
||||||
|
+
|
||||||
|
+ /* process code */
|
||||||
|
+ while (text[++i] != '^') {
|
||||||
|
+ if (text[i] == 'c') {
|
||||||
|
+ char buf[8];
|
||||||
|
+ memcpy(buf, (char*)text+i+1, 7);
|
||||||
|
+ buf[7] = '\0';
|
||||||
|
+ drw_clr_create(drw, &drw->scheme[ColFg], buf);
|
||||||
|
+ i += 7;
|
||||||
|
+ } else if (text[i] == 'b') {
|
||||||
|
+ char buf[8];
|
||||||
|
+ memcpy(buf, (char*)text+i+1, 7);
|
||||||
|
+ buf[7] = '\0';
|
||||||
|
+ drw_clr_create(drw, &drw->scheme[ColBg], buf);
|
||||||
|
+ i += 7;
|
||||||
|
+ } else if (text[i] == 'd') {
|
||||||
|
+ drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
|
||||||
|
+ drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
|
||||||
|
+ } else if (text[i] == 'r') {
|
||||||
|
+ int rx = atoi(text + ++i);
|
||||||
|
+ while (text[++i] != ',');
|
||||||
|
+ int ry = atoi(text + ++i);
|
||||||
|
+ while (text[++i] != ',');
|
||||||
|
+ int rw = atoi(text + ++i);
|
||||||
|
+ while (text[++i] != ',');
|
||||||
|
+ int rh = atoi(text + ++i);
|
||||||
|
+
|
||||||
|
+ drw_rect(drw, rx + x, ry, rw, rh, 1, 0);
|
||||||
|
+ } else if (text[i] == 'f') {
|
||||||
|
+ x += atoi(text + ++i);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ text = text + i + 1;
|
||||||
|
+ i=-1;
|
||||||
|
+ isCode = 0;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!isCode) {
|
||||||
|
+ w = TEXTW(text) - lrpad;
|
||||||
|
+ drw_text(drw, x, 0, w, bh, 0, text, 0);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
|
+ free(p);
|
||||||
|
+
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
drawbar(Monitor *m)
|
||||||
|
{
|
||||||
|
@@ -701,9 +802,7 @@ drawbar(Monitor *m)
|
||||||
|
|
||||||
|
/* 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]);
|
||||||
|
- sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
|
||||||
|
- drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0);
|
||||||
|
+ sw = m->ww - drawstatusbar(m, bh, stext);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (c = m->clients; c; c = c->next) {
|
||||||
|
@@ -1572,7 +1671,8 @@ setup(void)
|
||||||
|
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
|
||||||
|
cursor[CurMove] = drw_cur_create(drw, XC_fleur);
|
||||||
|
/* init appearance */
|
||||||
|
- scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
|
||||||
|
+ scheme = ecalloc(LENGTH(colors) + 1, sizeof(Clr *));
|
||||||
|
+ scheme[LENGTH(colors)] = drw_scm_create(drw, colors[0], 3);
|
||||||
|
for (i = 0; i < LENGTH(colors); i++)
|
||||||
|
scheme[i] = drw_scm_create(drw, colors[i], 3);
|
||||||
|
/* init bars */
|
25
dwm-statusallmons-6.2.diff
Normal file
25
dwm-statusallmons-6.2.diff
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
diff -up a/dwm.c b/dwm.c
|
||||||
|
--- a/dwm.c 2020-07-09 16:49:10.023585649 +0200
|
||||||
|
+++ b/dwm.c 2020-07-09 16:49:43.497542191 +0200
|
||||||
|
@@ -702,7 +702,7 @@ drawbar(Monitor *m)
|
||||||
|
Client *c;
|
||||||
|
|
||||||
|
/* draw status first so it can be overdrawn by tags later */
|
||||||
|
- if (m == selmon) { /* status is only drawn on selected monitor */
|
||||||
|
+ if (m == selmon || 1) { /* status is only drawn on selected monitor */
|
||||||
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
|
sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
|
||||||
|
drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0);
|
||||||
|
@@ -1987,9 +1987,11 @@ updatesizehints(Client *c)
|
||||||
|
void
|
||||||
|
updatestatus(void)
|
||||||
|
{
|
||||||
|
+ Monitor* m;
|
||||||
|
if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
|
||||||
|
strcpy(stext, "dwm-"VERSION);
|
||||||
|
- drawbar(selmon);
|
||||||
|
+ for(m = mons; m; m = m->next)
|
||||||
|
+ drawbar(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
157
dwm-statuscmd-signal-6.2.diff
Normal file
157
dwm-statuscmd-signal-6.2.diff
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 1c0b587..b67825e 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -103,7 +103,9 @@ static Button buttons[] = {
|
||||||
|
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||||
|
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
||||||
|
{ ClkWinTitle, 0, Button2, zoom, {0} },
|
||||||
|
- { ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
||||||
|
+ { ClkStatusText, 0, Button1, sigdwmblocks, {.i = 1} },
|
||||||
|
+ { ClkStatusText, 0, Button2, sigdwmblocks, {.i = 2} },
|
||||||
|
+ { ClkStatusText, 0, Button3, sigdwmblocks, {.i = 3} },
|
||||||
|
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||||
|
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
||||||
|
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
||||||
|
diff --git a/dwm.c b/dwm.c
|
||||||
|
index 4465af1..c600131 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -156,6 +156,7 @@ static void clientmessage(XEvent *e);
|
||||||
|
static void configure(Client *c);
|
||||||
|
static void configurenotify(XEvent *e);
|
||||||
|
static void configurerequest(XEvent *e);
|
||||||
|
+static void copyvalidchars(char *text, char *rawtext);
|
||||||
|
static Monitor *createmon(void);
|
||||||
|
static void destroynotify(XEvent *e);
|
||||||
|
static void detach(Client *c);
|
||||||
|
@@ -169,6 +170,7 @@ static void focus(Client *c);
|
||||||
|
static void focusin(XEvent *e);
|
||||||
|
static void focusmon(const Arg *arg);
|
||||||
|
static void focusstack(const Arg *arg);
|
||||||
|
+static int getdwmblockspid();
|
||||||
|
static int getrootptr(int *x, int *y);
|
||||||
|
static long getstate(Window w);
|
||||||
|
static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
|
||||||
|
@@ -205,6 +207,7 @@ static void setup(void);
|
||||||
|
static void seturgent(Client *c, int urg);
|
||||||
|
static void showhide(Client *c);
|
||||||
|
static void sigchld(int unused);
|
||||||
|
+static void sigdwmblocks(const Arg *arg);
|
||||||
|
static void spawn(const Arg *arg);
|
||||||
|
static void tag(const Arg *arg);
|
||||||
|
static void tagmon(const Arg *arg);
|
||||||
|
@@ -237,6 +240,9 @@ static void zoom(const Arg *arg);
|
||||||
|
/* variables */
|
||||||
|
static const char broken[] = "broken";
|
||||||
|
static char stext[256];
|
||||||
|
+static char rawstext[256];
|
||||||
|
+static int dwmblockssig;
|
||||||
|
+pid_t dwmblockspid = 0;
|
||||||
|
static int screen;
|
||||||
|
static int sw, sh; /* X display screen geometry width, height */
|
||||||
|
static int bh, blw = 0; /* bar geometry */
|
||||||
|
@@ -439,9 +445,26 @@ buttonpress(XEvent *e)
|
||||||
|
arg.ui = 1 << i;
|
||||||
|
} else if (ev->x < x + blw)
|
||||||
|
click = ClkLtSymbol;
|
||||||
|
- else if (ev->x > selmon->ww - TEXTW(stext))
|
||||||
|
+ else if (ev->x > (x = selmon->ww - TEXTW(stext) + lrpad)) {
|
||||||
|
click = ClkStatusText;
|
||||||
|
- else
|
||||||
|
+
|
||||||
|
+ char *text = rawstext;
|
||||||
|
+ int i = -1;
|
||||||
|
+ char ch;
|
||||||
|
+ dwmblockssig = 0;
|
||||||
|
+ while (text[++i]) {
|
||||||
|
+ if ((unsigned char)text[i] < ' ') {
|
||||||
|
+ ch = text[i];
|
||||||
|
+ text[i] = '\0';
|
||||||
|
+ x += TEXTW(text) - lrpad;
|
||||||
|
+ text[i] = ch;
|
||||||
|
+ text += i+1;
|
||||||
|
+ i = -1;
|
||||||
|
+ if (x >= ev->x) break;
|
||||||
|
+ dwmblockssig = ch;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ } else
|
||||||
|
click = ClkWinTitle;
|
||||||
|
} else if ((c = wintoclient(ev->window))) {
|
||||||
|
focus(c);
|
||||||
|
@@ -627,6 +650,19 @@ configurerequest(XEvent *e)
|
||||||
|
XSync(dpy, False);
|
||||||
|
}
|
||||||
|
|
||||||
|
+void
|
||||||
|
+copyvalidchars(char *text, char *rawtext)
|
||||||
|
+{
|
||||||
|
+ int i = -1, j = 0;
|
||||||
|
+
|
||||||
|
+ while(rawtext[++i]) {
|
||||||
|
+ if ((unsigned char)rawtext[i] >= ' ') {
|
||||||
|
+ text[j++] = rawtext[i];
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ text[j] = '\0';
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
Monitor *
|
||||||
|
createmon(void)
|
||||||
|
{
|
||||||
|
@@ -871,6 +907,18 @@ getatomprop(Client *c, Atom prop)
|
||||||
|
return atom;
|
||||||
|
}
|
||||||
|
|
||||||
|
+int
|
||||||
|
+getdwmblockspid()
|
||||||
|
+{
|
||||||
|
+ char buf[16];
|
||||||
|
+ FILE *fp = popen("pidof -s dwmblocks", "r");
|
||||||
|
+ fgets(buf, sizeof(buf), fp);
|
||||||
|
+ pid_t pid = strtoul(buf, NULL, 10);
|
||||||
|
+ pclose(fp);
|
||||||
|
+ dwmblockspid = pid;
|
||||||
|
+ return pid != 0 ? 0 : -1;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
int
|
||||||
|
getrootptr(int *x, int *y)
|
||||||
|
{
|
||||||
|
@@ -1636,6 +1684,23 @@ sigchld(int unused)
|
||||||
|
while (0 < waitpid(-1, NULL, WNOHANG));
|
||||||
|
}
|
||||||
|
|
||||||
|
+void
|
||||||
|
+sigdwmblocks(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ union sigval sv;
|
||||||
|
+ sv.sival_int = (dwmblockssig << 8) | arg->i;
|
||||||
|
+ if (!dwmblockspid)
|
||||||
|
+ if (getdwmblockspid() == -1)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ if (sigqueue(dwmblockspid, SIGUSR1, sv) == -1) {
|
||||||
|
+ if (errno == ESRCH) {
|
||||||
|
+ if (!getdwmblockspid())
|
||||||
|
+ sigqueue(dwmblockspid, SIGUSR1, sv);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
spawn(const Arg *arg)
|
||||||
|
{
|
||||||
|
@@ -1987,8 +2052,10 @@ updatesizehints(Client *c)
|
||||||
|
void
|
||||||
|
updatestatus(void)
|
||||||
|
{
|
||||||
|
- if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
|
||||||
|
+ if (!gettextprop(root, XA_WM_NAME, rawstext, sizeof(rawstext)))
|
||||||
|
strcpy(stext, "dwm-"VERSION);
|
||||||
|
+ else
|
||||||
|
+ copyvalidchars(stext, rawstext);
|
||||||
|
drawbar(selmon);
|
||||||
|
}
|
||||||
|
|
746
dwm-systray-6.2.diff
Normal file
746
dwm-systray-6.2.diff
Normal file
@@ -0,0 +1,746 @@
|
|||||||
|
From 4001ccae7b1a41bdcb247b0cf095a51af7b68c28 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Igor Gevka <igor.gevka@gmail.com>
|
||||||
|
Date: Sun, 16 Feb 2020 15:03:10 -0800
|
||||||
|
Subject: [PATCH] [PATCH] Implements a system tray for dwm.
|
||||||
|
|
||||||
|
Original author: Jan Christoph Ebersbach <jceb@e-jc.de>, inspired by http://code.google.com/p/dwm-plus
|
||||||
|
URL: http://dwm.suckless.org/patches/systray
|
||||||
|
dwm 6.2 port by Igor Gevka <igor.gevka@gmail.com>
|
||||||
|
---
|
||||||
|
config.def.h | 4 +
|
||||||
|
dwm.c | 404 +++++++++++++++++++++++++++++++++++++++++++++++----
|
||||||
|
2 files changed, 382 insertions(+), 26 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 1c0b587..2d824d1 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -3,6 +3,10 @@
|
||||||
|
/* appearance */
|
||||||
|
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
|
static const unsigned int snap = 32; /* snap pixel */
|
||||||
|
+static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
|
||||||
|
+static const unsigned int systrayspacing = 2; /* systray spacing */
|
||||||
|
+static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/
|
||||||
|
+static const int showsystray = 1; /* 0 means no systray */
|
||||||
|
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" };
|
||||||
|
diff --git a/dwm.c b/dwm.c
|
||||||
|
index 4465af1..3e361fa 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -57,12 +57,30 @@
|
||||||
|
#define TAGMASK ((1 << LENGTH(tags)) - 1)
|
||||||
|
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
|
||||||
|
|
||||||
|
+#define SYSTEM_TRAY_REQUEST_DOCK 0
|
||||||
|
+
|
||||||
|
+/* XEMBED messages */
|
||||||
|
+#define XEMBED_EMBEDDED_NOTIFY 0
|
||||||
|
+#define XEMBED_WINDOW_ACTIVATE 1
|
||||||
|
+#define XEMBED_FOCUS_IN 4
|
||||||
|
+#define XEMBED_MODALITY_ON 10
|
||||||
|
+
|
||||||
|
+#define XEMBED_MAPPED (1 << 0)
|
||||||
|
+#define XEMBED_WINDOW_ACTIVATE 1
|
||||||
|
+#define XEMBED_WINDOW_DEACTIVATE 2
|
||||||
|
+
|
||||||
|
+#define VERSION_MAJOR 0
|
||||||
|
+#define VERSION_MINOR 0
|
||||||
|
+#define XEMBED_EMBEDDED_VERSION (VERSION_MAJOR << 16) | VERSION_MINOR
|
||||||
|
+
|
||||||
|
/* enums */
|
||||||
|
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
|
||||||
|
enum { SchemeNorm, SchemeSel }; /* color schemes */
|
||||||
|
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
|
||||||
|
+ NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation, NetSystemTrayOrientationHorz,
|
||||||
|
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
|
||||||
|
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
|
||||||
|
+enum { Manager, Xembed, XembedInfo, XLast }; /* Xembed atoms */
|
||||||
|
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
|
||||||
|
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
|
||||||
|
ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
|
||||||
|
@@ -141,6 +159,12 @@ typedef struct {
|
||||||
|
int monitor;
|
||||||
|
} Rule;
|
||||||
|
|
||||||
|
+typedef struct Systray Systray;
|
||||||
|
+struct Systray {
|
||||||
|
+ Window win;
|
||||||
|
+ Client *icons;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
/* function declarations */
|
||||||
|
static void applyrules(Client *c);
|
||||||
|
static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact);
|
||||||
|
@@ -169,8 +193,10 @@ 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);
|
||||||
|
static long getstate(Window w);
|
||||||
|
+static unsigned int getsystraywidth();
|
||||||
|
static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
|
||||||
|
static void grabbuttons(Client *c, int focused);
|
||||||
|
static void grabkeys(void);
|
||||||
|
@@ -188,13 +214,16 @@ static void pop(Client *);
|
||||||
|
static void propertynotify(XEvent *e);
|
||||||
|
static void quit(const Arg *arg);
|
||||||
|
static Monitor *recttomon(int x, int y, int w, int h);
|
||||||
|
+static void removesystrayicon(Client *i);
|
||||||
|
static void resize(Client *c, int x, int y, int w, int h, int interact);
|
||||||
|
+static void resizebarwin(Monitor *m);
|
||||||
|
static void resizeclient(Client *c, int x, int y, int w, int h);
|
||||||
|
static void resizemouse(const Arg *arg);
|
||||||
|
+static void resizerequest(XEvent *e);
|
||||||
|
static void restack(Monitor *m);
|
||||||
|
static void run(void);
|
||||||
|
static void scan(void);
|
||||||
|
-static int sendevent(Client *c, Atom proto);
|
||||||
|
+static int sendevent(Window w, Atom proto, int m, long d0, long d1, long d2, long d3, long d4);
|
||||||
|
static void sendmon(Client *c, Monitor *m);
|
||||||
|
static void setclientstate(Client *c, long state);
|
||||||
|
static void setfocus(Client *c);
|
||||||
|
@@ -206,6 +235,7 @@ static void seturgent(Client *c, int urg);
|
||||||
|
static void showhide(Client *c);
|
||||||
|
static void sigchld(int unused);
|
||||||
|
static void spawn(const Arg *arg);
|
||||||
|
+static Monitor *systraytomon(Monitor *m);
|
||||||
|
static void tag(const Arg *arg);
|
||||||
|
static void tagmon(const Arg *arg);
|
||||||
|
static void tile(Monitor *);
|
||||||
|
@@ -223,18 +253,23 @@ static int updategeom(void);
|
||||||
|
static void updatenumlockmask(void);
|
||||||
|
static void updatesizehints(Client *c);
|
||||||
|
static void updatestatus(void);
|
||||||
|
+static void updatesystray(void);
|
||||||
|
+static void updatesystrayicongeom(Client *i, int w, int h);
|
||||||
|
+static void updatesystrayiconstate(Client *i, XPropertyEvent *ev);
|
||||||
|
static void updatetitle(Client *c);
|
||||||
|
static void updatewindowtype(Client *c);
|
||||||
|
static void updatewmhints(Client *c);
|
||||||
|
static void view(const Arg *arg);
|
||||||
|
static Client *wintoclient(Window w);
|
||||||
|
static Monitor *wintomon(Window w);
|
||||||
|
+static Client *wintosystrayicon(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 zoom(const Arg *arg);
|
||||||
|
|
||||||
|
/* variables */
|
||||||
|
+static Systray *systray = NULL;
|
||||||
|
static const char broken[] = "broken";
|
||||||
|
static char stext[256];
|
||||||
|
static int screen;
|
||||||
|
@@ -257,9 +292,10 @@ static void (*handler[LASTEvent]) (XEvent *) = {
|
||||||
|
[MapRequest] = maprequest,
|
||||||
|
[MotionNotify] = motionnotify,
|
||||||
|
[PropertyNotify] = propertynotify,
|
||||||
|
+ [ResizeRequest] = resizerequest,
|
||||||
|
[UnmapNotify] = unmapnotify
|
||||||
|
};
|
||||||
|
-static Atom wmatom[WMLast], netatom[NetLast];
|
||||||
|
+static Atom wmatom[WMLast], netatom[NetLast], xatom[XLast];
|
||||||
|
static int running = 1;
|
||||||
|
static Cur *cursor[CurLast];
|
||||||
|
static Clr **scheme;
|
||||||
|
@@ -439,7 +475,7 @@ buttonpress(XEvent *e)
|
||||||
|
arg.ui = 1 << i;
|
||||||
|
} else if (ev->x < x + blw)
|
||||||
|
click = ClkLtSymbol;
|
||||||
|
- else if (ev->x > selmon->ww - TEXTW(stext))
|
||||||
|
+ else if (ev->x > selmon->ww - TEXTW(stext) - getsystraywidth())
|
||||||
|
click = ClkStatusText;
|
||||||
|
else
|
||||||
|
click = ClkWinTitle;
|
||||||
|
@@ -482,6 +518,11 @@ cleanup(void)
|
||||||
|
XUngrabKey(dpy, AnyKey, AnyModifier, root);
|
||||||
|
while (mons)
|
||||||
|
cleanupmon(mons);
|
||||||
|
+ if (showsystray) {
|
||||||
|
+ XUnmapWindow(dpy, systray->win);
|
||||||
|
+ XDestroyWindow(dpy, systray->win);
|
||||||
|
+ free(systray);
|
||||||
|
+ }
|
||||||
|
for (i = 0; i < CurLast; i++)
|
||||||
|
drw_cur_free(drw, cursor[i]);
|
||||||
|
for (i = 0; i < LENGTH(colors); i++)
|
||||||
|
@@ -512,9 +553,57 @@ cleanupmon(Monitor *mon)
|
||||||
|
void
|
||||||
|
clientmessage(XEvent *e)
|
||||||
|
{
|
||||||
|
+ XWindowAttributes wa;
|
||||||
|
+ XSetWindowAttributes swa;
|
||||||
|
XClientMessageEvent *cme = &e->xclient;
|
||||||
|
Client *c = wintoclient(cme->window);
|
||||||
|
|
||||||
|
+ if (showsystray && cme->window == systray->win && cme->message_type == netatom[NetSystemTrayOP]) {
|
||||||
|
+ /* add systray icons */
|
||||||
|
+ if (cme->data.l[1] == SYSTEM_TRAY_REQUEST_DOCK) {
|
||||||
|
+ if (!(c = (Client *)calloc(1, sizeof(Client))))
|
||||||
|
+ die("fatal: could not malloc() %u bytes\n", sizeof(Client));
|
||||||
|
+ if (!(c->win = cme->data.l[2])) {
|
||||||
|
+ free(c);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ c->mon = selmon;
|
||||||
|
+ c->next = systray->icons;
|
||||||
|
+ systray->icons = c;
|
||||||
|
+ if (!XGetWindowAttributes(dpy, c->win, &wa)) {
|
||||||
|
+ /* use sane defaults */
|
||||||
|
+ wa.width = bh;
|
||||||
|
+ wa.height = bh;
|
||||||
|
+ wa.border_width = 0;
|
||||||
|
+ }
|
||||||
|
+ c->x = c->oldx = c->y = c->oldy = 0;
|
||||||
|
+ c->w = c->oldw = wa.width;
|
||||||
|
+ c->h = c->oldh = wa.height;
|
||||||
|
+ c->oldbw = wa.border_width;
|
||||||
|
+ c->bw = 0;
|
||||||
|
+ c->isfloating = True;
|
||||||
|
+ /* reuse tags field as mapped status */
|
||||||
|
+ c->tags = 1;
|
||||||
|
+ updatesizehints(c);
|
||||||
|
+ updatesystrayicongeom(c, wa.width, wa.height);
|
||||||
|
+ XAddToSaveSet(dpy, c->win);
|
||||||
|
+ XSelectInput(dpy, c->win, StructureNotifyMask | PropertyChangeMask | ResizeRedirectMask);
|
||||||
|
+ XReparentWindow(dpy, c->win, systray->win, 0, 0);
|
||||||
|
+ /* use parents background color */
|
||||||
|
+ swa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
|
||||||
|
+ XChangeWindowAttributes(dpy, c->win, CWBackPixel, &swa);
|
||||||
|
+ sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_EMBEDDED_NOTIFY, 0 , systray->win, XEMBED_EMBEDDED_VERSION);
|
||||||
|
+ /* FIXME not sure if I have to send these events, too */
|
||||||
|
+ sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_FOCUS_IN, 0 , systray->win, XEMBED_EMBEDDED_VERSION);
|
||||||
|
+ sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_WINDOW_ACTIVATE, 0 , systray->win, XEMBED_EMBEDDED_VERSION);
|
||||||
|
+ sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_MODALITY_ON, 0 , systray->win, XEMBED_EMBEDDED_VERSION);
|
||||||
|
+ XSync(dpy, False);
|
||||||
|
+ resizebarwin(selmon);
|
||||||
|
+ updatesystray();
|
||||||
|
+ setclientstate(c, NormalState);
|
||||||
|
+ }
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
if (!c)
|
||||||
|
return;
|
||||||
|
if (cme->message_type == netatom[NetWMState]) {
|
||||||
|
@@ -567,7 +656,7 @@ 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, m->by, m->ww, bh);
|
||||||
|
+ resizebarwin(m);
|
||||||
|
}
|
||||||
|
focus(NULL);
|
||||||
|
arrange(NULL);
|
||||||
|
@@ -652,6 +741,11 @@ destroynotify(XEvent *e)
|
||||||
|
|
||||||
|
if ((c = wintoclient(ev->window)))
|
||||||
|
unmanage(c, 1);
|
||||||
|
+ else if ((c = wintosystrayicon(ev->window))) {
|
||||||
|
+ removesystrayicon(c);
|
||||||
|
+ resizebarwin(selmon);
|
||||||
|
+ updatesystray();
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
@@ -695,19 +789,23 @@ dirtomon(int dir)
|
||||||
|
void
|
||||||
|
drawbar(Monitor *m)
|
||||||
|
{
|
||||||
|
- int x, w, sw = 0;
|
||||||
|
+ int x, w, sw = 0, stw = 0;
|
||||||
|
int boxs = drw->fonts->h / 9;
|
||||||
|
int boxw = drw->fonts->h / 6 + 2;
|
||||||
|
unsigned int i, occ = 0, urg = 0;
|
||||||
|
Client *c;
|
||||||
|
|
||||||
|
+ if(showsystray && m == systraytomon(m))
|
||||||
|
+ stw = getsystraywidth();
|
||||||
|
+
|
||||||
|
/* 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]);
|
||||||
|
- sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
|
||||||
|
- drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0);
|
||||||
|
+ sw = TEXTW(stext) - lrpad / 2 + 2; /* 2px right padding */
|
||||||
|
+ drw_text(drw, m->ww - sw - stw, 0, sw, bh, lrpad / 2 - 2, stext, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ resizebarwin(m);
|
||||||
|
for (c = m->clients; c; c = c->next) {
|
||||||
|
occ |= c->tags;
|
||||||
|
if (c->isurgent)
|
||||||
|
@@ -728,7 +826,7 @@ drawbar(Monitor *m)
|
||||||
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
|
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
||||||
|
|
||||||
|
- if ((w = m->ww - sw - x) > bh) {
|
||||||
|
+ if ((w = m->ww - sw - stw - 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);
|
||||||
|
@@ -739,7 +837,7 @@ drawbar(Monitor *m)
|
||||||
|
drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- drw_map(drw, m->barwin, 0, 0, m->ww, bh);
|
||||||
|
+ drw_map(drw, m->barwin, 0, 0, m->ww - stw, bh);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
@@ -776,8 +874,11 @@ expose(XEvent *e)
|
||||||
|
Monitor *m;
|
||||||
|
XExposeEvent *ev = &e->xexpose;
|
||||||
|
|
||||||
|
- if (ev->count == 0 && (m = wintomon(ev->window)))
|
||||||
|
+ if (ev->count == 0 && (m = wintomon(ev->window))) {
|
||||||
|
drawbar(m);
|
||||||
|
+ if (m == selmon)
|
||||||
|
+ updatesystray();
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
@@ -862,10 +963,17 @@ getatomprop(Client *c, Atom prop)
|
||||||
|
unsigned long dl;
|
||||||
|
unsigned char *p = NULL;
|
||||||
|
Atom da, atom = None;
|
||||||
|
+ /* FIXME getatomprop should return the number of items and a pointer to
|
||||||
|
+ * the stored data instead of this workaround */
|
||||||
|
+ Atom req = XA_ATOM;
|
||||||
|
+ if (prop == xatom[XembedInfo])
|
||||||
|
+ req = xatom[XembedInfo];
|
||||||
|
|
||||||
|
- if (XGetWindowProperty(dpy, c->win, prop, 0L, sizeof atom, False, XA_ATOM,
|
||||||
|
+ if (XGetWindowProperty(dpy, c->win, prop, 0L, sizeof atom, False, req,
|
||||||
|
&da, &di, &dl, &dl, &p) == Success && p) {
|
||||||
|
atom = *(Atom *)p;
|
||||||
|
+ if (da == xatom[XembedInfo] && dl == 2)
|
||||||
|
+ atom = ((Atom *)p)[1];
|
||||||
|
XFree(p);
|
||||||
|
}
|
||||||
|
return atom;
|
||||||
|
@@ -899,6 +1007,16 @@ getstate(Window w)
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
+unsigned int
|
||||||
|
+getsystraywidth()
|
||||||
|
+{
|
||||||
|
+ unsigned int w = 0;
|
||||||
|
+ Client *i;
|
||||||
|
+ if(showsystray)
|
||||||
|
+ for(i = systray->icons; i; w += i->w + systrayspacing, i = i->next) ;
|
||||||
|
+ return w ? w + systrayspacing : 1;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
int
|
||||||
|
gettextprop(Window w, Atom atom, char *text, unsigned int size)
|
||||||
|
{
|
||||||
|
@@ -1003,7 +1121,7 @@ killclient(const Arg *arg)
|
||||||
|
{
|
||||||
|
if (!selmon->sel)
|
||||||
|
return;
|
||||||
|
- if (!sendevent(selmon->sel, wmatom[WMDelete])) {
|
||||||
|
+ if (!sendevent(selmon->sel->win, wmatom[WMDelete], NoEventMask, wmatom[WMDelete], CurrentTime, 0 , 0, 0)) {
|
||||||
|
XGrabServer(dpy);
|
||||||
|
XSetErrorHandler(xerrordummy);
|
||||||
|
XSetCloseDownMode(dpy, DestroyAll);
|
||||||
|
@@ -1091,6 +1209,12 @@ maprequest(XEvent *e)
|
||||||
|
{
|
||||||
|
static XWindowAttributes wa;
|
||||||
|
XMapRequestEvent *ev = &e->xmaprequest;
|
||||||
|
+ Client *i;
|
||||||
|
+ if ((i = wintosystrayicon(ev->window))) {
|
||||||
|
+ sendevent(i->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_WINDOW_ACTIVATE, 0, systray->win, XEMBED_EMBEDDED_VERSION);
|
||||||
|
+ resizebarwin(selmon);
|
||||||
|
+ updatesystray();
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (!XGetWindowAttributes(dpy, ev->window, &wa))
|
||||||
|
return;
|
||||||
|
@@ -1215,6 +1339,16 @@ propertynotify(XEvent *e)
|
||||||
|
Window trans;
|
||||||
|
XPropertyEvent *ev = &e->xproperty;
|
||||||
|
|
||||||
|
+ if ((c = wintosystrayicon(ev->window))) {
|
||||||
|
+ if (ev->atom == XA_WM_NORMAL_HINTS) {
|
||||||
|
+ updatesizehints(c);
|
||||||
|
+ updatesystrayicongeom(c, c->w, c->h);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ updatesystrayiconstate(c, ev);
|
||||||
|
+ resizebarwin(selmon);
|
||||||
|
+ updatesystray();
|
||||||
|
+ }
|
||||||
|
if ((ev->window == root) && (ev->atom == XA_WM_NAME))
|
||||||
|
updatestatus();
|
||||||
|
else if (ev->state == PropertyDelete)
|
||||||
|
@@ -1265,6 +1399,20 @@ recttomon(int x, int y, int w, int h)
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
+void
|
||||||
|
+removesystrayicon(Client *i)
|
||||||
|
+{
|
||||||
|
+ Client **ii;
|
||||||
|
+
|
||||||
|
+ if (!showsystray || !i)
|
||||||
|
+ return;
|
||||||
|
+ for (ii = &systray->icons; *ii && *ii != i; ii = &(*ii)->next);
|
||||||
|
+ if (ii)
|
||||||
|
+ *ii = i->next;
|
||||||
|
+ free(i);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
void
|
||||||
|
resize(Client *c, int x, int y, int w, int h, int interact)
|
||||||
|
{
|
||||||
|
@@ -1272,6 +1420,14 @@ resize(Client *c, int x, int y, int w, int h, int interact)
|
||||||
|
resizeclient(c, x, y, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
+void
|
||||||
|
+resizebarwin(Monitor *m) {
|
||||||
|
+ unsigned int w = m->ww;
|
||||||
|
+ if (showsystray && m == systraytomon(m))
|
||||||
|
+ w -= getsystraywidth();
|
||||||
|
+ XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, w, bh);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
resizeclient(Client *c, int x, int y, int w, int h)
|
||||||
|
{
|
||||||
|
@@ -1344,6 +1500,19 @@ resizemouse(const Arg *arg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+void
|
||||||
|
+resizerequest(XEvent *e)
|
||||||
|
+{
|
||||||
|
+ XResizeRequestEvent *ev = &e->xresizerequest;
|
||||||
|
+ Client *i;
|
||||||
|
+
|
||||||
|
+ if ((i = wintosystrayicon(ev->window))) {
|
||||||
|
+ updatesystrayicongeom(i, ev->width, ev->height);
|
||||||
|
+ resizebarwin(selmon);
|
||||||
|
+ updatesystray();
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
restack(Monitor *m)
|
||||||
|
{
|
||||||
|
@@ -1433,26 +1602,36 @@ setclientstate(Client *c, long state)
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
-sendevent(Client *c, Atom proto)
|
||||||
|
+sendevent(Window w, Atom proto, int mask, long d0, long d1, long d2, long d3, long d4)
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
- Atom *protocols;
|
||||||
|
+ Atom *protocols, mt;
|
||||||
|
int exists = 0;
|
||||||
|
XEvent ev;
|
||||||
|
|
||||||
|
- if (XGetWMProtocols(dpy, c->win, &protocols, &n)) {
|
||||||
|
- while (!exists && n--)
|
||||||
|
- exists = protocols[n] == proto;
|
||||||
|
- XFree(protocols);
|
||||||
|
+ if (proto == wmatom[WMTakeFocus] || proto == wmatom[WMDelete]) {
|
||||||
|
+ mt = wmatom[WMProtocols];
|
||||||
|
+ if (XGetWMProtocols(dpy, w, &protocols, &n)) {
|
||||||
|
+ while (!exists && n--)
|
||||||
|
+ exists = protocols[n] == proto;
|
||||||
|
+ XFree(protocols);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ else {
|
||||||
|
+ exists = True;
|
||||||
|
+ mt = proto;
|
||||||
|
}
|
||||||
|
if (exists) {
|
||||||
|
ev.type = ClientMessage;
|
||||||
|
- ev.xclient.window = c->win;
|
||||||
|
- ev.xclient.message_type = wmatom[WMProtocols];
|
||||||
|
+ ev.xclient.window = w;
|
||||||
|
+ ev.xclient.message_type = mt;
|
||||||
|
ev.xclient.format = 32;
|
||||||
|
- ev.xclient.data.l[0] = proto;
|
||||||
|
- ev.xclient.data.l[1] = CurrentTime;
|
||||||
|
- XSendEvent(dpy, c->win, False, NoEventMask, &ev);
|
||||||
|
+ ev.xclient.data.l[0] = d0;
|
||||||
|
+ ev.xclient.data.l[1] = d1;
|
||||||
|
+ ev.xclient.data.l[2] = d2;
|
||||||
|
+ ev.xclient.data.l[3] = d3;
|
||||||
|
+ ev.xclient.data.l[4] = d4;
|
||||||
|
+ XSendEvent(dpy, w, False, mask, &ev);
|
||||||
|
}
|
||||||
|
return exists;
|
||||||
|
}
|
||||||
|
@@ -1466,7 +1645,7 @@ setfocus(Client *c)
|
||||||
|
XA_WINDOW, 32, PropModeReplace,
|
||||||
|
(unsigned char *) &(c->win), 1);
|
||||||
|
}
|
||||||
|
- sendevent(c, wmatom[WMTakeFocus]);
|
||||||
|
+ sendevent(c->win, wmatom[WMTakeFocus], NoEventMask, wmatom[WMTakeFocus], CurrentTime, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
@@ -1555,6 +1734,10 @@ setup(void)
|
||||||
|
wmatom[WMTakeFocus] = XInternAtom(dpy, "WM_TAKE_FOCUS", False);
|
||||||
|
netatom[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
|
||||||
|
netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
|
||||||
|
+ netatom[NetSystemTray] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_S0", False);
|
||||||
|
+ netatom[NetSystemTrayOP] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_OPCODE", False);
|
||||||
|
+ netatom[NetSystemTrayOrientation] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_ORIENTATION", False);
|
||||||
|
+ netatom[NetSystemTrayOrientationHorz] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_ORIENTATION_HORZ", False);
|
||||||
|
netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
|
||||||
|
netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False);
|
||||||
|
netatom[NetWMCheck] = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False);
|
||||||
|
@@ -1562,6 +1745,9 @@ setup(void)
|
||||||
|
netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
|
||||||
|
netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False);
|
||||||
|
netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);
|
||||||
|
+ xatom[Manager] = XInternAtom(dpy, "MANAGER", False);
|
||||||
|
+ xatom[Xembed] = XInternAtom(dpy, "_XEMBED", False);
|
||||||
|
+ xatom[XembedInfo] = XInternAtom(dpy, "_XEMBED_INFO", False);
|
||||||
|
/* init cursors */
|
||||||
|
cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
|
||||||
|
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
|
||||||
|
@@ -1570,6 +1756,8 @@ setup(void)
|
||||||
|
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
|
||||||
|
for (i = 0; i < LENGTH(colors); i++)
|
||||||
|
scheme[i] = drw_scm_create(drw, colors[i], 3);
|
||||||
|
+ /* init system tray */
|
||||||
|
+ updatesystray();
|
||||||
|
/* init bars */
|
||||||
|
updatebars();
|
||||||
|
updatestatus();
|
||||||
|
@@ -1701,7 +1889,18 @@ togglebar(const Arg *arg)
|
||||||
|
{
|
||||||
|
selmon->showbar = !selmon->showbar;
|
||||||
|
updatebarpos(selmon);
|
||||||
|
- XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
|
||||||
|
+ resizebarwin(selmon);
|
||||||
|
+ if (showsystray) {
|
||||||
|
+ XWindowChanges wc;
|
||||||
|
+ if (!selmon->showbar)
|
||||||
|
+ wc.y = -bh;
|
||||||
|
+ else if (selmon->showbar) {
|
||||||
|
+ wc.y = 0;
|
||||||
|
+ if (!selmon->topbar)
|
||||||
|
+ wc.y = selmon->mh - bh;
|
||||||
|
+ }
|
||||||
|
+ XConfigureWindow(dpy, systray->win, CWY, &wc);
|
||||||
|
+ }
|
||||||
|
arrange(selmon);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1796,11 +1995,18 @@ unmapnotify(XEvent *e)
|
||||||
|
else
|
||||||
|
unmanage(c, 0);
|
||||||
|
}
|
||||||
|
+ else if ((c = wintosystrayicon(ev->window))) {
|
||||||
|
+ /* KLUDGE! sometimes icons occasionally unmap their windows, but do
|
||||||
|
+ * _not_ destroy them. We map those windows back */
|
||||||
|
+ XMapRaised(dpy, c->win);
|
||||||
|
+ updatesystray();
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
updatebars(void)
|
||||||
|
{
|
||||||
|
+ unsigned int w;
|
||||||
|
Monitor *m;
|
||||||
|
XSetWindowAttributes wa = {
|
||||||
|
.override_redirect = True,
|
||||||
|
@@ -1811,10 +2017,15 @@ updatebars(void)
|
||||||
|
for (m = mons; m; m = m->next) {
|
||||||
|
if (m->barwin)
|
||||||
|
continue;
|
||||||
|
- m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),
|
||||||
|
+ w = m->ww;
|
||||||
|
+ if (showsystray && m == systraytomon(m))
|
||||||
|
+ w -= getsystraywidth();
|
||||||
|
+ m->barwin = XCreateWindow(dpy, root, m->wx, m->by, w, bh, 0, DefaultDepth(dpy, screen),
|
||||||
|
CopyFromParent, DefaultVisual(dpy, screen),
|
||||||
|
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
|
||||||
|
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
|
||||||
|
+ if (showsystray && m == systraytomon(m))
|
||||||
|
+ XMapRaised(dpy, systray->win);
|
||||||
|
XMapRaised(dpy, m->barwin);
|
||||||
|
XSetClassHint(dpy, m->barwin, &ch);
|
||||||
|
}
|
||||||
|
@@ -1990,6 +2201,121 @@ updatestatus(void)
|
||||||
|
if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
|
||||||
|
strcpy(stext, "dwm-"VERSION);
|
||||||
|
drawbar(selmon);
|
||||||
|
+ updatesystray();
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+updatesystrayicongeom(Client *i, int w, int h)
|
||||||
|
+{
|
||||||
|
+ if (i) {
|
||||||
|
+ i->h = bh;
|
||||||
|
+ if (w == h)
|
||||||
|
+ i->w = bh;
|
||||||
|
+ else if (h == bh)
|
||||||
|
+ i->w = w;
|
||||||
|
+ else
|
||||||
|
+ i->w = (int) ((float)bh * ((float)w / (float)h));
|
||||||
|
+ applysizehints(i, &(i->x), &(i->y), &(i->w), &(i->h), False);
|
||||||
|
+ /* force icons into the systray dimensions if they don't want to */
|
||||||
|
+ if (i->h > bh) {
|
||||||
|
+ if (i->w == i->h)
|
||||||
|
+ i->w = bh;
|
||||||
|
+ else
|
||||||
|
+ i->w = (int) ((float)bh * ((float)i->w / (float)i->h));
|
||||||
|
+ i->h = bh;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+updatesystrayiconstate(Client *i, XPropertyEvent *ev)
|
||||||
|
+{
|
||||||
|
+ long flags;
|
||||||
|
+ int code = 0;
|
||||||
|
+
|
||||||
|
+ if (!showsystray || !i || ev->atom != xatom[XembedInfo] ||
|
||||||
|
+ !(flags = getatomprop(i, xatom[XembedInfo])))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ if (flags & XEMBED_MAPPED && !i->tags) {
|
||||||
|
+ i->tags = 1;
|
||||||
|
+ code = XEMBED_WINDOW_ACTIVATE;
|
||||||
|
+ XMapRaised(dpy, i->win);
|
||||||
|
+ setclientstate(i, NormalState);
|
||||||
|
+ }
|
||||||
|
+ else if (!(flags & XEMBED_MAPPED) && i->tags) {
|
||||||
|
+ i->tags = 0;
|
||||||
|
+ code = XEMBED_WINDOW_DEACTIVATE;
|
||||||
|
+ XUnmapWindow(dpy, i->win);
|
||||||
|
+ setclientstate(i, WithdrawnState);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ return;
|
||||||
|
+ sendevent(i->win, xatom[Xembed], StructureNotifyMask, CurrentTime, code, 0,
|
||||||
|
+ systray->win, XEMBED_EMBEDDED_VERSION);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+updatesystray(void)
|
||||||
|
+{
|
||||||
|
+ XSetWindowAttributes wa;
|
||||||
|
+ XWindowChanges wc;
|
||||||
|
+ Client *i;
|
||||||
|
+ Monitor *m = systraytomon(NULL);
|
||||||
|
+ unsigned int x = m->mx + m->mw;
|
||||||
|
+ unsigned int w = 1;
|
||||||
|
+
|
||||||
|
+ if (!showsystray)
|
||||||
|
+ return;
|
||||||
|
+ if (!systray) {
|
||||||
|
+ /* init systray */
|
||||||
|
+ if (!(systray = (Systray *)calloc(1, sizeof(Systray))))
|
||||||
|
+ die("fatal: could not malloc() %u bytes\n", sizeof(Systray));
|
||||||
|
+ systray->win = XCreateSimpleWindow(dpy, root, x, m->by, w, bh, 0, 0, scheme[SchemeSel][ColBg].pixel);
|
||||||
|
+ wa.event_mask = ButtonPressMask | ExposureMask;
|
||||||
|
+ wa.override_redirect = True;
|
||||||
|
+ wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
|
||||||
|
+ XSelectInput(dpy, systray->win, SubstructureNotifyMask);
|
||||||
|
+ XChangeProperty(dpy, systray->win, netatom[NetSystemTrayOrientation], XA_CARDINAL, 32,
|
||||||
|
+ PropModeReplace, (unsigned char *)&netatom[NetSystemTrayOrientationHorz], 1);
|
||||||
|
+ XChangeWindowAttributes(dpy, systray->win, CWEventMask|CWOverrideRedirect|CWBackPixel, &wa);
|
||||||
|
+ XMapRaised(dpy, systray->win);
|
||||||
|
+ XSetSelectionOwner(dpy, netatom[NetSystemTray], systray->win, CurrentTime);
|
||||||
|
+ if (XGetSelectionOwner(dpy, netatom[NetSystemTray]) == systray->win) {
|
||||||
|
+ sendevent(root, xatom[Manager], StructureNotifyMask, CurrentTime, netatom[NetSystemTray], systray->win, 0, 0);
|
||||||
|
+ XSync(dpy, False);
|
||||||
|
+ }
|
||||||
|
+ else {
|
||||||
|
+ fprintf(stderr, "dwm: unable to obtain system tray.\n");
|
||||||
|
+ free(systray);
|
||||||
|
+ systray = NULL;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ for (w = 0, i = systray->icons; i; i = i->next) {
|
||||||
|
+ /* make sure the background color stays the same */
|
||||||
|
+ wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
|
||||||
|
+ XChangeWindowAttributes(dpy, i->win, CWBackPixel, &wa);
|
||||||
|
+ XMapRaised(dpy, i->win);
|
||||||
|
+ w += systrayspacing;
|
||||||
|
+ i->x = w;
|
||||||
|
+ XMoveResizeWindow(dpy, i->win, i->x, 0, i->w, i->h);
|
||||||
|
+ w += i->w;
|
||||||
|
+ if (i->mon != m)
|
||||||
|
+ i->mon = m;
|
||||||
|
+ }
|
||||||
|
+ w = w ? w + systrayspacing : 1;
|
||||||
|
+ x -= w;
|
||||||
|
+ XMoveResizeWindow(dpy, systray->win, x, m->by, w, bh);
|
||||||
|
+ wc.x = x; wc.y = m->by; wc.width = w; wc.height = bh;
|
||||||
|
+ wc.stack_mode = Above; wc.sibling = m->barwin;
|
||||||
|
+ XConfigureWindow(dpy, systray->win, CWX|CWY|CWWidth|CWHeight|CWSibling|CWStackMode, &wc);
|
||||||
|
+ XMapWindow(dpy, systray->win);
|
||||||
|
+ XMapSubwindows(dpy, systray->win);
|
||||||
|
+ /* redraw background */
|
||||||
|
+ XSetForeground(dpy, drw->gc, scheme[SchemeNorm][ColBg].pixel);
|
||||||
|
+ XFillRectangle(dpy, systray->win, drw->gc, 0, 0, w, bh);
|
||||||
|
+ XSync(dpy, False);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
@@ -2057,6 +2383,16 @@ wintoclient(Window w)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
+Client *
|
||||||
|
+wintosystrayicon(Window w) {
|
||||||
|
+ Client *i = NULL;
|
||||||
|
+
|
||||||
|
+ if (!showsystray || !w)
|
||||||
|
+ return i;
|
||||||
|
+ for (i = systray->icons; i && i->win != w; i = i->next) ;
|
||||||
|
+ return i;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
Monitor *
|
||||||
|
wintomon(Window w)
|
||||||
|
{
|
||||||
|
@@ -2110,6 +2446,22 @@ xerrorstart(Display *dpy, XErrorEvent *ee)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+Monitor *
|
||||||
|
+systraytomon(Monitor *m) {
|
||||||
|
+ Monitor *t;
|
||||||
|
+ int i, n;
|
||||||
|
+ if(!systraypinning) {
|
||||||
|
+ if(!m)
|
||||||
|
+ return selmon;
|
||||||
|
+ return m == selmon ? m : NULL;
|
||||||
|
+ }
|
||||||
|
+ for(n = 1, t = mons; t && t->next; n++, t = t->next) ;
|
||||||
|
+ for(i = 1, t = mons; t && t->next && i < systraypinning; i++, t = t->next) ;
|
||||||
|
+ if(systraypinningfailfirst && n < systraypinning)
|
||||||
|
+ return mons;
|
||||||
|
+ return t;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
zoom(const Arg *arg)
|
||||||
|
{
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
44
dwm-zeroastag-22032023-0aea805.diff
Normal file
44
dwm-zeroastag-22032023-0aea805.diff
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
From 0aea8051b1ae85c568dc69d4cf9865de9ad6acce Mon Sep 17 00:00:00 2001
|
||||||
|
From: Michal Orman <michal.orman@gmail.com>
|
||||||
|
Date: Wed, 22 Mar 2023 16:02:45 +0100
|
||||||
|
Subject: [PATCH] Make XK_0 a regular tag.
|
||||||
|
|
||||||
|
Change the default behavior of XK_0 from selecting all tags to be
|
||||||
|
a regular 10th tag.
|
||||||
|
---
|
||||||
|
config.def.h | 5 ++---
|
||||||
|
1 file changed, 2 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 9efa774..15d02d7 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -19,7 +19,7 @@ static const char *colors[][3] = {
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 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", "0" };
|
||||||
|
|
||||||
|
static const Rule rules[] = {
|
||||||
|
/* xprop(1):
|
||||||
|
@@ -79,8 +79,6 @@ static const Key keys[] = {
|
||||||
|
{ 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 } },
|
||||||
|
@@ -94,6 +92,7 @@ static const Key keys[] = {
|
||||||
|
TAGKEYS( XK_7, 6)
|
||||||
|
TAGKEYS( XK_8, 7)
|
||||||
|
TAGKEYS( XK_9, 8)
|
||||||
|
+ TAGKEYS( XK_0, 9)
|
||||||
|
{ MODKEY|ShiftMask, XK_q, quit, {0} },
|
||||||
|
};
|
||||||
|
|
||||||
|
--
|
||||||
|
2.40.0
|
||||||
|
|
6
dwm.1
6
dwm.1
@@ -92,6 +92,12 @@ Sets monocle layout.
|
|||||||
.B Mod1\-space
|
.B Mod1\-space
|
||||||
Toggles between current and previous layout.
|
Toggles between current and previous layout.
|
||||||
.TP
|
.TP
|
||||||
|
.B Mod1\-Control\-,
|
||||||
|
Cycles backwards in layout list.
|
||||||
|
.TP
|
||||||
|
.B Mod1\-Control\-.
|
||||||
|
Cycles forwards in layout list.
|
||||||
|
.TP
|
||||||
.B Mod1\-j
|
.B Mod1\-j
|
||||||
Focus next window.
|
Focus next window.
|
||||||
.TP
|
.TP
|
||||||
|
Reference in New Issue
Block a user