Compare commits

...

8 Commits

Author SHA1 Message Date
Jef Roosens e1642ebe13
Added PKGBUILD & CI pipeline for publishing
ci/woodpecker/push/woodpecker Pipeline failed Details
2022-03-04 21:49:21 +01:00
Jef Roosens ce06f10147
Merge branch 'master' of https://git.suckless.org/dwm 2022-03-04 21:28:30 +01:00
Hiltjo Posthuma d39e2f3441 bump version to 6.3 2022-01-07 12:39:18 +01:00
Chris Down 8657affa2a drawbar: Don't expend effort drawing bar if it is occluded
I noticed that a non-trivial amount of dwm's work on my machine was from
drw_text, which seemed weird, because I have the bar disabled and we
only use drw_text as part of bar drawing.

Looking more closely, I realised that while we use m->showbar when
updating the monitor bar margins, but don't skip actually drawing the
bar if it is hidden. This patch skips drawing it entirely if that is the
case.

On my machine, this takes 10% of dwm's on-CPU time, primarily from
restack() and focus().

When the bar is toggled on again, the X server will generate an Expose
event, and we'll redraw the bar as normal as part of expose().
2021-12-19 16:16:30 +01:00
Hiltjo Posthuma a786211d6c Revert "Improve speed of drw_text when provided with large strings"
This reverts commit 716233534b.

It causes issues with truncation of characters when the text does not fit and
so on.  The patch should be reworked and properly tested.
2021-08-20 23:09:48 +02:00
Miles Alan 716233534b Improve speed of drw_text when provided with large strings
Calculates len & ew in drw_font_getexts loop by incrementing instead of
decrementing; as such avoids proportional increase in time spent in loop
based on provided strings size.
2021-08-09 18:25:19 +02:00
Quentin Rameau 138b405f0c Add a configuration option for fullscreen locking
Some people are annoyed to have this new behaviour forced for some
application which use fake fullscreen.
2021-07-14 11:26:37 +02:00
Chris Down 67d76bdc68 Do not allow focus to drift from fullscreen client via focusstack()
It generally doesn't make much sense to allow focusstack() to navigate
away from the selected fullscreen client, as you can't even see which
client you're selecting behind it.

I have had this up for a while on the wiki as a separate patch[0], but
it seems reasonable to avoid this behaviour in dwm mainline, since I'm
struggling to think of any reason to navigate away from a fullscreen
client other than a mistake.

0: https://dwm.suckless.org/patches/alwaysfullscreen/
2021-03-29 19:16:27 +02:00
12 changed files with 196 additions and 100 deletions

6
.gitignore vendored
View File

@ -2,3 +2,9 @@
*.o
*.orig
*.rej
dwm
# makepkg stuff
*.pkg*
pkg/
src/

27
.woodpecker.yml 100644
View File

@ -0,0 +1,27 @@
branches: master
when:
event: push
pipeline:
build:
image: 'archlinux:latest'
commands:
# Update packages
- pacman -Syu --needed --noconfirm base-devel
# Create non-root user to perform build & switch to their home
- groupadd -g 1000 builder
- useradd -mg builder builder
- chown -R builder:builder "$PWD"
- "echo 'builder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers"
- su builder
# Build the package
- MAKEFLAGS="-j$(nproc)" makepkg -s --noconfirm --needed
publish:
image: 'archlinux:latest'
commands:
# Publish the package
- 'curl -s -XPOST -H "X-API-KEY: $API_KEY" -T "$(ls *.pkg*)" https://arch.r8r.be/publish'
secrets:
- api_key

49
PKGBUILD 100644
View File

@ -0,0 +1,49 @@
# Maintainer: Jef Roosens
pkgname=jjr-dwm
pkgver=6.3
pkgrel=1
pkgdesc="Personal build of the Dynamic Window Manager."
arch=("x86_64")
url="https://git.rustybever.be/Chewing_Bever/dwm"
license=("MIT")
depends=("libx11" "libxinerama" "libxft" "freetype2" "jjr-st" "dmenu")
makedepends=("clang")
provides=("dwm")
conflicts=("dwm" "dwm-git")
source=("config.def.h" "config.h" "config.mk" "drw.c" "drw.h" "dwm.1" "dwm.c"
"LICENSE" "Makefile" "transient.c" "util.c" "util.h" "dwm.desktop" "README")
sha256sums=('f662413dd3882e83a8d1bd6165abdf1c78f358a9100e875b0c6633d41f65f224'
'0fc893d4cbb2955411d047773a75269ef318d04ec2477624f01158dea539703b'
'cda18f3700ed39dadbba983a36220320a88853d6858689b072fc0500b26b8fc8'
'85cc51a6a392a81d6073ff8d994200651cb8042b3bed93ce19e565ab752f8dae'
'137808b0e48f4acd8672678172edf16839ff0b4c13b7721deddb920a0d553fd7'
'216e0326791ac90a16549d39514d42cda0dfd5524df1ad511326a472cbd0f816'
'fcb808784839c38457a4e2834de2ddf730ccfbe9ef3ee85b55df01169998358f'
'b99adfc25cce6d62c1cc72a3105bb5d913a2faa40f172c14cfb204067f08c939'
'f5c9137d07849db36942045df9be4f71727207cd90e7cc45aeffcf3c2469b9dc'
'54c37c558613ab3da856b19c4b4c0c56c224133a253bf5fa6557b489da545d7c'
'dec870d0b5834c9008ff62f495710daf524cffdf12d0cf8ba4fadf5643623987'
'1196a7b6efbf4cb3f5c435fffd72e7647f977483845d5c78c1c48d9ab8b96819'
'bc36426772e1471d6dd8c8aed91f288e16949e3463a9933fee6390ee0ccd3f81'
'f0384e29e3f249fcd52a30c35c722fca50e9fabfdeb7725f4073e05170358d86')
build() {
make
}
package() {
local installopts='--mode 0644 -D --target-directory'
local shrdir="$pkgdir/usr/share"
local licdir="$shrdir/licenses/$pkgname"
local docdir="$shrdir/doc/$pkgname"
make PREFIX=/usr DESTDIR="$pkgdir" install
install $installopts "$licdir" "LICENSE"
install $installopts "$docdir" "README"
install $installopts "$pkgdir/usr/share/xsessions" "dwm.desktop"
}

View File

@ -42,6 +42,7 @@ static const Rule rules[] = {
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
static const int nmaster = 1; /* number of clients in master area */
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
static const Layout layouts[] = {
/* symbol arrange function */

197
config.h
View File

@ -1,128 +1,131 @@
/* See LICENSE file for copyright and license details. */
/* appearance */
static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
static const char *fonts[] = { "monospace:size=10" };
static const char dmenufont[] = "monospace:size=10";
static const char col_gray1[] = "#222222";
static const char col_gray2[] = "#444444";
static const char col_gray3[] = "#bbbbbb";
static const char col_gray4[] = "#eeeeee";
static const char col_cyan[] = "#005577";
static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
static const char *fonts[] = {"monospace:size=10"};
static const char dmenufont[] = "monospace:size=10";
static const char col_gray1[] = "#222222";
static const char col_gray2[] = "#444444";
static const char col_gray3[] = "#bbbbbb";
static const char col_gray4[] = "#eeeeee";
static const char col_cyan[] = "#005577";
static const unsigned int baralpha = 150; // Default is 0xd0
static const unsigned int borderalpha = OPAQUE; // Max is 255
static const unsigned int baralpha = 150; // Default is 0xd0
static const unsigned int borderalpha = OPAQUE; // Max is 255
static const char *colors[][3] = {
/* fg bg border */
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
static const char *colors[][3] = {
/* fg bg border */
[SchemeNorm] = {col_gray3, col_gray1, col_gray2},
[SchemeSel] = {col_gray4, col_cyan, col_cyan},
};
static const unsigned int alphas[][3] = {
/* fg bg border */
[SchemeNorm] = { OPAQUE, baralpha, borderalpha },
[SchemeSel] = { OPAQUE, baralpha, borderalpha },
static const unsigned int alphas[][3] = {
/* fg bg border */
[SchemeNorm] = {OPAQUE, baralpha, borderalpha},
[SchemeSel] = {OPAQUE, baralpha, borderalpha},
};
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
static const char *tags[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9"};
static const Rule rules[] = {
/* xprop(1):
* WM_CLASS(STRING) = instance, class
* WM_NAME(STRING) = title
*/
/* class instance title tags mask isfloating monitor */
{ "Gimp", NULL, NULL, 0, 1, -1 },
{ "Firefox", NULL, NULL, 1 << 8, 0, -1 },
/* xprop(1):
* WM_CLASS(STRING) = instance, class
* WM_NAME(STRING) = title
*/
/* class instance title tags mask isfloating monitor */
{"Gimp", NULL, NULL, 0, 1, -1},
{"Firefox", NULL, NULL, 1 << 8, 0, -1},
};
/* layout(s) */
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
static const int nmaster = 1; /* number of clients in master area */
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
static const int nmaster = 1; /* number of clients in master area */
static const int resizehints =
1; /* 1 means respect size hints in tiled resizals */
static const int lockfullscreen =
1; /* 1 will force focus on the fullscreen window */
static const Layout layouts[] = {
/* symbol arrange function */
{ "[]=", tile }, /* first entry is default */
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
/* symbol arrange function */
{"[]=", tile}, /* first entry is default */
{"><>", NULL}, /* no layout function means floating behavior */
{"[M]", monocle},
};
/* key definitions */
#define MODKEY Mod1Mask
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
#define TAGKEYS(KEY, TAG) \
{MODKEY, KEY, view, {.ui = 1 << TAG}}, \
{MODKEY | ControlMask, KEY, toggleview, {.ui = 1 << TAG}}, \
{MODKEY | ShiftMask, KEY, tag, {.ui = 1 << TAG}}, \
{MODKEY | ControlMask | ShiftMask, KEY, toggletag, {.ui = 1 << TAG}},
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
#define SHCMD(cmd) \
{ \
.v = (const char *[]) { "/bin/sh", "-c", cmd, NULL } \
}
/* commands */
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
static const char *termcmd[] = { "st", NULL };
static char dmenumon[2] =
"0"; /* component of dmenucmd, manipulated in spawn() */
static const char *dmenucmd[] = {
"dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1,
"-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL};
static const char *termcmd[] = {"st", NULL};
/* modifier key function argument */
/* modifier key function argument */
static Key keys[] = {
{ MODKEY , XK_d , spawn , {.v = dmenucmd } } ,
{ MODKEY , XK_Return , spawn , {.v = termcmd } } ,
{ MODKEY , XK_b , togglebar , {0} } ,
{ MODKEY , XK_j , focusstack , {.i = +1 } } ,
{ MODKEY , XK_k , focusstack , {.i = -1 } } ,
/* { MODKEY , XK_i , incnmaster , {.i = +1 } } , */
/* { MODKEY , XK_d , incnmaster , {.i = -1 } } , */
{ MODKEY , XK_h , setmfact , {.f = -0.05} } ,
{ MODKEY , XK_l , setmfact , {.f = +0.05} } ,
/* { MODKEY , XK_Return , zoom , {0} } , */
{ MODKEY , XK_Tab , view , {0} } ,
{ MODKEY , XK_x , killclient , {0} } ,
{ MODKEY , XK_t , setlayout , {.v = &layouts[0]} } ,
{ MODKEY , XK_f , setlayout , {.v = &layouts[1]} } ,
{ MODKEY , XK_m , setlayout , {.v = &layouts[2]} } ,
{ MODKEY , XK_space , setlayout , {0} } ,
{ MODKEY|ShiftMask , XK_space , togglefloating , {0} } ,
{ MODKEY , XK_0 , view , {.ui = ~0 } } ,
{ MODKEY|ShiftMask , XK_0 , tag , {.ui = ~0 } } ,
{ MODKEY , XK_comma , focusmon , {.i = -1 } } ,
{ MODKEY , XK_period , focusmon , {.i = +1 } } ,
{ MODKEY|ShiftMask , XK_comma , tagmon , {.i = -1 } } ,
{ MODKEY|ShiftMask , XK_period , tagmon , {.i = +1 } } ,
{ MODKEY , XK_F2 , spawn , {.v = { "dmenu_optimus" , NULL }}} ,
{ MODKEY , XK_F3 , spawn , {.v = { "dmenu_kb_layout" , NULL }}} ,
{ MODKEY , XK_F4 , spawn , {.v = { "dmenu_audio_sinks" , NULL }}} ,
{ MODKEY|ShiftMask , XK_q , quit , {0} } ,
TAGKEYS( XK_y , 0)
TAGKEYS( XK_u , 1)
TAGKEYS( XK_i , 2)
TAGKEYS( XK_o , 3)
TAGKEYS( XK_p , 4)
TAGKEYS( XK_6 , 5)
TAGKEYS( XK_7 , 6)
TAGKEYS( XK_8 , 7)
TAGKEYS( XK_9 , 8)
};
{MODKEY, XK_d, spawn, {.v = dmenucmd}},
{MODKEY, XK_Return, spawn, {.v = termcmd}},
{MODKEY, XK_b, togglebar, {0}},
{MODKEY, XK_j, focusstack, {.i = +1}},
{MODKEY, XK_k, focusstack, {.i = -1}},
/* { MODKEY , XK_i , incnmaster , {.i = +1 } } , */
/* { MODKEY , XK_d , incnmaster , {.i = -1 } } , */
{MODKEY, XK_h, setmfact, {.f = -0.05}},
{MODKEY, XK_l, setmfact, {.f = +0.05}},
/* { MODKEY , XK_Return , zoom , {0} } , */
{MODKEY, XK_Tab, view, {0}},
{MODKEY, XK_x, killclient, {0}},
{MODKEY, XK_t, setlayout, {.v = &layouts[0]}},
{MODKEY, XK_f, setlayout, {.v = &layouts[1]}},
{MODKEY, XK_m, setlayout, {.v = &layouts[2]}},
{MODKEY, XK_space, setlayout, {0}},
{MODKEY | ShiftMask, XK_space, togglefloating, {0}},
{MODKEY, XK_0, view, {.ui = ~0}},
{MODKEY | ShiftMask, XK_0, tag, {.ui = ~0}},
{MODKEY, XK_comma, focusmon, {.i = -1}},
{MODKEY, XK_period, focusmon, {.i = +1}},
{MODKEY | ShiftMask, XK_comma, tagmon, {.i = -1}},
{MODKEY | ShiftMask, XK_period, tagmon, {.i = +1}},
{MODKEY, XK_F2, spawn, {.v = {"dmenu_optimus", NULL}}},
{MODKEY, XK_F3, spawn, {.v = {"dmenu_kb_layout", NULL}}},
{MODKEY, XK_F4, spawn, {.v = {"dmenu_audio_sinks", NULL}}},
{MODKEY | ShiftMask, XK_q, quit, {0}},
TAGKEYS(XK_y, 0) TAGKEYS(XK_u, 1) TAGKEYS(XK_i, 2) TAGKEYS(XK_o, 3)
TAGKEYS(XK_p, 4) TAGKEYS(XK_6, 5) TAGKEYS(XK_7, 6) TAGKEYS(XK_8, 7)
TAGKEYS(XK_9, 8)};
/* button definitions */
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
* ClkClientWin, or ClkRootWin */
static Button buttons[] = {
/* click event mask button function argument */
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
{ ClkWinTitle, 0, Button2, zoom, {0} },
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
{ ClkTagBar, 0, Button1, view, {0} },
{ ClkTagBar, 0, Button3, toggleview, {0} },
{ ClkTagBar, MODKEY, Button1, tag, {0} },
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
/* click event mask button function argument
*/
{ClkLtSymbol, 0, Button1, setlayout, {0}},
{ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]}},
{ClkWinTitle, 0, Button2, zoom, {0}},
{ClkStatusText, 0, Button2, spawn, {.v = termcmd}},
{ClkClientWin, MODKEY, Button1, movemouse, {0}},
{ClkClientWin, MODKEY, Button2, togglefloating, {0}},
{ClkClientWin, MODKEY, Button3, resizemouse, {0}},
{ClkTagBar, 0, Button1, view, {0}},
{ClkTagBar, 0, Button3, toggleview, {0}},
{ClkTagBar, MODKEY, Button1, tag, {0}},
{ClkTagBar, MODKEY, Button3, toggletag, {0}},
};

View File

@ -1,5 +1,5 @@
# dwm version
VERSION = 6.2
VERSION = 6.3
# Customize below to fit your system
@ -35,4 +35,4 @@ LDFLAGS = ${LIBS}
#LDFLAGS = ${LIBS}
# compiler and linker
CC = cc
CC = clang

BIN
drw.o

Binary file not shown.

BIN
dwm

Binary file not shown.

5
dwm.c
View File

@ -729,6 +729,9 @@ drawbar(Monitor *m)
unsigned int i, occ = 0, urg = 0;
Client *c;
if (!m->showbar)
return;
/* draw status first so it can be overdrawn by tags later */
if (m == selmon) { /* status is only drawn on selected monitor */
drw_setscheme(drw, scheme[SchemeNorm]);
@ -862,7 +865,7 @@ focusstack(const Arg *arg)
{
Client *c = NULL, *i;
if (!selmon->sel)
if (!selmon->sel || (selmon->sel->isfullscreen && lockfullscreen))
return;
if (arg->i > 0) {
for (c = selmon->sel->next; c && !ISVISIBLE(c); c = c->next);

7
dwm.desktop 100644
View File

@ -0,0 +1,7 @@
[Desktop Entry]
Encoding=UTF-8
Name=Dwm
Comment=Dynamic window manager
Exec=dwm
Icon=dwm
Type=XSession

BIN
dwm.o

Binary file not shown.

BIN
util.o

Binary file not shown.