mirror of
https://github.com/alrayyes/dwm
synced 2023-11-14 15:56:31 +00:00
Compare commits
9 Commits
eed6a6bc19
...
0cc0352cca
Author | SHA1 | Date | |
---|---|---|---|
|
0cc0352cca | ||
|
1bec3a0a2a | ||
|
d855a9beb8 | ||
|
ebb984c1b3 | ||
|
0bb5e4dae1 | ||
|
9d8345c8be | ||
|
feefdd57d2 | ||
|
ce769c332f | ||
|
bde1fc1e63 |
50
PKGBUILD
50
PKGBUILD
@ -1,5 +1,5 @@
|
||||
# $Id$
|
||||
# Maintainer: Ryan Kes <alrayyes@gmail.com>
|
||||
# Maintainer: Ryan Kes <ryan@ryankes.eu>
|
||||
|
||||
pkgname=higherlearning-dwm
|
||||
pkgver=6.2
|
||||
@ -9,23 +9,24 @@ url="http://dwm.suckless.org"
|
||||
arch=('i686' 'x86_64')
|
||||
license=('MIT')
|
||||
options=(zipman)
|
||||
depends=('libx11' 'libxinerama' 'libxft' 'freetype2' 'dmenu' 'otf-nerd-fonts-fira-code')
|
||||
depends=('libx11' 'libxinerama' 'libxft' 'freetype2' 'dmenu' 'ttf-jetbrains-mono' 'ttf-joypixels')
|
||||
optdepends=('gllock-git' 'higherlearning-st')
|
||||
conflicts=('dwm')
|
||||
install=dwm.install
|
||||
|
||||
_patches=(
|
||||
"dwm-systray-20190208-cb3f58a.diff"
|
||||
"dwm-noborder-20170207-bb3bd6f.diff"
|
||||
"dwm-autostart-20161205-bb3bd6f.diff"
|
||||
"dwm-noborder-6.2.diff"
|
||||
"dwm-autostart-20200610-cb3f58a.diff"
|
||||
"dwm-cyclelayouts-20180524-6.2.diff"
|
||||
"dwm-gridmode-20170909-ceac8c9.diff"
|
||||
"dwm-r1615-selfrestart.diff"
|
||||
"local-hide_vacant_tags-git-20160626-7af4d43.diff"
|
||||
"local-statuscolors-20181008-b69c870.diff"
|
||||
"local-fancybar-2019018-b69c870.diff"
|
||||
"local-scratchpad-20170207-bb3bd6f.diff"
|
||||
"local-alpha-20180613-b69c870.diff"
|
||||
"local-gridmode-20170909-ceac8c9.diff"
|
||||
"local-r1615-selfrestart.diff"
|
||||
"dwm-hide_vacant_tags-6.2.diff"
|
||||
"local-scratchpad-6.2.diff"
|
||||
"dwm-rotatestack-20161021-ab9571b.diff"
|
||||
"dwm-statuspadding-20150524-c8e9479.diff"
|
||||
"local-uselessgap-6.2.diff"
|
||||
"local-allow-color-fonts.diff"
|
||||
"dwm-alpha-20201019-61bb8b2.diff"
|
||||
)
|
||||
|
||||
source=(http://dl.suckless.org/dwm/dwm-$pkgver.tar.gz
|
||||
@ -34,23 +35,24 @@ source=(http://dl.suckless.org/dwm/dwm-$pkgver.tar.gz
|
||||
"${_patches[@]}")
|
||||
|
||||
md5sums=('9929845ccdec4d2cc191f16210dd7f3d'
|
||||
'598fcb5275d7f036807765370b5a226d'
|
||||
'418abafd90ec84255144dcea538a53fb'
|
||||
'939f403a71b6e85261d09fc3412269ee'
|
||||
'31a7569d7f3d43846f59e854ec5d1da0'
|
||||
'fbb786263f2d714b18368ff64779d669'
|
||||
'46ff022e2a2c6139e71399eb19d1aebb'
|
||||
'453062a348098b240e55f40623f14ed0'
|
||||
'64cc9cc8df63451b660a76c31ca67a34'
|
||||
'5baffd8c124095d06b133e9b31a854b2'
|
||||
'6055775113fd4dc06200bc6aaafb72fb'
|
||||
'aa3d5f3c45057a2a6ee73aede3fc218a'
|
||||
'd2781ac29048fc50e42e0f11e6cf7bce'
|
||||
'c5469c1457955a8447e05ec5118b3ce6'
|
||||
'77e3bfab2270dde73caf4e1b14566386'
|
||||
'7381051e12596394791092f0d39a2dd2'
|
||||
'60a545c6661638af619913e2a093ebf8')
|
||||
'272fdc4d250d3c30750dbe56bb7e9fa5'
|
||||
'8c3ad89cb98dd2b9152075b6e29cb579'
|
||||
'c446b71a8b8cce25db86a47805500dfa'
|
||||
'595df893d829b2994bb799d12a1c9545'
|
||||
'882e0783ccedf9fbb8b565e7681116c9'
|
||||
'd1f932d25d82eb9aaa589a54d9b4e6c8'
|
||||
'b9c840237160440110fdafc204eff208'
|
||||
'cdf4c9dacfecd8f3aecb5fc8166c4604'
|
||||
'7799f60a9e87e4f99e813d158abee15b')
|
||||
|
||||
prepare() {
|
||||
cd $srcdir/dwm-$pkgver
|
||||
sed -i "25 a \ \t{ NULL, NULL }," "$srcdir/$(basename ${_patches[4]})"
|
||||
#sed -i "25 a \ \t{ NULL, NULL }," "$srcdir/$(basename ${_patches[4]})"
|
||||
|
||||
for patch in "${_patches[@]}"; do
|
||||
echo "Applying patch $(basename $patch)..."
|
||||
|
24
README.org
24
README.org
@ -5,41 +5,29 @@
|
||||
|
||||
[[https://dwm.suckless.org][DWM]] [[https://www.archlinux.org/][Arch]] package with a few patches installed to keep things nice:
|
||||
|
||||
- [[https://dwm.suckless.org/patches/systray/][systray]]
|
||||
- [[https://dwm.suckless.org/patches/noborder/][noborder]]
|
||||
- [[https://dwm.suckless.org/patches/alpha/][alpha]]
|
||||
- [[https://dwm.suckless.org/patches/autostart/][autostart]]
|
||||
- [[https://dwm.suckless.org/patches/cyclelayouts/][cyclelayouts]]
|
||||
- [[https://dwm.suckless.org/patches/gridmode/][gridmode]]
|
||||
- [[https://dwm.suckless.org/patches/selfrestart/][selfrestart]]
|
||||
- [[https://dwm.suckless.org/patches/hide_vacant_tags/][hide_vacant_tags]]
|
||||
- [[https://dwm.suckless.org/patches/statuscolors/][statuscolors]]
|
||||
- [[https://dwm.suckless.org/patches/fancybar/][fancybar]]
|
||||
- [[https://dwm.suckless.org/patches/noborder/][noborder]]
|
||||
- [[https://dwm.suckless.org/patches/rotatestack/][rotatestack]]
|
||||
- [[https://dwm.suckless.org/patches/scratchpad/][scratchpad]]
|
||||
- [[https://dwm.suckless.org/patches/alpha/][alpha]]
|
||||
- [[https://dwm.suckless.org/patches/selfrestart/][selfrestart]]
|
||||
- [[https://dwm.suckless.org/patches/statuspadding/][statuspadding]]
|
||||
- [[https://dwm.suckless.org/patches/uselessgap/][uselessgap]]
|
||||
|
||||
** Installation
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: installation
|
||||
:END:
|
||||
|
||||
#+BEGIN_EXAMPLE shell
|
||||
makepkg -si
|
||||
#+END_EXAMPLE
|
||||
|
||||
** Further Notes
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: further-notes
|
||||
:END:
|
||||
|
||||
- Default font is
|
||||
[[https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/FiraCode][Fira Code Nerd Font Mono]]
|
||||
- When modifying [[https://github.com/alrayyes/dwm/blob/master/config.h][config.h]] be sure to run =updpkgsums= to update checksums before
|
||||
running =makepkg -si=
|
||||
|
||||
** License
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: license
|
||||
:END:
|
||||
|
||||
This theme is released under the MIT License. For more information read
|
||||
the [[file:LICENSE.org][license]].
|
||||
|
103
config.h
103
config.h
@ -1,15 +1,16 @@
|
||||
/* See LICENSE file for copyright and license details. */
|
||||
|
||||
/* appearance */
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
static const unsigned int borderpx = 2; /* 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 systraypinning = 1; /* 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[] = { "FuraCode Nerd Font:style=Regular:pixelsize=18:antialias=true:autohint=true" };
|
||||
static const char *fonts[] = { "Hack Nerd Font Mono:size=10" };
|
||||
static const char dmenufont[] = "Hack Nerd Font Mono:size=10";
|
||||
static const char col_gray1[] = "#222222";
|
||||
static const char col_gray2[] = "#444444";
|
||||
static const char col_gray3[] = "#bbbbbb";
|
||||
@ -19,81 +20,19 @@ static const char col_black[] = "#000000";
|
||||
static const char col_red[] = "#ff0000";
|
||||
static const char col_yellow[] = "#ffff00";
|
||||
static const char col_white[] = "#ffffff";
|
||||
static const char status_white[] = "#dddddd";
|
||||
static const char status_black[] = "#000";
|
||||
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 },
|
||||
[SchemeWarn] = { col_black, col_yellow, col_red },
|
||||
[SchemeUrgent]= { col_white, col_red, col_red },
|
||||
{ "#404040", col_gray1, col_gray1 }, /* bar 1 seperator */
|
||||
{ status_black, "#404040", "#404040" }, /* bar 1 */
|
||||
{ "#E84F4F", "#404040", "#404040" }, /* bar 2 seperator */
|
||||
{ status_black, "#E84F4F", "#E84F4F" }, /* bar 2 */
|
||||
{ "#B8D68C", "#E84F4F", "#E84F4F" }, /* bar 3 seperator */
|
||||
{ status_black, "#B8D68C", "#B8D68C" }, /* bar 3 */
|
||||
{ "#E1AA5D", "#B8D68C", "#B8D68C" }, /* bar 4 seperator */
|
||||
{ status_black, "#E1AA5D", "#E1AA5D" }, /* bar 4 */
|
||||
{ "#7DC1CF", "#E1AA5D", "#E1AA5D" }, /* bar 5 seperator */
|
||||
{ status_black, "#7DC1CF", "#7DC1CF" }, /* bar 5 */
|
||||
{ "#9B64FB", "#7DC1CF", "#7DC1CF" }, /* bar 6 seperator */
|
||||
{ status_black, "#9B64FB", "#9B64FB" }, /* bar 6 */
|
||||
{ "#6D878D", "#9B64FB", "#9B64FB" }, /* bar 7 seperator */
|
||||
{ status_black, "#6D878D", "#6D878D" }, /* bar 7 */
|
||||
{ "#dddddd", "#6D878D", "#6D878D" }, /* bar 8 seperator */
|
||||
{ status_black, "#dddddd", "#dddddd" }, /* bar 8 */
|
||||
{ "#404040", "#dddddd", "#dddddd" }, /* bar 9 seperator */
|
||||
{ status_black, "#404040", "#404040" }, /* bar 9 */
|
||||
{ "#D23D3D", "#404040", "#404040" }, /* bar 10 seperator */
|
||||
{ status_black, "#D23D3D", "#D23D3D" }, /* bar 10 */
|
||||
{ "#A0CF5D", "#D23D3D", "#D23D3D" }, /* bar 11 seperator */
|
||||
{ status_black, "#A0CF5D", "#A0CF5D" }, /* bar 11 */
|
||||
{ "#F39D21", "#A0CF5D", "#A0CF5D" }, /* bar 12 seperator */
|
||||
{ status_black, "#F39D21", "#F39D21" }, /* bar 12 */
|
||||
{ "#4E9FB1", "#F39D21", "#F39D21" }, /* bar 13 seperator */
|
||||
{ status_black, "#4E9FB1", "#4E9FB1" }, /* bar 13 */
|
||||
//{ "#8542FF", "#4E9FB1", "#4E9FB1" }, /* bar 14 seperator */
|
||||
//{ status_black, "#8542FF", "#8542FF" }, /* bar 14 */
|
||||
//{ "#42717B", "#8542FF", "#8542FF" }, /* bar 15 seperator */
|
||||
//{ status_black, "#42717B", "#42717B" }, /* bar 15 */
|
||||
//{ "#dddddd", "#42717B", "#42717B" }, /* bar 16 seperator */
|
||||
//{ status_black, "#dddddd", "#dddddd" }, /* bar 16 */
|
||||
//[SchemeWarn] = { col_black, col_yellow, col_red },
|
||||
//[SchemeUrgent]= { col_white, col_red, col_red },
|
||||
};
|
||||
static const unsigned int alphas[][3] = {
|
||||
/* fg bg border */
|
||||
[SchemeNorm] = { OPAQUE, baralpha, borderalpha },
|
||||
[SchemeSel] = { OPAQUE, baralpha, borderalpha },
|
||||
[SchemeWarn] = { OPAQUE, baralpha, borderalpha },
|
||||
[SchemeUrgent] = { OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha }, /* bar 1 seperator */
|
||||
{ OPAQUE, baralpha, borderalpha }, /* bar 1 */
|
||||
{ OPAQUE, baralpha, borderalpha }, /* bar 2 seperator */
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
};
|
||||
|
||||
/* tagging */
|
||||
@ -105,16 +44,24 @@ static const Rule rules[] = {
|
||||
* WM_NAME(STRING) = title
|
||||
*/
|
||||
/* class instance title tags mask isfloating monitor */
|
||||
{ "Syncthing GTK", NULL, NULL, 0, 1, -1 },
|
||||
{ "Toggl Desktop", NULL, NULL, 0, 1, -1 },
|
||||
{ "Gimp", NULL, NULL, 0, 1, -1 },
|
||||
{ "firefox", NULL, NULL, 1 << 8, 0, -1 },
|
||||
{ "Gpodder", NULL, NULL, 1 << 3, 0, -1 },
|
||||
{ "Syncthing GTK", NULL, NULL, 0, 1, -1 },
|
||||
|
||||
{ "Brave-browser", NULL, NULL, 0, 0, 1 },
|
||||
{ "Firefox", NULL, NULL, 0, 0, 1 },
|
||||
{ "iceweasel", NULL, NULL, 0, 0, 1 },
|
||||
|
||||
{ "Element", NULL, NULL, 1 << 2, 0, -1 },
|
||||
{ "Element-Nightly", NULL, NULL, 1 << 2, 0, -1 },
|
||||
{ "Slack", NULL, NULL, 1 << 2, 0, -1 },
|
||||
|
||||
{ "castero", NULL, NULL, 1 << 3, 0, -1 },
|
||||
{ "Spt", NULL, NULL, 1 << 3, 0, -1 },
|
||||
{ "Spotify", NULL, NULL, 1 << 3, 0, -1 },
|
||||
{ "ncmpcpp", NULL, NULL, 1 << 3, 0, -1 },
|
||||
{ "mutt", NULL, NULL, 1 << 5, 0, -1 },
|
||||
{ "weechat", NULL, NULL, 1 << 6, 0, -1 },
|
||||
{ "Slack", NULL, NULL, 1 << 6, 0, -1 },
|
||||
|
||||
{ "jetbrains-webstorm", NULL, NULL, 1 << 7, 0, -1 },
|
||||
|
||||
{ "Emacs", NULL, NULL, 1 << 8, 0, -1 },
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
@ -145,7 +92,7 @@ static const Layout layouts[] = {
|
||||
|
||||
/* commands */
|
||||
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
|
||||
static const char *dmenucmd[] = { "/home/alrayyes/.scripts/dmenu-frequency" };
|
||||
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
|
||||
static const char *termcmd[] = { "st", NULL };
|
||||
static const char scratchpadname[] = "scratchpad";
|
||||
static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL };
|
||||
@ -154,7 +101,8 @@ static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34
|
||||
|
||||
static Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
||||
//{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||
//{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
||||
{ MODKEY, XK_grave, togglescratch, {.v = scratchpadcmd } },
|
||||
{ MODKEY, XK_b, togglebar, {0} },
|
||||
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||
@ -209,4 +157,3 @@ static Button buttons[] = {
|
||||
{ ClkTagBar, MODKEY, Button1, tag, {0} },
|
||||
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
|
||||
};
|
||||
|
||||
|
114
config_desktop.h
114
config_desktop.h
@ -2,14 +2,18 @@
|
||||
|
||||
/* appearance */
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
static const unsigned int gappx = 6; /* gaps between windows */
|
||||
static const unsigned int snap = 32; /* snap pixel */
|
||||
static const unsigned int systraypinning = 1; /* 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[] = { "FuraCode Nerd Font:style=Regular:pixelsize=14:antialias=true:autohint=true" };
|
||||
static const int horizpadbar = 2; /* horizontal padding for statusbar */
|
||||
static const int vertpadbar = 0; /* vertical padding for statusbar */
|
||||
|
||||
static const char *fonts[] = {
|
||||
"Hack Nerd Font Mono:size=10:antialias=true:autohint=true",
|
||||
"JoyPixels:pixelsize=10:antialias=true:autohint=true"
|
||||
};
|
||||
static const char dmenufont[] = "Hack Nerd Font Mono:size=10";
|
||||
static const char col_gray1[] = "#222222";
|
||||
static const char col_gray2[] = "#444444";
|
||||
static const char col_gray3[] = "#bbbbbb";
|
||||
@ -19,81 +23,17 @@ static const char col_black[] = "#000000";
|
||||
static const char col_red[] = "#ff0000";
|
||||
static const char col_yellow[] = "#ffff00";
|
||||
static const char col_white[] = "#ffffff";
|
||||
static const char status_white[] = "#dddddd";
|
||||
static const char status_black[] = "#000";
|
||||
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 },
|
||||
[SchemeWarn] = { col_black, col_yellow, col_red },
|
||||
[SchemeUrgent]= { col_white, col_red, col_red },
|
||||
{ "#404040", col_gray1, col_gray1 }, /* bar 1 seperator */
|
||||
{ status_black, "#404040", "#404040" }, /* bar 1 */
|
||||
{ "#E84F4F", "#404040", "#404040" }, /* bar 2 seperator */
|
||||
{ status_black, "#E84F4F", "#E84F4F" }, /* bar 2 */
|
||||
{ "#B8D68C", "#E84F4F", "#E84F4F" }, /* bar 3 seperator */
|
||||
{ status_black, "#B8D68C", "#B8D68C" }, /* bar 3 */
|
||||
{ "#E1AA5D", "#B8D68C", "#B8D68C" }, /* bar 4 seperator */
|
||||
{ status_black, "#E1AA5D", "#E1AA5D" }, /* bar 4 */
|
||||
{ "#7DC1CF", "#E1AA5D", "#E1AA5D" }, /* bar 5 seperator */
|
||||
{ status_black, "#7DC1CF", "#7DC1CF" }, /* bar 5 */
|
||||
{ "#9B64FB", "#7DC1CF", "#7DC1CF" }, /* bar 6 seperator */
|
||||
{ status_black, "#9B64FB", "#9B64FB" }, /* bar 6 */
|
||||
{ "#6D878D", "#9B64FB", "#9B64FB" }, /* bar 7 seperator */
|
||||
{ status_black, "#6D878D", "#6D878D" }, /* bar 7 */
|
||||
{ "#dddddd", "#6D878D", "#6D878D" }, /* bar 8 seperator */
|
||||
{ status_black, "#dddddd", "#dddddd" }, /* bar 8 */
|
||||
{ "#404040", "#dddddd", "#dddddd" }, /* bar 9 seperator */
|
||||
{ status_black, "#404040", "#404040" }, /* bar 9 */
|
||||
{ "#D23D3D", "#404040", "#404040" }, /* bar 10 seperator */
|
||||
{ status_black, "#D23D3D", "#D23D3D" }, /* bar 10 */
|
||||
{ "#A0CF5D", "#D23D3D", "#D23D3D" }, /* bar 11 seperator */
|
||||
{ status_black, "#A0CF5D", "#A0CF5D" }, /* bar 11 */
|
||||
{ "#F39D21", "#A0CF5D", "#A0CF5D" }, /* bar 12 seperator */
|
||||
{ status_black, "#F39D21", "#F39D21" }, /* bar 12 */
|
||||
{ "#4E9FB1", "#F39D21", "#F39D21" }, /* bar 13 seperator */
|
||||
{ status_black, "#4E9FB1", "#4E9FB1" }, /* bar 13 */
|
||||
//{ "#8542FF", "#4E9FB1", "#4E9FB1" }, /* bar 14 seperator */
|
||||
//{ status_black, "#8542FF", "#8542FF" }, /* bar 14 */
|
||||
//{ "#42717B", "#8542FF", "#8542FF" }, /* bar 15 seperator */
|
||||
//{ status_black, "#42717B", "#42717B" }, /* bar 15 */
|
||||
//{ "#dddddd", "#42717B", "#42717B" }, /* bar 16 seperator */
|
||||
//{ status_black, "#dddddd", "#dddddd" }, /* bar 16 */
|
||||
};
|
||||
static const unsigned int alphas[][3] = {
|
||||
/* fg bg border */
|
||||
[SchemeNorm] = { OPAQUE, baralpha, borderalpha },
|
||||
[SchemeSel] = { OPAQUE, baralpha, borderalpha },
|
||||
[SchemeWarn] = { OPAQUE, baralpha, borderalpha },
|
||||
[SchemeUrgent] = { OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha }, /* bar 1 seperator */
|
||||
{ OPAQUE, baralpha, borderalpha }, /* bar 1 */
|
||||
{ OPAQUE, baralpha, borderalpha }, /* bar 2 seperator */
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
{ OPAQUE, baralpha, borderalpha },
|
||||
};
|
||||
|
||||
/* tagging */
|
||||
@ -105,16 +45,24 @@ static const Rule rules[] = {
|
||||
* WM_NAME(STRING) = title
|
||||
*/
|
||||
/* class instance title tags mask isfloating monitor */
|
||||
{ "Syncthing GTK", NULL, NULL, 0, 1, -1 },
|
||||
{ "Toggl Desktop", NULL, NULL, 0, 1, -1 },
|
||||
{ "Gimp", NULL, NULL, 0, 1, -1 },
|
||||
{ "iceweasel", NULL, NULL, 1 << 8, 0, -1 },
|
||||
{ "Gpodder", NULL, NULL, 1 << 3, 0, -1 },
|
||||
{ "Syncthing GTK", NULL, NULL, 0, 1, -1 },
|
||||
|
||||
{ "Brave-browser", NULL, NULL, 0, 0, 1 },
|
||||
{ "Firefox", NULL, NULL, 0, 0, 1 },
|
||||
{ "iceweasel", NULL, NULL, 0, 0, 1 },
|
||||
|
||||
{ "Element", NULL, NULL, 1 << 2, 0, -1 },
|
||||
{ "Element-Nightly", NULL, NULL, 1 << 2, 0, -1 },
|
||||
{ "Slack", NULL, NULL, 1 << 2, 0, -1 },
|
||||
|
||||
{ "castero", NULL, NULL, 1 << 3, 0, -1 },
|
||||
{ "Spt", NULL, NULL, 1 << 3, 0, -1 },
|
||||
{ "Spotify", NULL, NULL, 1 << 3, 0, -1 },
|
||||
{ "ncmpcpp", NULL, NULL, 1 << 3, 0, -1 },
|
||||
{ "mutt", NULL, NULL, 1 << 5, 0, -1 },
|
||||
{ "weechat", NULL, NULL, 1 << 6, 0, -1 },
|
||||
{ "Slack", NULL, NULL, 1 << 6, 0, -1 },
|
||||
|
||||
{ "jetbrains-webstorm", NULL, NULL, 1 << 7, 0, -1 },
|
||||
|
||||
{ "Emacs", NULL, NULL, 1 << 8, 0, -1 },
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
@ -145,7 +93,7 @@ static const Layout layouts[] = {
|
||||
|
||||
/* commands */
|
||||
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
|
||||
static const char *dmenucmd[] = { "/home/alrayyes/.scripts/dmenu-frequency" };
|
||||
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
|
||||
static const char *termcmd[] = { "st", NULL };
|
||||
static const char scratchpadname[] = "scratchpad";
|
||||
static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL };
|
||||
@ -154,16 +102,19 @@ static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34
|
||||
|
||||
static Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
||||
//{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||
//{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
||||
{ MODKEY, XK_grave, togglescratch, {.v = scratchpadcmd } },
|
||||
{ MODKEY, XK_b, togglebar, {0} },
|
||||
{ MODKEY|ShiftMask, XK_j, rotatestack, {.i = +1 } },
|
||||
{ MODKEY|ShiftMask, XK_k, rotatestack, {.i = -1 } },
|
||||
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
||||
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
|
||||
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||
{ MODKEY, XK_Return, zoom, {0} },
|
||||
{ MODKEY|ShiftMask, XK_Return, zoom, {0} },
|
||||
{ MODKEY, XK_Tab, view, {0} },
|
||||
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
||||
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
||||
@ -172,7 +123,7 @@ static Key keys[] = {
|
||||
{ MODKEY, XK_g, setlayout, {.v = &layouts[3]} },
|
||||
{ MODKEY|ControlMask, XK_comma, cyclelayout, {.i = -1 } },
|
||||
{ MODKEY|ControlMask, XK_period, cyclelayout, {.i = +1 } },
|
||||
{ MODKEY, XK_space, setlayout, {0} },
|
||||
{ MODKEY, XK_p, setlayout, {0} },
|
||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
||||
@ -209,4 +160,3 @@ static Button buttons[] = {
|
||||
{ ClkTagBar, MODKEY, Button1, tag, {0} },
|
||||
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
|
||||
};
|
||||
|
||||
|
@ -1,19 +1,31 @@
|
||||
diff -up a/config.def.h b/config.def.h
|
||||
From 51f9c34480b984e261a738e5295f518b42c2f29c Mon Sep 17 00:00:00 2001
|
||||
From: Petrus Karell <pk@petruskarell.fi>
|
||||
Date: Mon, 19 Oct 2020 19:15:24 +0300
|
||||
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 61bb8b2
|
||||
|
||||
---
|
||||
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
|
||||
@@ -20,7 +20,8 @@ static const char col_black[] = "#
|
||||
static const char col_red[] = "#ff0000";
|
||||
static const char col_yellow[] = "#ffff00";
|
||||
static const char col_white[] = "#ffffff";
|
||||
-
|
||||
@@ -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 },
|
||||
@@ -28,6 +29,11 @@ static const char *colors[][3] = {
|
||||
[SchemeWarn] = { col_black, col_yellow, col_red },
|
||||
[SchemeUrgent]= { col_white, col_red, col_red },
|
||||
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
||||
};
|
||||
+static const unsigned int alphas[][3] = {
|
||||
+ /* fg bg border */
|
||||
@ -23,9 +35,10 @@ diff -up a/config.def.h b/config.def.h
|
||||
|
||||
/* tagging */
|
||||
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||
diff -up a/config.mk b/config.mk
|
||||
--- a/config.mk 2019-02-02 13:55:28.000000000 +0100
|
||||
+++ b/config.mk 2019-03-12 18:34:52.780703276 +0100
|
||||
diff --git a/config.mk b/config.mk
|
||||
index 7084c33..21b5404 100644
|
||||
--- a/config.mk
|
||||
+++ b/config.mk
|
||||
@@ -22,7 +22,7 @@ FREETYPEINC = /usr/include/freetype2
|
||||
|
||||
# includes and libs
|
||||
@ -34,11 +47,12 @@ diff -up a/config.mk b/config.mk
|
||||
+LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lXrender
|
||||
|
||||
# flags
|
||||
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
|
||||
diff -up a/drw.c b/drw.c
|
||||
--- a/drw.c 2019-02-02 13:55:28.000000000 +0100
|
||||
+++ b/drw.c 2019-03-12 18:34:52.780703276 +0100
|
||||
@@ -61,7 +61,7 @@ utf8decode(const char *c, long *u, size_
|
||||
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
|
||||
diff --git a/drw.c b/drw.c
|
||||
index 4cdbcbe..fe3aadd 100644
|
||||
--- a/drw.c
|
||||
+++ b/drw.c
|
||||
@@ -61,7 +61,7 @@ utf8decode(const char *c, long *u, size_t clen)
|
||||
}
|
||||
|
||||
Drw *
|
||||
@ -47,7 +61,7 @@ diff -up a/drw.c b/drw.c
|
||||
{
|
||||
Drw *drw = ecalloc(1, sizeof(Drw));
|
||||
|
||||
@@ -70,8 +70,14 @@ drw_create(Display *dpy, int screen, Win
|
||||
@@ -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;
|
||||
@ -56,15 +70,12 @@ diff -up a/drw.c b/drw.c
|
||||
+ drw->visual = visual;
|
||||
+ drw->depth = depth;
|
||||
+ drw->cmap = cmap;
|
||||
+ 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 +93,7 @@ drw_resize(Drw *drw, unsigned int w, uns
|
||||
@@ -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);
|
||||
@ -73,7 +84,7 @@ diff -up a/drw.c b/drw.c
|
||||
}
|
||||
|
||||
void
|
||||
@@ -193,21 +199,22 @@ drw_fontset_free(Fnt *font)
|
||||
@@ -194,21 +197,22 @@ drw_fontset_free(Fnt *font)
|
||||
}
|
||||
|
||||
void
|
||||
@ -100,7 +111,7 @@ diff -up a/drw.c b/drw.c
|
||||
{
|
||||
size_t i;
|
||||
Clr *ret;
|
||||
@@ -217,7 +224,7 @@ drw_scm_create(Drw *drw, const char *clr
|
||||
@@ -218,7 +222,7 @@ drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < clrcount; i++)
|
||||
@ -109,7 +120,7 @@ diff -up a/drw.c b/drw.c
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -273,9 +280,7 @@ drw_text(Drw *drw, int x, int y, unsigne
|
||||
@@ -274,9 +278,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);
|
||||
@ -120,9 +131,10 @@ diff -up a/drw.c b/drw.c
|
||||
x += lpad;
|
||||
w -= lpad;
|
||||
}
|
||||
diff -up a/drw.h b/drw.h
|
||||
--- a/drw.h 2019-02-02 13:55:28.000000000 +0100
|
||||
+++ b/drw.h 2019-03-12 18:34:52.780703276 +0100
|
||||
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;
|
||||
@ -142,7 +154,7 @@ diff -up a/drw.h b/drw.h
|
||||
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 *d
|
||||
@@ -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 */
|
||||
@ -153,28 +165,20 @@ diff -up a/drw.h b/drw.h
|
||||
|
||||
/* Cursor abstraction */
|
||||
Cur *drw_cur_create(Drw *drw, int shape);
|
||||
diff -up a/dwm.c b/dwm.c
|
||||
--- a/dwm.c 2019-03-13 09:31:38.313322535 +0100
|
||||
+++ b/dwm.c 2019-03-12 18:34:52.780703276 +0100
|
||||
@@ -58,6 +58,8 @@
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index 664c527..d8005c7 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
|
||||
+
|
||||
#define SYSTEM_TRAY_REQUEST_DOCK 0
|
||||
|
||||
/* XEMBED messages */
|
||||
@@ -74,6 +76,8 @@
|
||||
#define VERSION_MINOR 0
|
||||
#define XEMBED_EMBEDDED_VERSION (VERSION_MAJOR << 16) | VERSION_MINOR
|
||||
|
||||
+#define OPAQUE 0xffU
|
||||
+
|
||||
/* enums */
|
||||
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
|
||||
enum { SchemeNorm, SchemeSel, SchemeWarn, SchemeUrgent }; /* color schemes */
|
||||
@@ -272,6 +276,7 @@ static Client *wintosystrayicon(Window w
|
||||
enum { SchemeNorm, SchemeSel }; /* color schemes */
|
||||
@@ -233,6 +235,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);
|
||||
@ -182,7 +186,7 @@ diff -up a/dwm.c b/dwm.c
|
||||
static void zoom(const Arg *arg);
|
||||
|
||||
/* variables */
|
||||
@@ -310,6 +315,11 @@ static Drw *drw;
|
||||
@@ -269,6 +272,11 @@ static Drw *drw;
|
||||
static Monitor *mons, *selmon;
|
||||
static Window root, wmcheckwin;
|
||||
|
||||
@ -194,7 +198,7 @@ diff -up a/dwm.c b/dwm.c
|
||||
/* configuration, allows nested code to access above variables */
|
||||
#include "config.h"
|
||||
|
||||
@@ -1786,7 +1796,8 @@ setup(void)
|
||||
@@ -1542,7 +1550,8 @@ setup(void)
|
||||
sw = DisplayWidth(dpy, screen);
|
||||
sh = DisplayHeight(dpy, screen);
|
||||
root = RootWindow(dpy, screen);
|
||||
@ -204,16 +208,16 @@ diff -up a/dwm.c b/dwm.c
|
||||
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
|
||||
die("no fonts could be loaded.");
|
||||
lrpad = drw->fonts->h;
|
||||
@@ -1821,7 +1832,7 @@ setup(void)
|
||||
@@ -1570,7 +1579,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 system tray */
|
||||
updatesystray();
|
||||
/* init bars */
|
||||
@@ -2098,7 +2109,9 @@ updatebars(void)
|
||||
updatebars();
|
||||
updatestatus();
|
||||
@@ -1807,16 +1816,18 @@ updatebars(void)
|
||||
Monitor *m;
|
||||
XSetWindowAttributes wa = {
|
||||
.override_redirect = True,
|
||||
@ -224,33 +228,23 @@ diff -up a/dwm.c b/dwm.c
|
||||
.event_mask = ButtonPressMask|ExposureMask
|
||||
};
|
||||
XClassHint ch = {"dwm", "dwm"};
|
||||
@@ -2108,9 +2121,9 @@ updatebars(void)
|
||||
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),
|
||||
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);
|
||||
if (showsystray && m == systraytomon(m))
|
||||
XMapRaised(dpy, systray->win);
|
||||
@@ -2403,7 +2416,8 @@ updatesystray(void)
|
||||
XMapSubwindows(dpy, systray->win);
|
||||
/* redraw background */
|
||||
XSetForeground(dpy, drw->gc, scheme[SchemeNorm][ColBg].pixel);
|
||||
- XFillRectangle(dpy, systray->win, drw->gc, 0, 0, w, bh);
|
||||
+// XFillRectangle(dpy, systray->win, drw->gc, 0, 0, w, bh);
|
||||
+ XFillRectangle(dpy, systray->win, XCreateGC(dpy, root, 0, NULL), 0, 0, w, bh);
|
||||
XSync(dpy, False);
|
||||
XMapRaised(dpy, m->barwin);
|
||||
XSetClassHint(dpy, m->barwin, &ch);
|
||||
@@ -2113,6 +2124,43 @@ xerrorstart(Display *dpy, XErrorEvent *ee)
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -2552,6 +2566,43 @@ systraytomon(Monitor *m) {
|
||||
}
|
||||
|
||||
void
|
||||
+void
|
||||
+xinitvisual()
|
||||
+{
|
||||
+ XVisualInfo *infos;
|
||||
@ -287,7 +281,9 @@ diff -up a/dwm.c b/dwm.c
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void
|
||||
void
|
||||
zoom(const Arg *arg)
|
||||
{
|
||||
Client *c = selmon->sel;
|
||||
--
|
||||
2.28.0
|
||||
|
@ -1,39 +0,0 @@
|
||||
commit 5918623c5bd7fda155bf9dc3d33890c4ae1722d0
|
||||
Author: Simon Bremer <simon.bremer@tum.de>
|
||||
Date: Thu Dec 22 17:31:07 2016 +0100
|
||||
|
||||
Applied and fixed autostart patch for previous version;
|
||||
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index d27cb67..066ed71 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -194,6 +194,7 @@ static void resizeclient(Client *c, int x, int y, int w, int h);
|
||||
static void resizemouse(const Arg *arg);
|
||||
static void restack(Monitor *m);
|
||||
static void run(void);
|
||||
+static void runAutostart(void);
|
||||
static void scan(void);
|
||||
static int sendevent(Client *c, Atom proto);
|
||||
static void sendmon(Client *c, Monitor *m);
|
||||
@@ -1386,6 +1387,12 @@ run(void)
|
||||
}
|
||||
|
||||
void
|
||||
+runAutostart(void) {
|
||||
+ system("cd ~/.dwm; ./autostart_blocking.sh");
|
||||
+ system("cd ~/.dwm; ./autostart.sh &");
|
||||
+}
|
||||
+
|
||||
+void
|
||||
scan(void)
|
||||
{
|
||||
unsigned int i, num;
|
||||
@@ -2145,6 +2152,7 @@ main(int argc, char *argv[])
|
||||
checkotherwm();
|
||||
setup();
|
||||
scan();
|
||||
+ runAutostart();
|
||||
run();
|
||||
cleanup();
|
||||
XCloseDisplay(dpy);
|
179
dwm-autostart-20200610-cb3f58a.diff
Normal file
179
dwm-autostart-20200610-cb3f58a.diff
Normal file
@ -0,0 +1,179 @@
|
||||
From 37e970479dc5d40e57fc0cbfeaa5e39941483237 Mon Sep 17 00:00:00 2001
|
||||
From: Gan Ainm <gan.ainm.riomhphost@gmail.com>
|
||||
Date: Wed, 10 Jun 2020 10:59:02 +0000
|
||||
Subject: [PATCH] dwm-xdgautostart-6.2.diff
|
||||
|
||||
===================================================================
|
||||
---
|
||||
dwm.1 | 23 +++++++++++++++++
|
||||
dwm.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 105 insertions(+)
|
||||
|
||||
diff --git a/dwm.1 b/dwm.1
|
||||
index 13b3729..9533aa6 100644
|
||||
--- a/dwm.1
|
||||
+++ b/dwm.1
|
||||
@@ -30,6 +30,14 @@ top left corner. The tags which are applied to one or more windows are
|
||||
indicated with an empty square in the top left corner.
|
||||
.P
|
||||
dwm draws a small border around windows to indicate the focus state.
|
||||
+.P
|
||||
+On start, dwm can start additional programs that may be specified in two special
|
||||
+shell scripts (see the FILES section below), autostart_blocking.sh and
|
||||
+autostart.sh. The former is executed first and dwm will wait for its
|
||||
+termination before starting. The latter is executed in the background before
|
||||
+dwm enters its handler loop.
|
||||
+.P
|
||||
+Either of these files may be omitted.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-v
|
||||
@@ -152,6 +160,21 @@ Toggles focused window between floating and tiled state.
|
||||
.TP
|
||||
.B Mod1\-Button3
|
||||
Resize focused window while dragging. Tiled windows will be toggled to the floating state.
|
||||
+.SH FILES
|
||||
+The files containing programs to be started along with dwm are searched for in
|
||||
+the following directories:
|
||||
+.IP "1. $XDG_DATA_HOME/dwm"
|
||||
+.IP "2. $HOME/.local/share/dwm"
|
||||
+.IP "3. $HOME/.dwm"
|
||||
+.P
|
||||
+The first existing directory is scanned for any of the autostart files below.
|
||||
+.TP 15
|
||||
+autostart.sh
|
||||
+This file is started as a shell background process before dwm enters its handler
|
||||
+loop.
|
||||
+.TP 15
|
||||
+autostart_blocking.sh
|
||||
+This file is started before any autostart.sh; dwm waits for its termination.
|
||||
.SH CUSTOMIZATION
|
||||
dwm is customized by creating a custom config.h and (re)compiling the source
|
||||
code. This keeps it fast, secure and simple.
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index 4465af1..2156b49 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
+#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
#include <X11/cursorfont.h>
|
||||
#include <X11/keysym.h>
|
||||
@@ -193,6 +194,7 @@ static void resizeclient(Client *c, int x, int y, int w, int h);
|
||||
static void resizemouse(const Arg *arg);
|
||||
static void restack(Monitor *m);
|
||||
static void run(void);
|
||||
+static void runautostart(void);
|
||||
static void scan(void);
|
||||
static int sendevent(Client *c, Atom proto);
|
||||
static void sendmon(Client *c, Monitor *m);
|
||||
@@ -235,7 +237,11 @@ static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||
static void zoom(const Arg *arg);
|
||||
|
||||
/* variables */
|
||||
+static const char autostartblocksh[] = "autostart_blocking.sh";
|
||||
+static const char autostartsh[] = "autostart.sh";
|
||||
static const char broken[] = "broken";
|
||||
+static const char dwmdir[] = "dwm";
|
||||
+static const char localshare[] = ".local/share";
|
||||
static char stext[256];
|
||||
static int screen;
|
||||
static int sw, sh; /* X display screen geometry width, height */
|
||||
@@ -1380,6 +1386,83 @@ run(void)
|
||||
handler[ev.type](&ev); /* call handler */
|
||||
}
|
||||
|
||||
+void
|
||||
+runautostart(void)
|
||||
+{
|
||||
+ char *pathpfx;
|
||||
+ char *path;
|
||||
+ char *xdgdatahome;
|
||||
+ char *home;
|
||||
+ struct stat sb;
|
||||
+
|
||||
+ if ((home = getenv("HOME")) == NULL)
|
||||
+ /* this is almost impossible */
|
||||
+ return;
|
||||
+
|
||||
+ /* if $XDG_DATA_HOME is set and not empty, use $XDG_DATA_HOME/dwm,
|
||||
+ * otherwise use ~/.local/share/dwm as autostart script directory
|
||||
+ */
|
||||
+ xdgdatahome = getenv("XDG_DATA_HOME");
|
||||
+ if (xdgdatahome != NULL && *xdgdatahome != '\0') {
|
||||
+ /* space for path segments, separators and nul */
|
||||
+ pathpfx = ecalloc(1, strlen(xdgdatahome) + strlen(dwmdir) + 2);
|
||||
+
|
||||
+ if (sprintf(pathpfx, "%s/%s", xdgdatahome, dwmdir) <= 0) {
|
||||
+ free(pathpfx);
|
||||
+ return;
|
||||
+ }
|
||||
+ } else {
|
||||
+ /* space for path segments, separators and nul */
|
||||
+ pathpfx = ecalloc(1, strlen(home) + strlen(localshare)
|
||||
+ + strlen(dwmdir) + 3);
|
||||
+
|
||||
+ if (sprintf(pathpfx, "%s/%s/%s", home, localshare, dwmdir) < 0) {
|
||||
+ free(pathpfx);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* check if the autostart script directory exists */
|
||||
+ if (! (stat(pathpfx, &sb) == 0 && S_ISDIR(sb.st_mode))) {
|
||||
+ /* the XDG conformant path does not exist or is no directory
|
||||
+ * so we try ~/.dwm instead
|
||||
+ */
|
||||
+ char *pathpfx_new = realloc(pathpfx, strlen(home) + strlen(dwmdir) + 3);
|
||||
+ if(pathpfx_new == NULL) {
|
||||
+ free(pathpfx);
|
||||
+ return;
|
||||
+ }
|
||||
+ pathpfx = pathpfx_new;
|
||||
+
|
||||
+ if (sprintf(pathpfx, "%s/.%s", home, dwmdir) <= 0) {
|
||||
+ free(pathpfx);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* try the blocking script first */
|
||||
+ path = ecalloc(1, strlen(pathpfx) + strlen(autostartblocksh) + 2);
|
||||
+ if (sprintf(path, "%s/%s", pathpfx, autostartblocksh) <= 0) {
|
||||
+ free(path);
|
||||
+ free(pathpfx);
|
||||
+ }
|
||||
+
|
||||
+ if (access(path, X_OK) == 0)
|
||||
+ system(path);
|
||||
+
|
||||
+ /* now the non-blocking script */
|
||||
+ if (sprintf(path, "%s/%s", pathpfx, autostartsh) <= 0) {
|
||||
+ free(path);
|
||||
+ free(pathpfx);
|
||||
+ }
|
||||
+
|
||||
+ if (access(path, X_OK) == 0)
|
||||
+ system(strcat(path, " &"));
|
||||
+
|
||||
+ free(pathpfx);
|
||||
+ free(path);
|
||||
+}
|
||||
+
|
||||
void
|
||||
scan(void)
|
||||
{
|
||||
@@ -2142,6 +2223,7 @@ main(int argc, char *argv[])
|
||||
die("pledge");
|
||||
#endif /* __OpenBSD__ */
|
||||
scan();
|
||||
+ runautostart();
|
||||
run();
|
||||
cleanup();
|
||||
XCloseDisplay(dpy);
|
||||
--
|
||||
2.27.0
|
||||
|
@ -1,8 +1,8 @@
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index b2bc9bd..d9a333a 100644
|
||||
index 4465af1..c4aa3de 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -469,7 +469,7 @@ attachstack(Client *c)
|
||||
@@ -416,7 +416,7 @@ attachstack(Client *c)
|
||||
void
|
||||
buttonpress(XEvent *e)
|
||||
{
|
||||
@ -11,7 +11,7 @@ index b2bc9bd..d9a333a 100644
|
||||
Arg arg = {0};
|
||||
Client *c;
|
||||
Monitor *m;
|
||||
@@ -484,9 +484,13 @@ buttonpress(XEvent *e)
|
||||
@@ -431,9 +431,14 @@ buttonpress(XEvent *e)
|
||||
}
|
||||
if (ev->window == selmon->barwin) {
|
||||
i = x = 0;
|
||||
@ -19,6 +19,7 @@ index b2bc9bd..d9a333a 100644
|
||||
+ for (c = m->clients; c; c = c->next)
|
||||
+ occ |= c->tags == 255 ? 0 : c->tags;
|
||||
+ do {
|
||||
+ /* do not reserve space for vacant tags */
|
||||
+ if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
|
||||
+ continue;
|
||||
x += TEXTW(tags[i]);
|
||||
@ -27,9 +28,9 @@ index b2bc9bd..d9a333a 100644
|
||||
if (i < LENGTH(tags)) {
|
||||
click = ClkTagBar;
|
||||
arg.ui = 1 << i;
|
||||
@@ -836,19 +840,17 @@ drawbar(Monitor *m)
|
||||
@@ -709,19 +714,19 @@ drawbar(Monitor *m)
|
||||
}
|
||||
|
||||
resizebarwin(m);
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
- occ |= c->tags;
|
||||
+ occ |= c->tags == 255 ? 0 : c->tags;
|
||||
@ -38,8 +39,10 @@ index b2bc9bd..d9a333a 100644
|
||||
}
|
||||
x = 0;
|
||||
for (i = 0; i < LENGTH(tags); i++) {
|
||||
+ /* do not draw vacant tags */
|
||||
+ if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
|
||||
+ continue;
|
||||
+
|
||||
w = TEXTW(tags[i]);
|
||||
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
|
||||
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
|
@ -1,14 +1,23 @@
|
||||
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 d27cb67..ad6b4df 100644
|
||||
index 4465af1..685eca1 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -1287,6 +1287,13 @@ resizeclient(Client *c, int x, int y, int w, int h)
|
||||
@@ -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->isfullscreen && !c->isfloating) {
|
||||
+ c->w = wc.width += c->bw * 2;
|
||||
+ c->h = wc.height += c->bw * 2;
|
||||
+ wc.border_width = 0;
|
||||
@ -16,3 +25,6 @@ index d27cb67..ad6b4df 100644
|
||||
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
|
||||
configure(c);
|
||||
XSync(dpy, False);
|
||||
--
|
||||
2.21.0
|
||||
|
102
dwm-rotatestack-20161021-ab9571b.diff
Normal file
102
dwm-rotatestack-20161021-ab9571b.diff
Normal file
@ -0,0 +1,102 @@
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index fd77a07..09737d7 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -64,6 +64,8 @@ static Key keys[] = {
|
||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
||||
{ MODKEY, XK_b, togglebar, {0} },
|
||||
+ { MODKEY|ShiftMask, XK_j, rotatestack, {.i = +1 } },
|
||||
+ { MODKEY|ShiftMask, XK_k, rotatestack, {.i = -1 } },
|
||||
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
||||
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index 421bf27..1ec8b10 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -165,6 +165,8 @@ static void detachstack(Client *c);
|
||||
static Monitor *dirtomon(int dir);
|
||||
static void drawbar(Monitor *m);
|
||||
static void drawbars(void);
|
||||
+static void enqueue(Client *c);
|
||||
+static void enqueuestack(Client *c);
|
||||
static void enternotify(XEvent *e);
|
||||
static void expose(XEvent *e);
|
||||
static void focus(Client *c);
|
||||
@@ -194,6 +196,7 @@ static void resize(Client *c, int x, int y, int w, int h, int interact);
|
||||
static void resizeclient(Client *c, int x, int y, int w, int h);
|
||||
static void resizemouse(const Arg *arg);
|
||||
static void restack(Monitor *m);
|
||||
+static void rotatestack(const Arg *arg);
|
||||
static void run(void);
|
||||
static void scan(void);
|
||||
static int sendevent(Client *c, Atom proto);
|
||||
@@ -765,6 +768,28 @@ drawbars(void)
|
||||
}
|
||||
|
||||
void
|
||||
+enqueue(Client *c)
|
||||
+{
|
||||
+ Client *l;
|
||||
+ for (l = c->mon->clients; l && l->next; l = l->next);
|
||||
+ if (l) {
|
||||
+ l->next = c;
|
||||
+ c->next = NULL;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+enqueuestack(Client *c)
|
||||
+{
|
||||
+ Client *l;
|
||||
+ for (l = c->mon->stack; l && l->snext; l = l->snext);
|
||||
+ if (l) {
|
||||
+ l->snext = c;
|
||||
+ c->snext = NULL;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void
|
||||
enternotify(XEvent *e)
|
||||
{
|
||||
Client *c;
|
||||
@@ -1390,6 +1415,38 @@ restack(Monitor *m)
|
||||
}
|
||||
|
||||
void
|
||||
+rotatestack(const Arg *arg)
|
||||
+{
|
||||
+ Client *c = NULL, *f;
|
||||
+
|
||||
+ if (!selmon->sel)
|
||||
+ return;
|
||||
+ f = selmon->sel;
|
||||
+ if (arg->i > 0) {
|
||||
+ for (c = nexttiled(selmon->clients); c && nexttiled(c->next); c = nexttiled(c->next));
|
||||
+ if (c){
|
||||
+ detach(c);
|
||||
+ attach(c);
|
||||
+ detachstack(c);
|
||||
+ attachstack(c);
|
||||
+ }
|
||||
+ } else {
|
||||
+ if ((c = nexttiled(selmon->clients))){
|
||||
+ detach(c);
|
||||
+ enqueue(c);
|
||||
+ detachstack(c);
|
||||
+ enqueuestack(c);
|
||||
+ }
|
||||
+ }
|
||||
+ if (c){
|
||||
+ arrange(selmon);
|
||||
+ //unfocus(f, 1);
|
||||
+ focus(f);
|
||||
+ restack(selmon);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void
|
||||
run(void)
|
||||
{
|
||||
XEvent ev;
|
62
dwm-statuspadding-20150524-c8e9479.diff
Normal file
62
dwm-statuspadding-20150524-c8e9479.diff
Normal file
@ -0,0 +1,62 @@
|
||||
From 75d5edbe16ee2fc060ff8b05eea17791d6334a59 Mon Sep 17 00:00:00 2001
|
||||
From: Christopher Drelich <cd@cdrakka.com>
|
||||
Date: Thu, 24 May 2018 23:24:12 -0400
|
||||
Subject: [PATCH] Replaces magic numbers in statusbar with configurable
|
||||
variables.
|
||||
|
||||
horizpadbar for horizontal statusbar padding
|
||||
vertpadbar for vertical statusbar padding
|
||||
|
||||
StatusText now has both left and right padding,
|
||||
as well as the vertical padding that all of the statusbar shares.
|
||||
|
||||
Other than the addition of left padding to StatusText, appearance
|
||||
of the statusbar is identical to pre-patch when using the defaults
|
||||
in config.def.h
|
||||
---
|
||||
config.def.h | 2 ++
|
||||
dwm.c | 8 ++++----
|
||||
2 files changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index a9ac303..5819399 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -5,6 +5,8 @@ static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
static const unsigned int snap = 32; /* snap pixel */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
+static const int horizpadbar = 2; /* horizontal padding for statusbar */
|
||||
+static const int vertpadbar = 0; /* vertical padding for statusbar */
|
||||
static const char *fonts[] = { "monospace:size=10" };
|
||||
static const char dmenufont[] = "monospace:size=10";
|
||||
static const char col_gray1[] = "#222222";
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index bb95e26..7b9ed42 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -704,8 +704,8 @@ 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 = TEXTW(stext);
|
||||
+ drw_text(drw, m->ww - sw, 0, sw, bh, lrpad / 2, stext, 0);
|
||||
}
|
||||
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
@@ -1544,8 +1544,8 @@ setup(void)
|
||||
drw = drw_create(dpy, screen, root, sw, sh);
|
||||
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
|
||||
die("no fonts could be loaded.");
|
||||
- lrpad = drw->fonts->h;
|
||||
- bh = drw->fonts->h + 2;
|
||||
+ lrpad = drw->fonts->h + horizpadbar;
|
||||
+ bh = drw->fonts->h + vertpadbar;
|
||||
updategeom();
|
||||
/* init atoms */
|
||||
utf8string = XInternAtom(dpy, "UTF8_STRING", False);
|
||||
--
|
||||
2.7.4
|
||||
|
@ -1,725 +0,0 @@
|
||||
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..4bccb41 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,52 @@ 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;
|
||||
+ XGetWindowAttributes(dpy, c->win, &wa);
|
||||
+ 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 +651,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 +736,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 +784,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 +821,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 +832,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 +869,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 +958,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 +1002,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 +1116,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 +1204,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 +1334,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 +1394,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 +1415,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 +1495,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 +1597,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 +1640,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 +1729,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 +1740,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 +1751,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 +1884,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 +1990,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 +2012,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 +2196,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 dimenons 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 +2378,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 +2441,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)
|
||||
{
|
23
local-allow-color-fonts.diff
Normal file
23
local-allow-color-fonts.diff
Normal file
@ -0,0 +1,23 @@
|
||||
diff -up -N a/drw.c b/drw.c
|
||||
--- a/drw.c 2020-12-02 20:40:18.187876367 +0100
|
||||
+++ b/drw.c 2020-12-02 20:41:21.097993285 +0100
|
||||
@@ -135,19 +135,6 @@ xfont_create(Drw *drw, const char *fontn
|
||||
die("no font specified.");
|
||||
}
|
||||
|
||||
- /* Do not allow using color fonts. This is a workaround for a BadLength
|
||||
- * error from Xft with color glyphs. Modelled on the Xterm workaround. See
|
||||
- * https://bugzilla.redhat.com/show_bug.cgi?id=1498269
|
||||
- * https://lists.suckless.org/dev/1701/30932.html
|
||||
- * https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916349
|
||||
- * and lots more all over the internet.
|
||||
- */
|
||||
- FcBool iscol;
|
||||
- if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) {
|
||||
- XftFontClose(drw->dpy, xfont);
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
font = ecalloc(1, sizeof(Fnt));
|
||||
font->xfont = xfont;
|
||||
font->pattern = pattern;
|
164
local-autostart-20200610-cb3f58a.diff
Normal file
164
local-autostart-20200610-cb3f58a.diff
Normal file
@ -0,0 +1,164 @@
|
||||
diff -up a/dwm.1 b/dwm.1
|
||||
--- a/dwm.1 2020-12-01 10:01:44.217062949 +0100
|
||||
+++ b/dwm.1 2020-12-01 10:04:30.247194027 +0100
|
||||
@@ -30,6 +30,14 @@ top left corner. The tags which are app
|
||||
indicated with an empty square in the top left corner.
|
||||
.P
|
||||
dwm draws a small border around windows to indicate the focus state.
|
||||
+.P
|
||||
+On start, dwm can start additional programs that may be specified in two special
|
||||
+shell scripts (see the FILES section below), autostart_blocking.sh and
|
||||
+autostart.sh. The former is executed first and dwm will wait for its
|
||||
+termination before starting. The latter is executed in the background before
|
||||
+dwm enters its handler loop.
|
||||
+.P
|
||||
+Either of these files may be omitted.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-v
|
||||
@@ -152,6 +160,21 @@ Toggles focused window between floating
|
||||
.TP
|
||||
.B Mod1\-Button3
|
||||
Resize focused window while dragging. Tiled windows will be toggled to the floating state.
|
||||
+.SH FILES
|
||||
+The files containing programs to be started along with dwm are searched for in
|
||||
+the following directories:
|
||||
+.IP "1. $XDG_DATA_HOME/dwm"
|
||||
+.IP "2. $HOME/.local/share/dwm"
|
||||
+.IP "3. $HOME/.dwm"
|
||||
+.P
|
||||
+The first existing directory is scanned for any of the autostart files below.
|
||||
+.TP 15
|
||||
+autostart.sh
|
||||
+This file is started as a shell background process before dwm enters its handler
|
||||
+loop.
|
||||
+.TP 15
|
||||
+autostart_blocking.sh
|
||||
+This file is started before any autostart.sh; dwm waits for its termination.
|
||||
.SH CUSTOMIZATION
|
||||
dwm is customized by creating a custom config.h and (re)compiling the source
|
||||
code. This keeps it fast, secure and simple.
|
||||
diff -up a/dwm.c b/dwm.c
|
||||
--- a/dwm.c 2020-12-01 10:01:44.217062949 +0100
|
||||
+++ b/dwm.c 2020-12-01 10:07:15.937309505 +0100
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
+#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
#include <X11/cursorfont.h>
|
||||
#include <X11/keysym.h>
|
||||
@@ -222,6 +223,7 @@ static void resizemouse(const Arg *arg);
|
||||
static void resizerequest(XEvent *e);
|
||||
static void restack(Monitor *m);
|
||||
static void run(void);
|
||||
+static void runautostart(void);
|
||||
static void scan(void);
|
||||
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);
|
||||
@@ -269,8 +271,12 @@ static int xerrorstart(Display *dpy, XEr
|
||||
static void zoom(const Arg *arg);
|
||||
|
||||
/* variables */
|
||||
+static const char autostartblocksh[] = "autostart_blocking.sh";
|
||||
+static const char autostartsh[] = "autostart.sh";
|
||||
static Systray *systray = NULL;
|
||||
static const char broken[] = "broken";
|
||||
+static const char dwmdir[] = "dwm";
|
||||
+static const char localshare[] = ".local/share";
|
||||
static char stext[256];
|
||||
static int screen;
|
||||
static int sw, sh; /* X display screen geometry width, height */
|
||||
@@ -1557,6 +1563,83 @@ run(void)
|
||||
}
|
||||
|
||||
void
|
||||
+runautostart(void)
|
||||
+{
|
||||
+ char *pathpfx;
|
||||
+ char *path;
|
||||
+ char *xdgdatahome;
|
||||
+ char *home;
|
||||
+ struct stat sb;
|
||||
+
|
||||
+ if ((home = getenv("HOME")) == NULL)
|
||||
+ /* this is almost impossible */
|
||||
+ return;
|
||||
+
|
||||
+ /* if $XDG_DATA_HOME is set and not empty, use $XDG_DATA_HOME/dwm,
|
||||
+ * otherwise use ~/.local/share/dwm as autostart script directory
|
||||
+ */
|
||||
+ xdgdatahome = getenv("XDG_DATA_HOME");
|
||||
+ if (xdgdatahome != NULL && *xdgdatahome != '\0') {
|
||||
+ /* space for path segments, separators and nul */
|
||||
+ pathpfx = ecalloc(1, strlen(xdgdatahome) + strlen(dwmdir) + 2);
|
||||
+
|
||||
+ if (sprintf(pathpfx, "%s/%s", xdgdatahome, dwmdir) <= 0) {
|
||||
+ free(pathpfx);
|
||||
+ return;
|
||||
+ }
|
||||
+ } else {
|
||||
+ /* space for path segments, separators and nul */
|
||||
+ pathpfx = ecalloc(1, strlen(home) + strlen(localshare)
|
||||
+ + strlen(dwmdir) + 3);
|
||||
+
|
||||
+ if (sprintf(pathpfx, "%s/%s/%s", home, localshare, dwmdir) < 0) {
|
||||
+ free(pathpfx);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* check if the autostart script directory exists */
|
||||
+ if (! (stat(pathpfx, &sb) == 0 && S_ISDIR(sb.st_mode))) {
|
||||
+ /* the XDG conformant path does not exist or is no directory
|
||||
+ * so we try ~/.dwm instead
|
||||
+ */
|
||||
+ char *pathpfx_new = realloc(pathpfx, strlen(home) + strlen(dwmdir) + 3);
|
||||
+ if(pathpfx_new == NULL) {
|
||||
+ free(pathpfx);
|
||||
+ return;
|
||||
+ }
|
||||
+ pathpfx = pathpfx_new;
|
||||
+
|
||||
+ if (sprintf(pathpfx, "%s/.%s", home, dwmdir) <= 0) {
|
||||
+ free(pathpfx);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* try the blocking script first */
|
||||
+ path = ecalloc(1, strlen(pathpfx) + strlen(autostartblocksh) + 2);
|
||||
+ if (sprintf(path, "%s/%s", pathpfx, autostartblocksh) <= 0) {
|
||||
+ free(path);
|
||||
+ free(pathpfx);
|
||||
+ }
|
||||
+
|
||||
+ if (access(path, X_OK) == 0)
|
||||
+ system(path);
|
||||
+
|
||||
+ /* now the non-blocking script */
|
||||
+ if (sprintf(path, "%s/%s", pathpfx, autostartsh) <= 0) {
|
||||
+ free(path);
|
||||
+ free(pathpfx);
|
||||
+ }
|
||||
+
|
||||
+ if (access(path, X_OK) == 0)
|
||||
+ system(strcat(path, " &"));
|
||||
+
|
||||
+ free(pathpfx);
|
||||
+ free(path);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
scan(void)
|
||||
{
|
||||
unsigned int i, num;
|
||||
@@ -2501,6 +2584,7 @@ main(int argc, char *argv[])
|
||||
die("pledge");
|
||||
#endif /* __OpenBSD__ */
|
||||
scan();
|
||||
+ runautostart();
|
||||
run();
|
||||
cleanup();
|
||||
XCloseDisplay(dpy);
|
@ -1,148 +0,0 @@
|
||||
diff -up a/dwm.c b/dwm.c
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -56,6 +56,7 @@
|
||||
#define WIDTH(X) ((X)->w + 2 * (X)->bw)
|
||||
#define HEIGHT(X) ((X)->h + 2 * (X)->bw)
|
||||
#define TAGMASK ((1 << LENGTH(tags)) - 1)
|
||||
+#define TAGSLENGTH (LENGTH(tags))
|
||||
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
|
||||
|
||||
#define SYSTEM_TRAY_REQUEST_DOCK 0
|
||||
@@ -80,7 +81,7 @@ enum { SchemeNorm, SchemeSel }; /* color
|
||||
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
|
||||
NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation, NetSystemTrayOrientationHorz,
|
||||
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
|
||||
- NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
|
||||
+ NetWMWindowTypeDialog, NetClientList, NetDesktopNames, NetDesktopViewport, NetNumberOfDesktops, NetCurrentDesktop, NetLast }; /* EWMH atoms */
|
||||
enum { Manager, Xembed, XembedInfo, XLast }; /* Xembed atoms */
|
||||
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
|
||||
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
|
||||
@@ -231,11 +232,15 @@ static void scan(void);
|
||||
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 setcurrentdesktop(void);
|
||||
+static void setdesktopnames(void);
|
||||
static void setfocus(Client *c);
|
||||
static void setfullscreen(Client *c, int fullscreen);
|
||||
static void setlayout(const Arg *arg);
|
||||
static void setmfact(const Arg *arg);
|
||||
+static void setnumdesktops(void);
|
||||
static void setup(void);
|
||||
+static void setviewport(void);
|
||||
static void seturgent(Client *c, int urg);
|
||||
static void showhide(Client *c);
|
||||
static void sigchld(int unused);
|
||||
@@ -251,6 +256,7 @@ static void toggleview(const Arg *arg);
|
||||
static void unfocus(Client *c, int setfocus);
|
||||
static void unmanage(Client *c, int destroyed);
|
||||
static void unmapnotify(XEvent *e);
|
||||
+static void updatecurrentdesktop(void);
|
||||
static void updatebarpos(Monitor *m);
|
||||
static void updatebars(void);
|
||||
static void updateclientlist(void);
|
||||
@@ -1652,6 +1658,16 @@ setclientstate(Client *c, long state)
|
||||
XChangeProperty(dpy, c->win, wmatom[WMState], wmatom[WMState], 32,
|
||||
PropModeReplace, (unsigned char *)data, 2);
|
||||
}
|
||||
+void
|
||||
+setcurrentdesktop(void){
|
||||
+ long data[] = { 0 };
|
||||
+ XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1);
|
||||
+}
|
||||
+void setdesktopnames(void){
|
||||
+ XTextProperty text;
|
||||
+ Xutf8TextListToTextProperty(dpy, tags, TAGSLENGTH, XUTF8StringStyle, &text);
|
||||
+ XSetTextProperty(dpy, root, &text, netatom[NetDesktopNames]);
|
||||
+}
|
||||
|
||||
int
|
||||
sendevent(Window w, Atom proto, int mask, long d0, long d1, long d2, long d3, long d4)
|
||||
@@ -1689,6 +1705,12 @@ sendevent(Window w, Atom proto, int mask
|
||||
}
|
||||
|
||||
void
|
||||
+setnumdesktops(void){
|
||||
+ long data[] = { TAGSLENGTH };
|
||||
+ XChangeProperty(dpy, root, netatom[NetNumberOfDesktops], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
setfocus(Client *c)
|
||||
{
|
||||
if (!c->neverfocus) {
|
||||
@@ -1797,6 +1819,10 @@ 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);
|
||||
+ netatom[NetDesktopViewport] = XInternAtom(dpy, "_NET_DESKTOP_VIEWPORT", False);
|
||||
+ netatom[NetNumberOfDesktops] = XInternAtom(dpy, "_NET_NUMBER_OF_DESKTOPS", False);
|
||||
+ netatom[NetCurrentDesktop] = XInternAtom(dpy, "_NET_CURRENT_DESKTOP", False);
|
||||
+ netatom[NetDesktopNames] = XInternAtom(dpy, "_NET_DESKTOP_NAMES", False);
|
||||
xatom[Manager] = XInternAtom(dpy, "MANAGER", False);
|
||||
xatom[Xembed] = XInternAtom(dpy, "_XEMBED", False);
|
||||
xatom[XembedInfo] = XInternAtom(dpy, "_XEMBED_INFO", False);
|
||||
@@ -1824,6 +1850,10 @@ setup(void)
|
||||
/* EWMH support per view */
|
||||
XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
|
||||
PropModeReplace, (unsigned char *) netatom, NetLast);
|
||||
+ setnumdesktops();
|
||||
+ setcurrentdesktop();
|
||||
+ setdesktopnames();
|
||||
+ setviewport();
|
||||
XDeleteProperty(dpy, root, netatom[NetClientList]);
|
||||
/* select events */
|
||||
wa.cursor = cursor[CurNormal]->cursor;
|
||||
@@ -1835,6 +1865,11 @@ setup(void)
|
||||
grabkeys();
|
||||
focus(NULL);
|
||||
}
|
||||
+void
|
||||
+setviewport(void){
|
||||
+ long data[] = { 0, 0 };
|
||||
+ XChangeProperty(dpy, root, netatom[NetDesktopViewport], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 2);
|
||||
+}
|
||||
|
||||
|
||||
void
|
||||
@@ -1983,6 +2018,7 @@ toggletag(const Arg *arg)
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
}
|
||||
+ updatecurrentdesktop();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1994,6 +2030,7 @@ toggleview(const Arg *arg)
|
||||
selmon->tagset[selmon->seltags] = newtagset;
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
+ updatecurrentdesktop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2109,6 +2146,15 @@ updateclientlist()
|
||||
XA_WINDOW, 32, PropModeAppend,
|
||||
(unsigned char *) &(c->win), 1);
|
||||
}
|
||||
+void updatecurrentdesktop(void){
|
||||
+ long rawdata[] = { selmon->tagset[selmon->seltags] };
|
||||
+ int i=0;
|
||||
+ while(*rawdata >> i+1){
|
||||
+ i++;
|
||||
+ }
|
||||
+ long data[] = { i };
|
||||
+ XChangeProperty(dpy, root, netatom[NetCurrentDesktop], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)data, 1);
|
||||
+}
|
||||
|
||||
int
|
||||
updategeom(void)
|
||||
@@ -2421,6 +2467,7 @@ view(const Arg *arg)
|
||||
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
|
||||
focus(NULL);
|
||||
arrange(selmon);
|
||||
+ updatecurrentdesktop();
|
||||
}
|
||||
|
||||
Client *
|
@ -1,73 +0,0 @@
|
||||
diff -up a/dwm.c b/dwm.c
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -822,10 +822,10 @@ dirtomon(int dir)
|
||||
void
|
||||
drawbar(Monitor *m)
|
||||
{
|
||||
- int x, w, sw = 0, stw = 0;
|
||||
+ int x, w, sw = 0, stw = 0, tw, mw, ew = 0;
|
||||
int boxs = drw->fonts->h / 9;
|
||||
int boxw = drw->fonts->h / 6 + 2;
|
||||
- unsigned int i, occ = 0, urg = 0;
|
||||
+ unsigned int i, occ = 0, urg = 0, n = 0;
|
||||
char *ts = stext;
|
||||
char *tp = stext;
|
||||
int tx = 0;
|
||||
@@ -854,6 +854,8 @@ drawbar(Monitor *m)
|
||||
|
||||
resizebarwin(m);
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
+ if (ISVISIBLE(c))
|
||||
+ n++;
|
||||
occ |= c->tags == 255 ? 0 : c->tags;
|
||||
if (c->isurgent)
|
||||
urg |= c->tags;
|
||||
@@ -872,15 +874,39 @@ drawbar(Monitor *m)
|
||||
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
||||
|
||||
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);
|
||||
- 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);
|
||||
+ if (n > 0) {
|
||||
+ tw = TEXTW(m->sel->name) + lrpad;
|
||||
+ mw = (tw >= w || n == 1) ? 0 : (w - tw) / (n - 1);
|
||||
+
|
||||
+ i = 0;
|
||||
+ for (c = m->clients; c; c = c->next) {
|
||||
+ if (!ISVISIBLE(c) || c == m->sel)
|
||||
+ continue;
|
||||
+ tw = TEXTW(c->name);
|
||||
+ if(tw < mw)
|
||||
+ ew += (mw - tw);
|
||||
+ else
|
||||
+ i++;
|
||||
+ }
|
||||
+ if (i > 0)
|
||||
+ mw += ew / i;
|
||||
+
|
||||
+ for (c = m->clients; c; c = c->next) {
|
||||
+ if (!ISVISIBLE(c))
|
||||
+ continue;
|
||||
+ tw = MIN(m->sel == c ? w : mw, TEXTW(c->name));
|
||||
+
|
||||
+ drw_setscheme(drw, scheme[m->sel == c ? SchemeSel : SchemeNorm]);
|
||||
+ if (tw > 0) /* trap special handling of 0 in drw_text */
|
||||
+ drw_text(drw, x, 0, tw, bh, lrpad / 2, c->name, 0);
|
||||
+ if (c->isfloating)
|
||||
+ drw_rect(drw, x + boxs, boxs, boxw, boxw, c->isfixed, 0);
|
||||
+ x += tw;
|
||||
+ w -= tw;
|
||||
+ }
|
||||
}
|
||||
+ drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
+ drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||
}
|
||||
drw_map(drw, m->barwin, 0, 0, m->ww - stw, bh);
|
||||
}
|
@ -1,19 +1,7 @@
|
||||
From b04bb473cf9818277d33a591f7fe2dfae96afaaf Mon Sep 17 00:00:00 2001
|
||||
From: Joshua Haase <hahj87@gmail.com>
|
||||
Date: Mon, 15 Aug 2016 17:06:18 -0500
|
||||
Subject: [PATCH] Apply modified gridmode patch.
|
||||
|
||||
---
|
||||
config.def.h | 3 +++
|
||||
layouts.c | 27 +++++++++++++++++++++++++++
|
||||
2 files changed, 30 insertions(+)
|
||||
create mode 100644 layouts.c
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index a9ac303..30b7c4a 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -36,11 +36,13 @@ static const float mfact = 0.55; /* factor of master area size [0.05..0.95]
|
||||
diff -up -N a/config.def.h b/config.def.h
|
||||
--- a/config.def.h 2020-12-01 15:15:53.119791206 +0100
|
||||
+++ b/config.def.h 2020-12-01 15:19:11.023371325 +0100
|
||||
@@ -40,11 +40,13 @@ static const float mfact = 0.55; /*
|
||||
static const int nmaster = 1; /* number of clients in master area */
|
||||
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
||||
|
||||
@ -24,22 +12,20 @@ index a9ac303..30b7c4a 100644
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
{ "[M]", monocle },
|
||||
+ { "HHH", grid },
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
/* key definitions */
|
||||
@@ -76,6 +78,7 @@ static Key keys[] = {
|
||||
@@ -81,6 +83,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_g, setlayout, {.v = &layouts[3]} },
|
||||
{ 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/layouts.c b/layouts.c
|
||||
new file mode 100644
|
||||
index 0000000..d26acf3
|
||||
--- /dev/null
|
||||
+++ b/layouts.c
|
||||
diff -up -N a/layouts.c b/layouts.c
|
||||
--- a/layouts.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ b/layouts.c 2020-12-01 15:18:37.303329321 +0100
|
||||
@@ -0,0 +1,27 @@
|
||||
+void
|
||||
+grid(Monitor *m) {
|
||||
@ -68,6 +54,3 @@ index 0000000..d26acf3
|
||||
+ i++;
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
2.14.1
|
||||
|
@ -1,23 +1,16 @@
|
||||
# HG changeset patch
|
||||
# User Barbu Paul - Gheorghe <barbu.paul.gheorghe@gmail.com>
|
||||
# Date 1354650884 -7200
|
||||
# Node ID 6c472a21a5887c5295a331c48c4da188ec2c8413
|
||||
# Parent aaab44133a6830c9a00263731d098c01cc1d6fb5
|
||||
selfrestart now magically locates the current dwm (no need to hardcode a path)
|
||||
|
||||
diff -r aaab44133a68 -r 6c472a21a588 config.def.h
|
||||
--- a/config.def.h Tue Dec 04 21:54:44 2012 +0200
|
||||
+++ b/config.def.h Tue Dec 04 21:54:44 2012 +0200
|
||||
@@ -54,6 +54,8 @@
|
||||
static const char *termcmd[] = { "urxvtc", NULL };
|
||||
static const char *filemancmd[] = { "thunar", NULL };
|
||||
diff -up -N a/config.def.h b/config.def.h
|
||||
--- a/config.def.h 2020-12-01 10:21:09.920859006 +0100
|
||||
+++ b/config.def.h 2020-12-01 10:22:27.167535028 +0100
|
||||
@@ -66,6 +66,8 @@ static char dmenumon[2] = "0"; /* compon
|
||||
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 };
|
||||
|
||||
+#include "selfrestart.c"
|
||||
+
|
||||
static Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
{ MODKEY, XK_r, spawn, {.v = dmenucmd } },
|
||||
@@ -89,6 +91,7 @@
|
||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||
@@ -103,6 +105,7 @@ static Key keys[] = {
|
||||
TAGKEYS( XK_7, 6)
|
||||
TAGKEYS( XK_8, 7)
|
||||
TAGKEYS( XK_9, 8)
|
||||
@ -25,14 +18,9 @@ diff -r aaab44133a68 -r 6c472a21a588 config.def.h
|
||||
{ MODKEY|ShiftMask, XK_q, quit, {0} },
|
||||
};
|
||||
|
||||
@@ -108,4 +111,3 @@
|
||||
{ ClkTagBar, MODKEY, Button1, tag, {0} },
|
||||
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
|
||||
};
|
||||
-
|
||||
diff -r aaab44133a68 -r 6c472a21a588 selfrestart.c
|
||||
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
||||
+++ b/selfrestart.c Tue Dec 04 21:54:44 2012 +0200
|
||||
diff -up -N a/selfrestart.c b/selfrestart.c
|
||||
--- a/selfrestart.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ b/selfrestart.c 2020-12-01 10:24:06.714211651 +0100
|
||||
@@ -0,0 +1,65 @@
|
||||
+#include <unistd.h>
|
||||
+#include <sys/types.h>
|
@ -1,7 +1,7 @@
|
||||
diff -up a/config.def.h b/config.def.h
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -72,6 +72,8 @@ static const Layout layouts[] = {
|
||||
diff -up -N a/config.def.h b/config.def.h
|
||||
--- a/config.def.h 2020-12-01 11:12:09.214062117 +0100
|
||||
+++ b/config.def.h 2020-12-01 11:15:20.540986211 +0100
|
||||
@@ -72,6 +74,8 @@ static const Layout layouts[] = {
|
||||
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 };
|
||||
@ -10,18 +10,18 @@ diff -up a/config.def.h b/config.def.h
|
||||
|
||||
#include "selfrestart.c"
|
||||
|
||||
@@ -79,6 +81,7 @@ static Key keys[] = {
|
||||
@@ -79,6 +83,7 @@ static Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
||||
+ { MODKEY, XK_grave, togglescratch, {.v = scratchpadcmd } },
|
||||
{ MODKEY, XK_b, togglebar, {0} },
|
||||
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
||||
{ MODKEY|ShiftMask, XK_j, rotatestack, {.i = +1 } },
|
||||
{ MODKEY|ShiftMask, XK_k, rotatestack, {.i = -1 } },
|
||||
diff -up a/dwm.c b/dwm.c
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -246,6 +246,7 @@ static void tagmon(const Arg *arg);
|
||||
--- a/dwm.c 2019-06-06 21:23:27.023328450 +0200
|
||||
+++ b/dwm.c 2019-06-20 15:07:01.089767947 +0200
|
||||
@@ -213,6 +213,7 @@ static void tagmon(const Arg *arg);
|
||||
static void tile(Monitor *);
|
||||
static void togglebar(const Arg *arg);
|
||||
static void togglefloating(const Arg *arg);
|
||||
@ -29,7 +29,7 @@ diff -up a/dwm.c b/dwm.c
|
||||
static void toggletag(const Arg *arg);
|
||||
static void toggleview(const Arg *arg);
|
||||
static void unfocus(Client *c, int setfocus);
|
||||
@@ -312,6 +313,8 @@ static Window root, wmcheckwin;
|
||||
@@ -273,6 +274,8 @@ static Window root, wmcheckwin;
|
||||
/* configuration, allows nested code to access above variables */
|
||||
#include "config.h"
|
||||
|
||||
@ -38,10 +38,11 @@ diff -up a/dwm.c b/dwm.c
|
||||
/* compile-time check if all tags fit into an unsigned int bit array. */
|
||||
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
|
||||
|
||||
@@ -1238,6 +1241,13 @@ manage(Window w, XWindowAttributes *wa)
|
||||
@@ -1052,6 +1055,14 @@ manage(Window w, XWindowAttributes *wa)
|
||||
&& (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
|
||||
c->bw = borderpx;
|
||||
|
||||
+ selmon->tagset[selmon->seltags] &= ~scratchtag;
|
||||
+ if (!strcmp(c->name, scratchpadname)) {
|
||||
+ c->mon->tagset[c->mon->seltags] |= c->tags = scratchtag;
|
||||
+ c->isfloating = True;
|
||||
@ -52,7 +53,15 @@ diff -up a/dwm.c b/dwm.c
|
||||
wc.border_width = c->bw;
|
||||
XConfigureWindow(dpy, w, CWBorderWidth, &wc);
|
||||
XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel);
|
||||
@@ -2013,6 +2023,28 @@ togglefloating(const Arg *arg)
|
||||
@@ -1661,6 +1672,7 @@ spawn(const Arg *arg)
|
||||
{
|
||||
if (arg->v == dmenucmd)
|
||||
dmenumon[0] = '0' + selmon->num;
|
||||
+ selmon->tagset[selmon->seltags] &= ~scratchtag;
|
||||
if (fork() == 0) {
|
||||
if (dpy)
|
||||
close(ConnectionNumber(dpy));
|
||||
@@ -1748,6 +1760,28 @@ togglefloating(const Arg *arg)
|
||||
}
|
||||
|
||||
void
|
@ -1,83 +0,0 @@
|
||||
From 35418d156fccb922710f6ca80a1f3972ba88b42f Mon Sep 17 00:00:00 2001
|
||||
From: Danny O'Brien <danny@spesh.com>
|
||||
Date: Mon, 8 Oct 2018 19:21:29 -0700
|
||||
Subject: [PATCH] Add colors to status message in bar.
|
||||
|
||||
This patch matches the format used by
|
||||
https://dwm.suckless.org/patches/statuscolors/ -- An \x01 character
|
||||
switches to the normal foreground/color combo, \x02 switches to the
|
||||
color combo used for selected tags, \03 is set by default to black on
|
||||
yellow, \04 is white on red.
|
||||
|
||||
These color settings are defined in the colors array in config.def.h.
|
||||
More can be added, but don't have more than 32, or you'll start hitting
|
||||
real ASCII.
|
||||
|
||||
This applies cleanly on mainline dwm from commit 022d076 (Sat Jan 7
|
||||
17:21:29 2017 +0100) until at least b69c870 (Sat Jun 2 17:15:42 2018
|
||||
+020).
|
||||
|
||||
---
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
@@ -16,10 +16,17 @@ static const char col_gray2[] = "#
|
||||
static const char col_gray3[] = "#bbbbbb";
|
||||
static const char col_gray4[] = "#eeeeee";
|
||||
static const char col_cyan[] = "#005577";
|
||||
+static const char col_black[] = "#000000";
|
||||
+static const char col_red[] = "#ff0000";
|
||||
+static const char col_yellow[] = "#ffff00";
|
||||
+static const char col_white[] = "#ffffff";
|
||||
+
|
||||
static const char *colors[][3] = {
|
||||
- /* fg bg border */
|
||||
- [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
|
||||
- [SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
||||
+ /* fg bg border */
|
||||
+ [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
|
||||
+ [SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
||||
+ [SchemeWarn] = { col_black, col_yellow, col_red },
|
||||
+ [SchemeUrgent]= { col_white, col_red, col_red },
|
||||
};
|
||||
|
||||
/* tagging */
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
@@ -76,7 +76,7 @@
|
||||
|
||||
/* enums */
|
||||
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
|
||||
-enum { SchemeNorm, SchemeSel }; /* color schemes */
|
||||
+enum { SchemeNorm, SchemeSel, SchemeWarn, SchemeUrgent }; /* color schemes */
|
||||
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
|
||||
NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation, NetSystemTrayOrientationHorz,
|
||||
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
|
||||
@@ -826,6 +826,10 @@ drawbar(Monitor *m)
|
||||
int boxs = drw->fonts->h / 9;
|
||||
int boxw = drw->fonts->h / 6 + 2;
|
||||
unsigned int i, occ = 0, urg = 0;
|
||||
+ char *ts = stext;
|
||||
+ char *tp = stext;
|
||||
+ int tx = 0;
|
||||
+ char ctmp;
|
||||
Client *c;
|
||||
|
||||
if(showsystray && m == systraytomon(m))
|
||||
@@ -835,7 +839,17 @@ drawbar(Monitor *m)
|
||||
if (m == selmon) { /* status is only drawn on selected monitor */
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
sw = TEXTW(stext) - lrpad / 2 + 2; /* 2px right padding */
|
||||
- drw_text(drw, m->ww - sw - stw, 0, sw, bh, lrpad / 2 - 2, stext, 0);
|
||||
+ while (1) {
|
||||
+ if ((unsigned int)*ts > LENGTH(colors)) { ts++; continue ; }
|
||||
+ ctmp = *ts;
|
||||
+ *ts = '\0';
|
||||
+ drw_text(drw, m->ww - sw + tx, 0, sw - tx, bh, 0, tp, 0);
|
||||
+ tx += TEXTW(tp) -lrpad;
|
||||
+ if (ctmp == '\0') { break; }
|
||||
+ drw_setscheme(drw, scheme[(unsigned int)(ctmp-1)]);
|
||||
+ *ts = ctmp;
|
||||
+ tp = ++ts;
|
||||
+ }
|
||||
}
|
||||
|
||||
resizebarwin(m);
|
66
local-uselessgap-6.2.diff
Normal file
66
local-uselessgap-6.2.diff
Normal file
@ -0,0 +1,66 @@
|
||||
diff -up -N a/config.def.h b/config.def.h
|
||||
--- a/config.def.h 2020-12-01 11:22:39.024878812 +0100
|
||||
+++ b/config.def.h 2020-12-01 11:23:21.208263865 +0100
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
/* appearance */
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
+static const unsigned int gappx = 6; /* gaps between 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 */
|
||||
diff -up -N a/dwm.c b/dwm.c
|
||||
--- a/dwm.c 2020-12-01 11:22:39.024878812 +0100
|
||||
+++ b/dwm.c 2020-12-01 11:25:30.515086777 +0100
|
||||
@@ -53,8 +53,8 @@
|
||||
#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]))
|
||||
#define LENGTH(X) (sizeof X / sizeof X[0])
|
||||
#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
|
||||
-#define WIDTH(X) ((X)->w + 2 * (X)->bw)
|
||||
-#define HEIGHT(X) ((X)->h + 2 * (X)->bw)
|
||||
+#define WIDTH(X) ((X)->w + 2 * (X)->bw + gappx)
|
||||
+#define HEIGHT(X) ((X)->h + 2 * (X)->bw + gappx)
|
||||
#define TAGMASK ((1 << LENGTH(tags)) - 1)
|
||||
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
|
||||
|
||||
@@ -1505,12 +1505,36 @@ void
|
||||
resizeclient(Client *c, int x, int y, int w, int h)
|
||||
{
|
||||
XWindowChanges wc;
|
||||
+ unsigned int n;
|
||||
+ unsigned int gapoffset;
|
||||
+ unsigned int gapincr;
|
||||
+ Client *nbc;
|
||||
|
||||
- c->oldx = c->x; c->x = wc.x = x;
|
||||
- c->oldy = c->y; c->y = wc.y = y;
|
||||
- c->oldw = c->w; c->w = wc.width = w;
|
||||
- c->oldh = c->h; c->h = wc.height = h;
|
||||
wc.border_width = c->bw;
|
||||
+
|
||||
+ /* Get number of clients for the selected monitor */
|
||||
+ for (n = 0, nbc = nexttiled(selmon->clients); nbc; nbc = nexttiled(nbc->next), n++);
|
||||
+
|
||||
+ /* Do nothing if layout is floating */
|
||||
+ if (c->isfloating || selmon->lt[selmon->sellt]->arrange == NULL) {
|
||||
+ gapincr = gapoffset = 0;
|
||||
+ } else {
|
||||
+ /* Remove border and gap if layout is monocle or only one client */
|
||||
+ if (selmon->lt[selmon->sellt]->arrange == monocle || n == 1) {
|
||||
+ gapoffset = 0;
|
||||
+ gapincr = -2 * borderpx;
|
||||
+ wc.border_width = 0;
|
||||
+ } else {
|
||||
+ gapoffset = gappx;
|
||||
+ gapincr = 2 * gappx;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ c->oldx = c->x; c->x = wc.x = x + gapoffset;
|
||||
+ c->oldy = c->y; c->y = wc.y = y + gapoffset;
|
||||
+ c->oldw = c->w; c->w = wc.width = w - gapincr;
|
||||
+ c->oldh = c->h; c->h = wc.height = h - gapincr;
|
||||
+
|
||||
if (((nexttiled(c->mon->clients) == c && !nexttiled(c->next))
|
||||
|| &monocle == c->mon->lt[c->mon->sellt]->arrange)
|
||||
&& !c->isfullscreen && !c->isfloating) {
|
Loading…
Reference in New Issue
Block a user