Compare commits
2 Commits
4a0b863735
...
0a0ab0703a
Author | SHA1 | Date |
---|---|---|
Lily Tsuru | 0a0ab0703a | |
Lily Tsuru | bc530fe8a2 |
|
@ -6,9 +6,9 @@ Written in C++20, using epoll (without helper libraries), to stay nice and smol
|
||||||
|
|
||||||
# Why write this?
|
# Why write this?
|
||||||
|
|
||||||
Because `app &` then `exec wm` is impressively awful. What if your WM crashes, or your panel? Guess you lose them!
|
Because `app &` then `exec wm` in `.xinitrc` is impressively awful. What if your WM crashes, or your panel? Guess you lose them!
|
||||||
|
|
||||||
And if your WM crashes? Your whole xorg server goes with it, meaning so does everything else.
|
And if your WM crashes? Your whole Xorg server goes with it, meaning so does everything else.
|
||||||
|
|
||||||
A more robust solution that's still small and easy to setup (read: Not written in bash) is clearly a better idea.
|
A more robust solution that's still small and easy to setup (read: Not written in bash) is clearly a better idea.
|
||||||
|
|
||||||
|
@ -28,4 +28,7 @@ $ ninja -C build
|
||||||
# Configuration
|
# Configuration
|
||||||
|
|
||||||
- Copy `/usr/share/doc/nanosm/nanosm.toml` to `~/.config/nanosm/` and edit it to your liking/setup.
|
- Copy `/usr/share/doc/nanosm/nanosm.toml` to `~/.config/nanosm/` and edit it to your liking/setup.
|
||||||
|
- Remove the applications you added to your `nanosm.toml` from your `.xinitrc`, since nanosm will handle them
|
||||||
- Add `exec nanosm` to the end of your `.xinitrc`.
|
- Add `exec nanosm` to the end of your `.xinitrc`.
|
||||||
|
- ...
|
||||||
|
- Profit?
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <sys/prctl.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include "WordExp.hpp"
|
#include "WordExp.hpp"
|
||||||
|
@ -49,6 +50,12 @@ namespace nanosm {
|
||||||
for(usize i = 0; i < exp.words.size(); ++i)
|
for(usize i = 0; i < exp.words.size(); ++i)
|
||||||
argv[i] = exp.words[i].data();
|
argv[i] = exp.words[i].data();
|
||||||
|
|
||||||
|
// Ensure that if nanosm (the parent) dies, we die along with it
|
||||||
|
if(prctl(PR_SET_PDEATHSIG, SIGTERM) == -1) {
|
||||||
|
perror("Process pre-exec: prctl(PR_SET_PDEATHSIG)");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
exit(execvp(exp.words[0].data(), argv.data()));
|
exit(execvp(exp.words[0].data(), argv.data()));
|
||||||
} else {
|
} else {
|
||||||
// Parent: monitor the pidfd by adding ourselves to the event loop now
|
// Parent: monitor the pidfd by adding ourselves to the event loop now
|
||||||
|
|
Loading…
Reference in New Issue