Compare commits
327 Commits
Author | SHA1 | Date | |
---|---|---|---|
5ed9c48196 | |||
3c91283ede | |||
e941181f46 | |||
43e82adf0d | |||
42cf1c7d8f | |||
dce4fb3737 | |||
646b351cc7 | |||
e3b7e1d620 | |||
04db03a4e6 | |||
4a4817b3aa | |||
7e1182ce55 | |||
40529e1469 | |||
14343e69cc | |||
35db6d8afc | |||
3d1090ba89 | |||
18248ebf4b | |||
b468873b2b | |||
cdec9782a1 | |||
6af273771c | |||
4fb31e0896 | |||
b800a1d136 | |||
33a74489f0 | |||
5364697914 | |||
7edc596311 | |||
68b400e95d | |||
656882d76f | |||
1479e76f01 | |||
f2544a3318 | |||
aafeaf7317 | |||
f21d46ea7d | |||
c0ba635c50 | |||
0a673ad7a3 | |||
3aabc08ede | |||
d456617f0e | |||
61fe833a06 | |||
917e281634 | |||
31451c3ad3 | |||
344f35f9f5 | |||
87adcd263b | |||
fd3c19bd55 | |||
1bdb393f81 | |||
940feed314 | |||
606b44179d | |||
20f6917910 | |||
820cbb3545 | |||
90f3238301 | |||
3bfc43c3d0 | |||
c1128417a9 | |||
1b62f8fa58 | |||
54c3044dec | |||
51336aa4a3 | |||
c4b6ac812e | |||
873bcb97a9 | |||
907db0a851 | |||
4e7c469862 | |||
26445a0dc9 | |||
b5068e32e9 | |||
f099d2d5b5 | |||
80a9da555e | |||
d21026f0a1 | |||
e5a1e77351 | |||
8262d9e663 | |||
90af1ced3c | |||
5ccd42f807 | |||
1586b7a02d | |||
2420071f4c | |||
04c26574b8 | |||
b1a28ae1da | |||
f68a01cd76 | |||
2b625eb73e | |||
0f1f30daca | |||
dec4850d05 | |||
0de4197cc5 | |||
a372248b80 | |||
69e7d7dfd3 | |||
c99fe7dd7d | |||
d6670a800d | |||
6288c44697 | |||
d5c5c52b30 | |||
d0b4575bf4 | |||
03518ce49e | |||
cd8bb06af5 | |||
3150a8a1be | |||
b3c5f5435a | |||
a692bdcf2b | |||
d83454f6b7 | |||
27b0142203 | |||
867ba36030 | |||
e83f36db10 | |||
212f417e44 | |||
3a392b8558 | |||
92fe06b501 | |||
6cf29bff33 | |||
60c06a7cb4 | |||
1147546122 | |||
d384cee751 | |||
5c710cf89c | |||
8a111c181e | |||
2255bf46a0 | |||
04797343db | |||
e7d41cc188 | |||
22d8818850 | |||
6784429c3c | |||
37fea84de8 | |||
c14d293e51 | |||
79b1657a19 | |||
d24837f1ad | |||
3c2d303c0e | |||
1e20a0f78a | |||
96f9855248 | |||
3c48858ffa | |||
dd46d5b588 | |||
0bc4e41ebd | |||
703c4dd253 | |||
b68528d85d | |||
a644baf674 | |||
c1f8688bfa | |||
bea4dd2490 | |||
83d10be1c1 | |||
1529058f27 | |||
36311d88af | |||
f1a2a3c850 | |||
ee734fae6b | |||
62d3caa999 | |||
4c9b397ff9 | |||
5c6545adf5 | |||
a704b1ee34 | |||
f83d61dfe8 | |||
c6180949a7 | |||
1973ab0643 | |||
427053f8d1 | |||
a88e0373ef | |||
aa9f2be24e | |||
c53b29e60b | |||
d6bdd03d91 | |||
1144e98394 | |||
7671d03a90 | |||
bc554d45d8 | |||
ac4caea921 | |||
161f2d921b | |||
210378f198 | |||
7879616a75 | |||
9e8dd3479d | |||
0b72be924d | |||
91e902f7fe | |||
30fed9a211 | |||
c45d46ad9a | |||
6f55de8310 | |||
07ad298133 | |||
f0a4845e7d | |||
82ec7a7ed4 | |||
e7300e0f6f | |||
c3feffa1e2 | |||
956a430054 | |||
01056b6636 | |||
eb260b1a41 | |||
7fe81359d4 | |||
a3a859b4e9 | |||
9c066c24b3 | |||
0a668922a4 | |||
5762964232 | |||
cba6b211c2 | |||
42750a621b | |||
8ef465d592 | |||
33fe200b52 | |||
91fffb3f7d | |||
1fa31efebf | |||
244addb3f4 | |||
c13be8d620 | |||
dc39ae8568 | |||
966d76a428 | |||
7151bf8329 | |||
dfecd46190 | |||
5bc4db0f76 | |||
999d6e795f | |||
636075297c | |||
6877a00033 | |||
0927d635bc | |||
450b08dde2 | |||
da80487c07 | |||
d9779c06fc | |||
20996c6c5a | |||
8dc9fcf1b9 | |||
fc21dd4b7e | |||
758b100d12 | |||
8420fb1ced | |||
f6128a16f9 | |||
87526be6f0 | |||
565050ac51 | |||
5e408d8ff6 | |||
1724f7fa43 | |||
3e6fe6b541 | |||
6620615ab9 | |||
61c3095f2f | |||
a72dc2fec2 | |||
8b17f5517b | |||
cd96232f7e | |||
a9e145fe6d | |||
5dd92c7655 | |||
52bd69c2a4 | |||
ca376970db | |||
8352f2b3a8 | |||
d4bfde79f3 | |||
7ac8c1d4e1 | |||
16e1ef5d40 | |||
1d729384d1 | |||
25c1eb28f9 | |||
d719cc9a0e | |||
9cde6570cc | |||
e408ca97d8 | |||
183dc670a3 | |||
25947bcfdb | |||
1ddfc571ae | |||
21cd59a630 | |||
6cbe47d481 | |||
029655bb22 | |||
27db9d4448 | |||
176408afa8 | |||
64674c395b | |||
b9dee2c6f1 | |||
a73ff905b0 | |||
e3f0445df1 | |||
ab06f7444b | |||
a2a3590979 | |||
e8aafb8e91 | |||
18b1312449 | |||
80ee95473b | |||
454a04acdf | |||
891831fe62 | |||
cdb8e27453 | |||
5c4913e983 | |||
fa5ae54bbb | |||
7de534192c | |||
54dc0d542c | |||
913333f518 | |||
d702f39274 | |||
0d8671a5ad | |||
38e9b67026 | |||
a3bbdb1b7b | |||
d53ceee682 | |||
78f56672b5 | |||
c2fff604a7 | |||
6644a6aa2e | |||
3da2453997 | |||
2ce37bc69e | |||
f27ccc5c60 | |||
2dbfda72f0 | |||
7df39f3fc7 | |||
0b45199cec | |||
3632d7132f | |||
565697087b | |||
ea0008cba2 | |||
af508c2e82 | |||
f0d1d5206f | |||
1c80c05587 | |||
1e350be229 | |||
1a26389e2b | |||
bf9da23f07 | |||
2373940215 | |||
90687482ad | |||
5ab627c06c | |||
76d7e80fc4 | |||
af8049bce8 | |||
2bb51b3246 | |||
b16d8282be | |||
fef4614772 | |||
be39dddcc5 | |||
6d209b9b29 | |||
57a0788bd8 | |||
3ad906eede | |||
0be9fb8797 | |||
62a491e36d | |||
0b5dcf229f | |||
fda92f46aa | |||
a62ea4062f | |||
7dc28d130f | |||
fbce733532 | |||
e7572804fa | |||
ed1bef1241 | |||
2b047e460b | |||
5f74dc5e78 | |||
ea8a4ca46a | |||
4883a06221 | |||
4dea5324c0 | |||
53cac17692 | |||
83abfc05eb | |||
862b0d541d | |||
c1c6fdc5d8 | |||
9a4d07d9de | |||
30410108eb | |||
753e0e048e | |||
d15d4ba45a | |||
815f9c054d | |||
addc52c948 | |||
26f41c9055 | |||
73ec124ae9 | |||
ec11a3470c | |||
4b3b597da3 | |||
288cf78b18 | |||
6411aa921b | |||
db5db8806f | |||
258c338030 | |||
85da537856 | |||
2b4157eccd | |||
0f26de991f | |||
840f937a98 | |||
6975a7e31a | |||
47f63dce55 | |||
02a8ca95cf | |||
2ce50a9cad | |||
bfa5869da1 | |||
087a55f8d3 | |||
6d7285fd6e | |||
69c7b4b0ba | |||
97699e5b1b | |||
2dc7f42fd7 | |||
9f3a5cb754 | |||
b48fa3f101 | |||
051a404b66 | |||
d8d733c34f | |||
bb01e5a16f | |||
06f7eed103 | |||
0ffa6d1393 | |||
15ce143620 | |||
63d7190231 | |||
b279cef670 | |||
6254ef9dc7 |
56
.hgtags
56
.hgtags
@ -1,56 +0,0 @@
|
|||||||
d31b5ad96b0ba7b5b0a30928fcf000428339a577 0.1
|
|
||||||
0a6472e2203994bc5738d40a340d26f7ec9d6062 0.2
|
|
||||||
7e66082e5092fb0bccd18a3695a0bec52c80fdb2 0.3
|
|
||||||
eb3165734f00fe7f7da8aeebaed00e60a57caac9 0.4
|
|
||||||
22213b9a2114167ee8ba019a012e27da0422a61a 0.5
|
|
||||||
c11f86db4550cac5d0a648a3fe4d6d3b9a4fcf7e 0.6
|
|
||||||
3fb41412e2492f66476d92ce8f007a8b48fb1d2a 0.7
|
|
||||||
cd15de32e173f8ce97bfe1c9b6607937b59056b4 0.8
|
|
||||||
fae61afa861755636c4a1070694209ace8efbb6c 0.9
|
|
||||||
bbc98e77ae89a7c9232a5be0835f60ea00d8036e 1.0
|
|
||||||
44a55e6e46bf6c231780b09d919977d6f01083de 1.1
|
|
||||||
e3179ce2b90451d2807cd53b589d768412b8666b 1.2
|
|
||||||
f5f5cbf016a94b48a8fe9c47f0736e96d166d5d4 1.3
|
|
||||||
3cff9403766bf83a9fc2a0aef230115d68de2a8e 1.4
|
|
||||||
728c9089b079721b43c3347124639a29baa22a97 1.5
|
|
||||||
ad3fa2d185426c51fd5deceae809770363f8d33c 1.6
|
|
||||||
4dbdb61c8b8ce21dee5c7050a6b103855964ed20 1.7
|
|
||||||
d5ad819f2a66a40fa75dd2e44429f3bfc884d07b 1.7.1
|
|
||||||
c71952fa3c7ca848ec38a6923b5c6d0e18fff431 1.8
|
|
||||||
a5567a0d30112822db2627a04a2e7aa3b6c38148 1.9
|
|
||||||
12deea36603da407e3f32640048846a3bd74a9ec 2.0
|
|
||||||
a2c465098a3b972bbed00feda9804b6aae1e9531 2.1
|
|
||||||
7e92f58754ae6edb3225f26d754bd89c1ff458cf 2.2
|
|
||||||
719b37b37b0df829d7cf017ac70e353088fe5849 2.3
|
|
||||||
32b246925086910d63147483160281a91a47479f 2.4
|
|
||||||
dcbbfabc8ecc5f33a6cc950584de87da1a368045 2.5
|
|
||||||
c7f84f23ec5aef29988dcdc4ec22a7352ee8f58e 2.5.1
|
|
||||||
5308dd22b6ee8e3218c81d9e7e4125f235bb5778 2.6
|
|
||||||
21951c0dfbae5af68ed77821a4d87253ee91803f 2.7
|
|
||||||
107719a9ce3bd0c79f9f1f626596eb338a276561 2.8
|
|
||||||
3a5910fac3ccb522a98aeeba7af7008530b25092 2.9
|
|
||||||
76b58d21ea98257c05565a3b9c850b9b26a32968 3.0
|
|
||||||
e1c8bef05e6e48df4f26471ea0712aa43ab9d949 3.1
|
|
||||||
4ce65f61f01b055fa6c2901c6d2527ef741aa4bf 3.2
|
|
||||||
f2cabc83a18f9b5b548159329ddd4dee904fa31f 3.2.1
|
|
||||||
d3876aa792923f9a95f7ad0c7f0134533404df35 3.2.2
|
|
||||||
0f91934037b04221ff5d1ba3a6c39c1ff26e3661 3.3
|
|
||||||
9ede7b2d2450537e750d5505789fbe63960e97e6 3.4
|
|
||||||
63ad05e7f9e1f4f1881fb02f529cb6c6ae81e693 3.5
|
|
||||||
75b1b25fe0d7e29400baf30568153f668324928b 3.6
|
|
||||||
20ec6976cee1fcfee0c2f354ae382ee3f9f68efa 3.6.1
|
|
||||||
baee494346e520f8dee2cee9491b8350064770d2 3.7
|
|
||||||
2ea201354cf016407ea93e1e390d1422940d29b0 3.8
|
|
||||||
55478328b2422c700c5404a774c85e77322f41a3 3.9
|
|
||||||
018c3846842291cb6c009dc087e7fe2f0ef53bea 4.0
|
|
||||||
00f4180df72b49aadb2933804fde4bfb33e5666d 4.1
|
|
||||||
c13cb8c6b7a56af74cc88346e71d2490470b546f 4.2
|
|
||||||
e0ec0d5d8b1ef3ee04a83c7c0fee5853aa2ac6a6 4.3
|
|
||||||
408014d2126153d2b0fce26a13ba707db222b7b9 4.4
|
|
||||||
7c117df5d202530e85066d8b1ab02cef605c79ad 4.4.1
|
|
||||||
2acc60d6dfe28c101a8cd44a8aa710a38ae3607c 4.5
|
|
||||||
bcd7e18e196a00cc2e97ff3a4a58f3cdaba13856 4.6
|
|
||||||
d6d3085307d8d98b8b012b669e858fd787befeb1 4.7
|
|
||||||
607015ddb091d49cbd3457af41713691aa69f4d6 4.8
|
|
||||||
22c669b2dd3673785c3476b9976da21e8783f745 4.9
|
|
||||||
06eb9644e2dad7667d97495eb7d7bc62aa0429e8 5.0
|
|
44
BUGS
Normal file
44
BUGS
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
18:17 < Biolunar> when i change my resolution in dwm (to a smaller one) and then back to the native, the top bar is not repainted. that's since 5.7.2, in 5.6 it worked fine
|
||||||
|
18:19 < Biolunar> is it just happening to me or a (known) bug?
|
||||||
|
18:24 < Biolunar> and in addition, mplayers fullscreen is limited to the small resolution after i changed it back to the native
|
||||||
|
|
||||||
|
reproducible with xrandr -s but not with --output and --mode, strange
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
yet another corner case:
|
||||||
|
open a terminal, focus another monitor, but without moving the mouse
|
||||||
|
pointer there
|
||||||
|
if there is no client on the other monitor to get the focus, then the
|
||||||
|
terminal will be unfocused but it will accept input
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Donald Allen reported this:
|
||||||
|
|
||||||
|
starting emacs from dmenu in archlinux results in missing configure of emacs, but mod1-space or mod1-shift-space fix this problem. this problem is new and did not happen in 1.6 xorg servers
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
voltaic reports this:
|
||||||
|
|
||||||
|
When I use two monitors, one larger in resolution than the other, the
|
||||||
|
bar is drawn using the smaller x-dimension on both screens. I think
|
||||||
|
what's happening is that there are two bars drawn, but the short bar
|
||||||
|
is always on top of the long bar such that I can't see the information
|
||||||
|
under the short bar. If I switch to the small screen, hide the short
|
||||||
|
bar, and then switch to the large screen, the long bar is drawn
|
||||||
|
correctly.
|
||||||
|
|
||||||
|
A similar problem occurs when I have started dwm on a small resolution
|
||||||
|
monitor (laptop screen) and then I switch to a large external display.
|
||||||
|
When I do this, the bar itself is drawn for the original smaller
|
||||||
|
resolution, but the information to be printed on the bar is
|
||||||
|
right-aligned for a longer bar. So what I see is a bar that has the
|
||||||
|
right hand side of it cut-off. See attached screenshot.
|
||||||
|
|
||||||
|
I am using standard options for xrandr such as --output VGA1 --auto, etc.
|
||||||
|
|
||||||
|
---
|
18
LICENSE
18
LICENSE
@ -1,12 +1,18 @@
|
|||||||
MIT/X Consortium License
|
MIT/X Consortium License
|
||||||
|
|
||||||
© 2006-2008 Anselm R Garbe <garbeam at gmail dot com>
|
© 2006-2014 Anselm R Garbe <anselm@garbe.us>
|
||||||
© 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
|
© 2010-2014 Hiltjo Posthuma <hiltjo@codemadness.org>
|
||||||
© 2006-2007 Jukka Salmi <jukka at salmi dot ch>
|
© 2007-2011 Peter Hartlich <sgkkr at hartlich dot com>
|
||||||
© 2007 Premysl Hruby <dfenze at gmail dot com>
|
© 2010-2011 Connor Lane Smith <cls@lubutu.com>
|
||||||
© 2007 Szabolcs Nagy <nszabolcs at gmail dot com>
|
© 2006-2009 Jukka Salmi <jukka at salmi dot ch>
|
||||||
© 2007 Christof Musik <christof at sendfax dot de>
|
© 2007-2009 Premysl Hruby <dfenze at gmail dot com>
|
||||||
|
© 2007-2009 Szabolcs Nagy <nszabolcs at gmail dot com>
|
||||||
|
© 2007-2009 Christof Musik <christof at sendfax dot de>
|
||||||
|
© 2009 Mate Nagy <mnagy at port70 dot net>
|
||||||
© 2007-2008 Enno Gottox Boland <gottox at s01 dot de>
|
© 2007-2008 Enno Gottox Boland <gottox at s01 dot de>
|
||||||
|
© 2008 Martin Hurton <martin dot hurton at gmail dot com>
|
||||||
|
© 2008 Neale Pickett <neale dot woozle dot org>
|
||||||
|
© 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
6
Makefile
6
Makefile
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
include config.mk
|
include config.mk
|
||||||
|
|
||||||
SRC = dwm.c
|
SRC = drw.c dwm.c util.c
|
||||||
OBJ = ${SRC:.c=.o}
|
OBJ = ${SRC:.c=.o}
|
||||||
|
|
||||||
all: options dwm
|
all: options dwm
|
||||||
@ -35,8 +35,8 @@ clean:
|
|||||||
dist: clean
|
dist: clean
|
||||||
@echo creating dist tarball
|
@echo creating dist tarball
|
||||||
@mkdir -p dwm-${VERSION}
|
@mkdir -p dwm-${VERSION}
|
||||||
@cp -R LICENSE Makefile README config.def.h config.mk \
|
@cp -R LICENSE TODO BUGS Makefile README config.def.h config.mk \
|
||||||
dwm.1 ${SRC} dwm-${VERSION}
|
dwm.1 drw.h util.h ${SRC} dwm.png transient.c dwm-${VERSION}
|
||||||
@tar -cf dwm-${VERSION}.tar dwm-${VERSION}
|
@tar -cf dwm-${VERSION}.tar dwm-${VERSION}
|
||||||
@gzip dwm-${VERSION}.tar
|
@gzip dwm-${VERSION}.tar
|
||||||
@rm -rf dwm-${VERSION}
|
@rm -rf dwm-${VERSION}
|
||||||
|
8
README
8
README
@ -38,11 +38,11 @@ the DISPLAY environment variable is set correctly, e.g.:
|
|||||||
In order to display status info in the bar, you can do something
|
In order to display status info in the bar, you can do something
|
||||||
like this in your .xinitrc:
|
like this in your .xinitrc:
|
||||||
|
|
||||||
while true
|
while xsetroot -name "`date` `uptime | sed 's/.*,//'`"
|
||||||
do
|
do
|
||||||
echo `date` `uptime | sed 's/.*,//'`
|
sleep 1
|
||||||
sleep 1
|
done &
|
||||||
done | dwm
|
exec dwm
|
||||||
|
|
||||||
|
|
||||||
Configuration
|
Configuration
|
||||||
|
4
TODO
Normal file
4
TODO
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
- add a flag to Key to execute the command on release (needed for commands
|
||||||
|
affecting the keyboard grab, see scrot -s for example)
|
||||||
|
- add updategeom() hook for external tools like dzen
|
||||||
|
- consider onscreenkeyboard hooks for tablet deployment
|
60
config.def.h
60
config.def.h
@ -1,32 +1,40 @@
|
|||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
/* appearance */
|
/* appearance */
|
||||||
static const char font[] = "-*-terminus-medium-r-normal-*-14-*-*-*-*-*-*-*";
|
static const char *fonts[] = {
|
||||||
static const char normbordercolor[] = "#cccccc";
|
"monospace:size=10"
|
||||||
static const char normbgcolor[] = "#cccccc";
|
};
|
||||||
static const char normfgcolor[] = "#000000";
|
static const char dmenufont[] = "monospace:size=10";
|
||||||
static const char selbordercolor[] = "#0066ff";
|
static const char normbordercolor[] = "#444444";
|
||||||
static const char selbgcolor[] = "#0066ff";
|
static const char normbgcolor[] = "#222222";
|
||||||
static const char selfgcolor[] = "#ffffff";
|
static const char normfgcolor[] = "#bbbbbb";
|
||||||
static unsigned int borderpx = 1; /* border pixel of windows */
|
static const char selbordercolor[] = "#005577";
|
||||||
static unsigned int snap = 32; /* snap pixel */
|
static const char selbgcolor[] = "#005577";
|
||||||
static Bool showbar = True; /* False means no bar */
|
static const char selfgcolor[] = "#eeeeee";
|
||||||
static Bool topbar = True; /* False means bottom bar */
|
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 */
|
||||||
|
|
||||||
/* tagging */
|
/* tagging */
|
||||||
static const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||||
|
|
||||||
static Rule rules[] = {
|
static const Rule rules[] = {
|
||||||
/* class instance title tags mask isfloating */
|
/* xprop(1):
|
||||||
{ "Gimp", NULL, NULL, 0, True },
|
* WM_CLASS(STRING) = instance, class
|
||||||
{ "Firefox", NULL, NULL, 1 << 8, True },
|
* 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) */
|
/* layout(s) */
|
||||||
static float mfact = 0.55;
|
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
||||||
static Bool resizehints = True; /* False means respect size hints in tiled resizals */
|
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 Layout layouts[] = {
|
static const Layout layouts[] = {
|
||||||
/* symbol arrange function */
|
/* symbol arrange function */
|
||||||
{ "[]=", tile }, /* first entry is default */
|
{ "[]=", tile }, /* first entry is default */
|
||||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||||
@ -45,8 +53,9 @@ static Layout layouts[] = {
|
|||||||
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
||||||
|
|
||||||
/* commands */
|
/* commands */
|
||||||
static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
|
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
|
||||||
static const char *termcmd[] = { "uxterm", NULL };
|
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
|
||||||
|
static const char *termcmd[] = { "st", NULL };
|
||||||
|
|
||||||
static Key keys[] = {
|
static Key keys[] = {
|
||||||
/* modifier key function argument */
|
/* modifier key function argument */
|
||||||
@ -55,6 +64,8 @@ static Key keys[] = {
|
|||||||
{ MODKEY, XK_b, togglebar, {0} },
|
{ MODKEY, XK_b, togglebar, {0} },
|
||||||
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||||
{ MODKEY, XK_k, 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_h, setmfact, {.f = -0.05} },
|
||||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||||
{ MODKEY, XK_Return, zoom, {0} },
|
{ MODKEY, XK_Return, zoom, {0} },
|
||||||
@ -67,6 +78,10 @@ static Key keys[] = {
|
|||||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||||
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
||||||
|
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||||
|
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||||
TAGKEYS( XK_1, 0)
|
TAGKEYS( XK_1, 0)
|
||||||
TAGKEYS( XK_2, 1)
|
TAGKEYS( XK_2, 1)
|
||||||
TAGKEYS( XK_3, 2)
|
TAGKEYS( XK_3, 2)
|
||||||
@ -80,8 +95,7 @@ static Key keys[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* button definitions */
|
/* button definitions */
|
||||||
/* click can be a tag number (starting at 0),
|
/* click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
|
||||||
* ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
|
|
||||||
static Button buttons[] = {
|
static Button buttons[] = {
|
||||||
/* click event mask button function argument */
|
/* click event mask button function argument */
|
||||||
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||||
|
21
config.mk
21
config.mk
@ -1,5 +1,5 @@
|
|||||||
# dwm version
|
# dwm version
|
||||||
VERSION = 5.1
|
VERSION = 6.1
|
||||||
|
|
||||||
# Customize below to fit your system
|
# Customize below to fit your system
|
||||||
|
|
||||||
@ -11,17 +11,24 @@ X11INC = /usr/X11R6/include
|
|||||||
X11LIB = /usr/X11R6/lib
|
X11LIB = /usr/X11R6/lib
|
||||||
|
|
||||||
# Xinerama, comment if you don't want it
|
# Xinerama, comment if you don't want it
|
||||||
XINERAMALIBS = -L${X11LIB} -lXinerama
|
XINERAMALIBS = -lXinerama
|
||||||
XINERAMAFLAGS = -DXINERAMA
|
XINERAMAFLAGS = -DXINERAMA
|
||||||
|
|
||||||
|
# freetype
|
||||||
|
FREETYPELIBS = -lfontconfig -lXft
|
||||||
|
FREETYPEINC = /usr/include/freetype2
|
||||||
|
# OpenBSD (uncomment)
|
||||||
|
#FREETYPEINC = ${X11INC}/freetype2
|
||||||
|
|
||||||
# includes and libs
|
# includes and libs
|
||||||
INCS = -I. -I/usr/include -I${X11INC}
|
INCS = -I${X11INC} -I${FREETYPEINC}
|
||||||
LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 ${XINERAMALIBS}
|
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}
|
||||||
|
|
||||||
# flags
|
# flags
|
||||||
CPPFLAGS = -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
|
CPPFLAGS = -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
|
||||||
CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
|
#CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS}
|
||||||
LDFLAGS = -s ${LIBS}
|
CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS}
|
||||||
|
LDFLAGS = -s ${LIBS}
|
||||||
|
|
||||||
# Solaris
|
# Solaris
|
||||||
#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\"
|
#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\"
|
||||||
|
398
drw.c
Normal file
398
drw.c
Normal file
@ -0,0 +1,398 @@
|
|||||||
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/Xft/Xft.h>
|
||||||
|
|
||||||
|
#include "drw.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
|
#define UTF_INVALID 0xFFFD
|
||||||
|
#define UTF_SIZ 4
|
||||||
|
|
||||||
|
static const unsigned char utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0};
|
||||||
|
static const unsigned char utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8};
|
||||||
|
static const long utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000};
|
||||||
|
static const long utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF};
|
||||||
|
|
||||||
|
static long
|
||||||
|
utf8decodebyte(const char c, size_t *i)
|
||||||
|
{
|
||||||
|
for (*i = 0; *i < (UTF_SIZ + 1); ++(*i))
|
||||||
|
if (((unsigned char)c & utfmask[*i]) == utfbyte[*i])
|
||||||
|
return (unsigned char)c & ~utfmask[*i];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static size_t
|
||||||
|
utf8validate(long *u, size_t i)
|
||||||
|
{
|
||||||
|
if (!BETWEEN(*u, utfmin[i], utfmax[i]) || BETWEEN(*u, 0xD800, 0xDFFF))
|
||||||
|
*u = UTF_INVALID;
|
||||||
|
for (i = 1; *u > utfmax[i]; ++i)
|
||||||
|
;
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
static size_t
|
||||||
|
utf8decode(const char *c, long *u, size_t clen)
|
||||||
|
{
|
||||||
|
size_t i, j, len, type;
|
||||||
|
long udecoded;
|
||||||
|
|
||||||
|
*u = UTF_INVALID;
|
||||||
|
if (!clen)
|
||||||
|
return 0;
|
||||||
|
udecoded = utf8decodebyte(c[0], &len);
|
||||||
|
if (!BETWEEN(len, 1, UTF_SIZ))
|
||||||
|
return 1;
|
||||||
|
for (i = 1, j = 1; i < clen && j < len; ++i, ++j) {
|
||||||
|
udecoded = (udecoded << 6) | utf8decodebyte(c[i], &type);
|
||||||
|
if (type)
|
||||||
|
return j;
|
||||||
|
}
|
||||||
|
if (j < len)
|
||||||
|
return 0;
|
||||||
|
*u = udecoded;
|
||||||
|
utf8validate(u, len);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
Drw *
|
||||||
|
drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h)
|
||||||
|
{
|
||||||
|
Drw *drw;
|
||||||
|
|
||||||
|
drw = ecalloc(1, sizeof(Drw));
|
||||||
|
drw->dpy = dpy;
|
||||||
|
drw->screen = screen;
|
||||||
|
drw->root = root;
|
||||||
|
drw->w = w;
|
||||||
|
drw->h = h;
|
||||||
|
drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen));
|
||||||
|
drw->gc = XCreateGC(dpy, root, 0, NULL);
|
||||||
|
drw->fontcount = 0;
|
||||||
|
XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
|
||||||
|
|
||||||
|
return drw;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
drw_resize(Drw *drw, unsigned int w, unsigned int h)
|
||||||
|
{
|
||||||
|
drw->w = w;
|
||||||
|
drw->h = h;
|
||||||
|
if (drw->drawable)
|
||||||
|
XFreePixmap(drw->dpy, drw->drawable);
|
||||||
|
drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
drw_free(Drw *drw)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for (i = 0; i < drw->fontcount; i++)
|
||||||
|
drw_font_free(drw->fonts[i]);
|
||||||
|
XFreePixmap(drw->dpy, drw->drawable);
|
||||||
|
XFreeGC(drw->dpy, drw->gc);
|
||||||
|
free(drw);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This function is an implementation detail. Library users should use
|
||||||
|
* drw_font_create instead.
|
||||||
|
*/
|
||||||
|
static Fnt *
|
||||||
|
drw_font_xcreate(Drw *drw, const char *fontname, FcPattern *fontpattern)
|
||||||
|
{
|
||||||
|
Fnt *font;
|
||||||
|
XftFont *xfont = NULL;
|
||||||
|
FcPattern *pattern = NULL;
|
||||||
|
|
||||||
|
if (fontname) {
|
||||||
|
/* Using the pattern found at font->xfont->pattern does not yield same
|
||||||
|
* the same substitution results as using the pattern returned by
|
||||||
|
* FcNameParse; using the latter results in the desired fallback
|
||||||
|
* behaviour whereas the former just results in
|
||||||
|
* missing-character-rectangles being drawn, at least with some fonts.
|
||||||
|
*/
|
||||||
|
if (!(xfont = XftFontOpenName(drw->dpy, drw->screen, fontname))) {
|
||||||
|
fprintf(stderr, "error, cannot load font: '%s'\n", fontname);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (!(pattern = FcNameParse((FcChar8 *) fontname))) {
|
||||||
|
fprintf(stderr, "error, cannot load font: '%s'\n", fontname);
|
||||||
|
XftFontClose(drw->dpy, xfont);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
} else if (fontpattern) {
|
||||||
|
if (!(xfont = XftFontOpenPattern(drw->dpy, fontpattern))) {
|
||||||
|
fprintf(stderr, "error, cannot load font pattern.\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
die("no font specified.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
font = ecalloc(1, sizeof(Fnt));
|
||||||
|
font->xfont = xfont;
|
||||||
|
font->pattern = pattern;
|
||||||
|
font->ascent = xfont->ascent;
|
||||||
|
font->descent = xfont->descent;
|
||||||
|
font->h = font->ascent + font->descent;
|
||||||
|
font->dpy = drw->dpy;
|
||||||
|
|
||||||
|
return font;
|
||||||
|
}
|
||||||
|
|
||||||
|
Fnt*
|
||||||
|
drw_font_create(Drw *drw, const char *fontname)
|
||||||
|
{
|
||||||
|
return drw_font_xcreate(drw, fontname, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
drw_load_fonts(Drw* drw, const char *fonts[], size_t fontcount)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
Fnt *font;
|
||||||
|
|
||||||
|
for (i = 0; i < fontcount; i++) {
|
||||||
|
if (drw->fontcount >= DRW_FONT_CACHE_SIZE) {
|
||||||
|
die("font cache exhausted.\n");
|
||||||
|
} else if ((font = drw_font_xcreate(drw, fonts[i], NULL))) {
|
||||||
|
drw->fonts[drw->fontcount++] = font;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
drw_font_free(Fnt *font)
|
||||||
|
{
|
||||||
|
if (!font)
|
||||||
|
return;
|
||||||
|
if (font->pattern)
|
||||||
|
FcPatternDestroy(font->pattern);
|
||||||
|
XftFontClose(font->dpy, font->xfont);
|
||||||
|
free(font);
|
||||||
|
}
|
||||||
|
|
||||||
|
Clr *
|
||||||
|
drw_clr_create(Drw *drw, const char *clrname)
|
||||||
|
{
|
||||||
|
Clr *clr;
|
||||||
|
|
||||||
|
clr = ecalloc(1, sizeof(Clr));
|
||||||
|
if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
|
||||||
|
DefaultColormap(drw->dpy, drw->screen),
|
||||||
|
clrname, &clr->rgb))
|
||||||
|
die("error, cannot allocate color '%s'\n", clrname);
|
||||||
|
clr->pix = clr->rgb.pixel;
|
||||||
|
|
||||||
|
return clr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
drw_clr_free(Clr *clr)
|
||||||
|
{
|
||||||
|
free(clr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
drw_setscheme(Drw *drw, ClrScheme *scheme)
|
||||||
|
{
|
||||||
|
drw->scheme = scheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int empty, int invert)
|
||||||
|
{
|
||||||
|
if (!drw->scheme)
|
||||||
|
return;
|
||||||
|
XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme->bg->pix : drw->scheme->fg->pix);
|
||||||
|
if (filled)
|
||||||
|
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w + 1, h + 1);
|
||||||
|
else if (empty)
|
||||||
|
XDrawRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *text, int invert)
|
||||||
|
{
|
||||||
|
char buf[1024];
|
||||||
|
int tx, ty, th;
|
||||||
|
Extnts tex;
|
||||||
|
XftDraw *d = NULL;
|
||||||
|
Fnt *curfont, *nextfont;
|
||||||
|
size_t i, len;
|
||||||
|
int utf8strlen, utf8charlen, render;
|
||||||
|
long utf8codepoint = 0;
|
||||||
|
const char *utf8str;
|
||||||
|
FcCharSet *fccharset;
|
||||||
|
FcPattern *fcpattern;
|
||||||
|
FcPattern *match;
|
||||||
|
XftResult result;
|
||||||
|
int charexists = 0;
|
||||||
|
|
||||||
|
if (!drw->scheme || !drw->fontcount)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (!(render = x || y || w || h)) {
|
||||||
|
w = ~w;
|
||||||
|
} else {
|
||||||
|
XSetForeground(drw->dpy, drw->gc, invert ?
|
||||||
|
drw->scheme->fg->pix : drw->scheme->bg->pix);
|
||||||
|
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
|
||||||
|
d = XftDrawCreate(drw->dpy, drw->drawable,
|
||||||
|
DefaultVisual(drw->dpy, drw->screen),
|
||||||
|
DefaultColormap(drw->dpy, drw->screen));
|
||||||
|
}
|
||||||
|
|
||||||
|
curfont = drw->fonts[0];
|
||||||
|
while (1) {
|
||||||
|
utf8strlen = 0;
|
||||||
|
utf8str = text;
|
||||||
|
nextfont = NULL;
|
||||||
|
while (*text) {
|
||||||
|
utf8charlen = utf8decode(text, &utf8codepoint, UTF_SIZ);
|
||||||
|
for (i = 0; i < drw->fontcount; i++) {
|
||||||
|
charexists = charexists || XftCharExists(drw->dpy, drw->fonts[i]->xfont, utf8codepoint);
|
||||||
|
if (charexists) {
|
||||||
|
if (drw->fonts[i] == curfont) {
|
||||||
|
utf8strlen += utf8charlen;
|
||||||
|
text += utf8charlen;
|
||||||
|
} else {
|
||||||
|
nextfont = drw->fonts[i];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!charexists || (nextfont && nextfont != curfont))
|
||||||
|
break;
|
||||||
|
else
|
||||||
|
charexists = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (utf8strlen) {
|
||||||
|
drw_font_getexts(curfont, utf8str, utf8strlen, &tex);
|
||||||
|
/* shorten text if necessary */
|
||||||
|
for (len = MIN(utf8strlen, (sizeof buf) - 1); len && (tex.w > w - drw->fonts[0]->h || w < drw->fonts[0]->h); len--)
|
||||||
|
drw_font_getexts(curfont, utf8str, len, &tex);
|
||||||
|
|
||||||
|
if (len) {
|
||||||
|
memcpy(buf, utf8str, len);
|
||||||
|
buf[len] = '\0';
|
||||||
|
if (len < utf8strlen)
|
||||||
|
for (i = len; i && i > len - 3; buf[--i] = '.');
|
||||||
|
|
||||||
|
if (render) {
|
||||||
|
th = curfont->ascent + curfont->descent;
|
||||||
|
ty = y + (h / 2) - (th / 2) + curfont->ascent;
|
||||||
|
tx = x + (h / 2);
|
||||||
|
XftDrawStringUtf8(d, invert ? &drw->scheme->bg->rgb : &drw->scheme->fg->rgb, curfont->xfont, tx, ty, (XftChar8 *)buf, len);
|
||||||
|
}
|
||||||
|
x += tex.w;
|
||||||
|
w -= tex.w;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!*text) {
|
||||||
|
break;
|
||||||
|
} else if (nextfont) {
|
||||||
|
charexists = 0;
|
||||||
|
curfont = nextfont;
|
||||||
|
} else {
|
||||||
|
/* Regardless of whether or not a fallback font is found, the
|
||||||
|
* character must be drawn.
|
||||||
|
*/
|
||||||
|
charexists = 1;
|
||||||
|
|
||||||
|
if (drw->fontcount >= DRW_FONT_CACHE_SIZE)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
fccharset = FcCharSetCreate();
|
||||||
|
FcCharSetAddChar(fccharset, utf8codepoint);
|
||||||
|
|
||||||
|
if (!drw->fonts[0]->pattern) {
|
||||||
|
/* Refer to the comment in drw_font_xcreate for more
|
||||||
|
* information. */
|
||||||
|
die("the first font in the cache must be loaded from a font string.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
fcpattern = FcPatternDuplicate(drw->fonts[0]->pattern);
|
||||||
|
FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset);
|
||||||
|
FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue);
|
||||||
|
|
||||||
|
FcConfigSubstitute(NULL, fcpattern, FcMatchPattern);
|
||||||
|
FcDefaultSubstitute(fcpattern);
|
||||||
|
match = XftFontMatch(drw->dpy, drw->screen, fcpattern, &result);
|
||||||
|
|
||||||
|
FcCharSetDestroy(fccharset);
|
||||||
|
FcPatternDestroy(fcpattern);
|
||||||
|
|
||||||
|
if (match) {
|
||||||
|
curfont = drw_font_xcreate(drw, NULL, match);
|
||||||
|
if (curfont && XftCharExists(drw->dpy, curfont->xfont, utf8codepoint)) {
|
||||||
|
drw->fonts[drw->fontcount++] = curfont;
|
||||||
|
} else {
|
||||||
|
drw_font_free(curfont);
|
||||||
|
curfont = drw->fonts[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (d)
|
||||||
|
XftDrawDestroy(d);
|
||||||
|
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h)
|
||||||
|
{
|
||||||
|
XCopyArea(drw->dpy, drw->drawable, win, drw->gc, x, y, w, h, x, y);
|
||||||
|
XSync(drw->dpy, False);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
drw_font_getexts(Fnt *font, const char *text, unsigned int len, Extnts *tex)
|
||||||
|
{
|
||||||
|
XGlyphInfo ext;
|
||||||
|
|
||||||
|
XftTextExtentsUtf8(font->dpy, font->xfont, (XftChar8 *)text, len, &ext);
|
||||||
|
tex->h = font->h;
|
||||||
|
tex->w = ext.xOff;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int
|
||||||
|
drw_font_getexts_width(Fnt *font, const char *text, unsigned int len)
|
||||||
|
{
|
||||||
|
Extnts tex;
|
||||||
|
|
||||||
|
drw_font_getexts(font, text, len, &tex);
|
||||||
|
|
||||||
|
return tex.w;
|
||||||
|
}
|
||||||
|
|
||||||
|
Cur *
|
||||||
|
drw_cur_create(Drw *drw, int shape)
|
||||||
|
{
|
||||||
|
Cur *cur;
|
||||||
|
|
||||||
|
cur = ecalloc(1, sizeof(Cur));
|
||||||
|
cur->cursor = XCreateFontCursor(drw->dpy, shape);
|
||||||
|
|
||||||
|
return cur;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
drw_cur_free(Drw *drw, Cur *cursor)
|
||||||
|
{
|
||||||
|
if (!cursor)
|
||||||
|
return;
|
||||||
|
XFreeCursor(drw->dpy, cursor->cursor);
|
||||||
|
free(cursor);
|
||||||
|
}
|
74
drw.h
Normal file
74
drw.h
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
#define DRW_FONT_CACHE_SIZE 32
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
unsigned long pix;
|
||||||
|
XftColor rgb;
|
||||||
|
} Clr;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
Cursor cursor;
|
||||||
|
} Cur;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
Display *dpy;
|
||||||
|
int ascent;
|
||||||
|
int descent;
|
||||||
|
unsigned int h;
|
||||||
|
XftFont *xfont;
|
||||||
|
FcPattern *pattern;
|
||||||
|
} Fnt;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
Clr *fg;
|
||||||
|
Clr *bg;
|
||||||
|
Clr *border;
|
||||||
|
} ClrScheme;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
unsigned int w, h;
|
||||||
|
Display *dpy;
|
||||||
|
int screen;
|
||||||
|
Window root;
|
||||||
|
Drawable drawable;
|
||||||
|
GC gc;
|
||||||
|
ClrScheme *scheme;
|
||||||
|
size_t fontcount;
|
||||||
|
Fnt *fonts[DRW_FONT_CACHE_SIZE];
|
||||||
|
} Drw;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
unsigned int w;
|
||||||
|
unsigned int h;
|
||||||
|
} Extnts;
|
||||||
|
|
||||||
|
/* Drawable abstraction */
|
||||||
|
Drw *drw_create(Display *, int, Window, unsigned int, unsigned int);
|
||||||
|
void drw_resize(Drw *, unsigned int, unsigned int);
|
||||||
|
void drw_free(Drw *);
|
||||||
|
|
||||||
|
/* Fnt abstraction */
|
||||||
|
Fnt *drw_font_create(Drw *, const char *);
|
||||||
|
void drw_load_fonts(Drw *, const char *[], size_t);
|
||||||
|
void drw_font_free(Fnt *);
|
||||||
|
void drw_font_getexts(Fnt *, const char *, unsigned int, Extnts *);
|
||||||
|
unsigned int drw_font_getexts_width(Fnt *, const char *, unsigned int);
|
||||||
|
|
||||||
|
/* Colour abstraction */
|
||||||
|
Clr *drw_clr_create(Drw *, const char *);
|
||||||
|
void drw_clr_free(Clr *);
|
||||||
|
|
||||||
|
/* Cursor abstraction */
|
||||||
|
Cur *drw_cur_create(Drw *, int);
|
||||||
|
void drw_cur_free(Drw *, Cur *);
|
||||||
|
|
||||||
|
/* Drawing context manipulation */
|
||||||
|
void drw_setfont(Drw *, Fnt *);
|
||||||
|
void drw_setscheme(Drw *, ClrScheme *);
|
||||||
|
|
||||||
|
/* Drawing functions */
|
||||||
|
void drw_rect(Drw *, int, int, unsigned int, unsigned int, int, int, int);
|
||||||
|
int drw_text(Drw *, int, int, unsigned int, unsigned int, const char *, int);
|
||||||
|
|
||||||
|
/* Map functions */
|
||||||
|
void drw_map(Drw *, Window, int, int, unsigned int, unsigned int);
|
87
dwm.1
87
dwm.1
@ -19,14 +19,14 @@ layout applied.
|
|||||||
Windows are grouped by tags. Each window can be tagged with one or multiple
|
Windows are grouped by tags. Each window can be tagged with one or multiple
|
||||||
tags. Selecting certain tags displays all windows with these tags.
|
tags. Selecting certain tags displays all windows with these tags.
|
||||||
.P
|
.P
|
||||||
dwm contains a small status bar which displays all available tags, the layout,
|
Each screen contains a small status bar which displays all available tags, the
|
||||||
the title of the focused window, and the text read from standard input. A
|
layout, the title of the focused window, and the text read from the root window
|
||||||
floating window is indicated with an empty square and a maximised
|
name property, if the screen is focused. A floating window is indicated with an
|
||||||
floating window is indicated with a filled square before the windows
|
empty square and a maximised floating window is indicated with a filled square
|
||||||
title. The selected tags are indicated with a different color. The tags of
|
before the windows title. The selected tags are indicated with a different
|
||||||
the focused window are indicated with a filled square in the top left
|
color. The tags of the focused window are indicated with a filled square in the
|
||||||
corner. The tags which are applied to one or more windows are indicated
|
top left corner. The tags which are applied to one or more windows are
|
||||||
with an empty square in the top left corner.
|
indicated with an empty square in the top left corner.
|
||||||
.P
|
.P
|
||||||
dwm draws a small border around windows to indicate the focus state.
|
dwm draws a small border around windows to indicate the focus state.
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
@ -36,8 +36,10 @@ prints version information to standard output, then exits.
|
|||||||
.SH USAGE
|
.SH USAGE
|
||||||
.SS Status bar
|
.SS Status bar
|
||||||
.TP
|
.TP
|
||||||
.B Standard input
|
.B X root window name
|
||||||
is read and displayed in the status text area.
|
is read and displayed in the status text area. It can be set with the
|
||||||
|
.BR xsetroot (1)
|
||||||
|
command.
|
||||||
.TP
|
.TP
|
||||||
.B Button1
|
.B Button1
|
||||||
click on a tag label to display all windows with that tag, click on the layout
|
click on a tag label to display all windows with that tag, click on the layout
|
||||||
@ -55,7 +57,19 @@ click on a tag label adds/removes that tag to/from the focused window.
|
|||||||
.TP
|
.TP
|
||||||
.B Mod1\-Shift\-Return
|
.B Mod1\-Shift\-Return
|
||||||
Start
|
Start
|
||||||
.BR xterm.
|
.BR st(1).
|
||||||
|
.TP
|
||||||
|
.B Mod1\-,
|
||||||
|
Focus previous screen, if any.
|
||||||
|
.TP
|
||||||
|
.B Mod1\-.
|
||||||
|
Focus next screen, if any.
|
||||||
|
.TP
|
||||||
|
.B Mod1\-Shift\-,
|
||||||
|
Send focused window to previous screen, if any.
|
||||||
|
.TP
|
||||||
|
.B Mod1\-Shift\-.
|
||||||
|
Send focused window to next screen, if any.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-b
|
.B Mod1\-b
|
||||||
Toggles bar on and off.
|
Toggles bar on and off.
|
||||||
@ -78,12 +92,18 @@ Focus next window.
|
|||||||
.B Mod1\-k
|
.B Mod1\-k
|
||||||
Focus previous window.
|
Focus previous window.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-h
|
.B Mod1\-i
|
||||||
Decrease master area size.
|
Increase clients in master area.
|
||||||
|
.TP
|
||||||
|
.B Mod1\-d
|
||||||
|
Decrease clients in master area.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-l
|
.B Mod1\-l
|
||||||
Increase master area size.
|
Increase master area size.
|
||||||
.TP
|
.TP
|
||||||
|
.B Mod1\-h
|
||||||
|
Decrease master area size.
|
||||||
|
.TP
|
||||||
.B Mod1\-Return
|
.B Mod1\-Return
|
||||||
Zooms/cycles focused window to/from master area (tiled layouts only).
|
Zooms/cycles focused window to/from master area (tiled layouts only).
|
||||||
.TP
|
.TP
|
||||||
@ -97,30 +117,22 @@ Toggle focused window between tiled and floating state.
|
|||||||
Toggles to the previously selected tags.
|
Toggles to the previously selected tags.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-Shift\-[1..n]
|
.B Mod1\-Shift\-[1..n]
|
||||||
Apply
|
Apply nth tag to focused window.
|
||||||
.RB nth
|
|
||||||
tag to focused window.
|
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-Shift\-0
|
.B Mod1\-Shift\-0
|
||||||
Apply all tags to focused window.
|
Apply all tags to focused window.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-Control\-Shift\-[1..n]
|
.B Mod1\-Control\-Shift\-[1..n]
|
||||||
Add/remove
|
Add/remove nth tag to/from focused window.
|
||||||
.B nth
|
|
||||||
tag to/from focused window.
|
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-[1..n]
|
.B Mod1\-[1..n]
|
||||||
View all windows with
|
View all windows with nth tag.
|
||||||
.BR nth
|
|
||||||
tag.
|
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-0
|
.B Mod1\-0
|
||||||
View all windows with any tag.
|
View all windows with any tag.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-Control\-[1..n]
|
.B Mod1\-Control\-[1..n]
|
||||||
Add/remove all windows with
|
Add/remove all windows with nth tag to/from the view.
|
||||||
.BR nth
|
|
||||||
tag to/from the view.
|
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-Shift\-q
|
.B Mod1\-Shift\-q
|
||||||
Quit dwm.
|
Quit dwm.
|
||||||
@ -138,21 +150,22 @@ Resize focused window while dragging. Tiled windows will be toggled to the float
|
|||||||
dwm is customized by creating a custom config.h and (re)compiling the source
|
dwm is customized by creating a custom config.h and (re)compiling the source
|
||||||
code. This keeps it fast, secure and simple.
|
code. This keeps it fast, secure and simple.
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR dmenu (1)
|
.BR dmenu (1),
|
||||||
|
.BR st (1)
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
The status bar may display
|
|
||||||
.BR "EOF"
|
|
||||||
when dwm has been started by an X session manager like
|
|
||||||
.BR xdm (1),
|
|
||||||
because those close standard output before executing dwm.
|
|
||||||
.P
|
|
||||||
Java applications which use the XToolkit/XAWT backend may draw grey windows
|
Java applications which use the XToolkit/XAWT backend may draw grey windows
|
||||||
only. The XToolkit/XAWT backend breaks ICCCM-compliance in recent JDK 1.5 and early
|
only. The XToolkit/XAWT backend breaks ICCCM-compliance in recent JDK 1.5 and early
|
||||||
JDK 1.6 versions, because it assumes a reparenting window manager. As a workaround
|
JDK 1.6 versions, because it assumes a reparenting window manager. Possible workarounds
|
||||||
you can use JDK 1.4 (which doesn't contain the XToolkit/XAWT backend) or you
|
are using JDK 1.4 (which doesn't contain the XToolkit/XAWT backend) or setting the
|
||||||
can set the following environment variable (to use the older Motif
|
environment variable
|
||||||
backend instead):
|
.BR AWT_TOOLKIT=MToolkit
|
||||||
.BR AWT_TOOLKIT=MToolkit .
|
(to use the older Motif backend instead) or running
|
||||||
|
.B xprop -root -f _NET_WM_NAME 32a -set _NET_WM_NAME LG3D
|
||||||
|
or
|
||||||
|
.B wmname LG3D
|
||||||
|
(to pretend that a non-reparenting window manager is running that the
|
||||||
|
XToolkit/XAWT backend can recognize) or when using OpenJDK setting the environment variable
|
||||||
|
.BR _JAVA_AWT_WM_NONREPARENTING=1 .
|
||||||
.P
|
.P
|
||||||
GTK 2.10.9+ versions contain a broken
|
GTK 2.10.9+ versions contain a broken
|
||||||
.BR Save\-As
|
.BR Save\-As
|
||||||
|
42
transient.c
Normal file
42
transient.c
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/* cc transient.c -o transient -lX11 */
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/Xutil.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
Display *d;
|
||||||
|
Window r, f, t = None;
|
||||||
|
XSizeHints h;
|
||||||
|
XEvent e;
|
||||||
|
|
||||||
|
d = XOpenDisplay(NULL);
|
||||||
|
if (!d)
|
||||||
|
exit(1);
|
||||||
|
r = DefaultRootWindow(d);
|
||||||
|
|
||||||
|
f = XCreateSimpleWindow(d, r, 100, 100, 400, 400, 0, 0, 0);
|
||||||
|
h.min_width = h.max_width = h.min_height = h.max_height = 400;
|
||||||
|
h.flags = PMinSize | PMaxSize;
|
||||||
|
XSetWMNormalHints(d, f, &h);
|
||||||
|
XStoreName(d, f, "floating");
|
||||||
|
XMapWindow(d, f);
|
||||||
|
|
||||||
|
XSelectInput(d, f, ExposureMask);
|
||||||
|
while (1) {
|
||||||
|
XNextEvent(d, &e);
|
||||||
|
|
||||||
|
if (t == None) {
|
||||||
|
sleep(5);
|
||||||
|
t = XCreateSimpleWindow(d, r, 50, 50, 100, 100, 0, 0, 0);
|
||||||
|
XSetTransientForHint(d, t, f);
|
||||||
|
XStoreName(d, t, "transient");
|
||||||
|
XMapWindow(d, t);
|
||||||
|
XSelectInput(d, t, ExposureMask);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
XCloseDisplay(d);
|
||||||
|
exit(0);
|
||||||
|
}
|
33
util.c
Normal file
33
util.c
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
|
void *
|
||||||
|
ecalloc(size_t nmemb, size_t size)
|
||||||
|
{
|
||||||
|
void *p;
|
||||||
|
|
||||||
|
if (!(p = calloc(nmemb, size)))
|
||||||
|
perror(NULL);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
die(const char *fmt, ...) {
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
|
va_start(ap, fmt);
|
||||||
|
vfprintf(stderr, fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
if (fmt[0] && fmt[strlen(fmt)-1] == ':') {
|
||||||
|
fputc(' ', stderr);
|
||||||
|
perror(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
exit(1);
|
||||||
|
}
|
8
util.h
Normal file
8
util.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
|
#define MAX(A, B) ((A) > (B) ? (A) : (B))
|
||||||
|
#define MIN(A, B) ((A) < (B) ? (A) : (B))
|
||||||
|
#define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B))
|
||||||
|
|
||||||
|
void die(const char *errstr, ...);
|
||||||
|
void *ecalloc(size_t, size_t);
|
Reference in New Issue
Block a user