re-applied Neale's spawn patch, credited Neale in LICENSE
62a491e3
4 file(s) · +18 −13
| 9 | 9 | © 2007-2008 Enno Gottox Boland <gottox at s01 dot de> |
|
| 10 | 10 | © 2007-2008 Peter Hartlich <sgkkr at hartlich dot com> |
|
| 11 | 11 | © 2008 Martin Hurton <martin dot hurton at gmail dot com> |
|
| 12 | + | © 2008 Neale Pickett <neale dot woozle dot org> |
|
| 12 | 13 | ||
| 13 | 14 | Permission is hereby granted, free of charge, to any person obtaining a |
|
| 14 | 15 | copy of this software and associated documentation files (the "Software"), |
| 38 | 38 | In order to display status info in the bar, you can do something |
|
| 39 | 39 | like this in your .xinitrc: |
|
| 40 | 40 | ||
| 41 | + | dwm & |
|
| 41 | 42 | while true |
|
| 42 | 43 | do |
|
| 43 | 44 | xsetroot -name "`date` `uptime | sed 's/.*,//'`" |
|
| 44 | 45 | sleep 1 |
|
| 45 | - | done | dwm |
|
| 46 | + | done |
|
| 46 | 47 | ||
| 47 | 48 | ||
| 48 | 49 | Configuration |
| 1 | 1 | # dwm version |
|
| 2 | - | VERSION = 5.3.1 |
|
| 2 | + | VERSION = 5.4 |
|
| 3 | 3 | ||
| 4 | 4 | # Customize below to fit your system |
|
| 5 | 5 |
| 178 | 178 | static void setmfact(const Arg *arg); |
|
| 179 | 179 | static void setup(void); |
|
| 180 | 180 | static void showhide(Client *c); |
|
| 181 | + | static void sigchld(int signal); |
|
| 181 | 182 | static void spawn(const Arg *arg); |
|
| 182 | 183 | static void tag(const Arg *arg); |
|
| 183 | 184 | static int textnw(const char *text, unsigned int len); |
|
| 1340 | 1341 | } |
|
| 1341 | 1342 | } |
|
| 1342 | 1343 | ||
| 1344 | + | ||
| 1345 | + | void |
|
| 1346 | + | sigchld(int signal) { |
|
| 1347 | + | while(0 < waitpid(-1, NULL, WNOHANG)); |
|
| 1348 | + | } |
|
| 1349 | + | ||
| 1343 | 1350 | void |
|
| 1344 | 1351 | spawn(const Arg *arg) { |
|
| 1345 | - | /* The double-fork construct avoids zombie processes and keeps the code |
|
| 1346 | - | * clean from stupid signal handlers. */ |
|
| 1352 | + | signal(SIGCHLD, sigchld); |
|
| 1347 | 1353 | if(fork() == 0) { |
|
| 1348 | - | if(fork() == 0) { |
|
| 1349 | - | if(dpy) |
|
| 1350 | - | close(ConnectionNumber(dpy)); |
|
| 1351 | - | setsid(); |
|
| 1352 | - | execvp(((char **)arg->v)[0], (char **)arg->v); |
|
| 1353 | - | fprintf(stderr, "dwm: execvp %s", ((char **)arg->v)[0]); |
|
| 1354 | - | perror(" failed"); |
|
| 1355 | - | } |
|
| 1354 | + | if(dpy) |
|
| 1355 | + | close(ConnectionNumber(dpy)); |
|
| 1356 | + | setsid(); |
|
| 1357 | + | execvp(((char **)arg->v)[0], (char **)arg->v); |
|
| 1358 | + | fprintf(stderr, "dwm: execvp %s", ((char **)arg->v)[0]); |
|
| 1359 | + | perror(" failed"); |
|
| 1356 | 1360 | exit(0); |
|
| 1357 | 1361 | } |
|
| 1358 | - | wait(0); |
|
| 1359 | 1362 | } |
|
| 1360 | 1363 | ||
| 1361 | 1364 | void |
|