aboutsummaryrefslogtreecommitdiff
path: root/wiki/Example-systemd-Setup.md
diff options
context:
space:
mode:
authorKent Daleng <lolexplode@gmail.com>2025-08-17 16:05:41 +0200
committerGitHub <noreply@github.com>2025-08-17 17:05:41 +0300
commitdc93f1c1fd7b67e2da5af2ffada732b9ddeb2d6a (patch)
treea2f2938a7df17c196be7016dc5fe1fc9f75fb484 /wiki/Example-systemd-Setup.md
parenta6febb86aa5af0df7bf2792ca027ef95a503d599 (diff)
downloadniri-dc93f1c1fd7b67e2da5af2ffada732b9ddeb2d6a.tar.gz
niri-dc93f1c1fd7b67e2da5af2ffada732b9ddeb2d6a.tar.bz2
niri-dc93f1c1fd7b67e2da5af2ffada732b9ddeb2d6a.zip
github wiki replacement / mkdocs-docs (#2147)
* Add wiki based on mkdocs * wording fixes * fix github bg color on narrow * Fix left sidebar section headers being bigger than pages * fix hover accent * fix list rendering on fractional layout * fix videos * fix automatic full links * remove redundant commented css * improve dark mode contrast * update pygments for better child node coloring * update logo * remove blank lines * add systemd language hint --------- Co-authored-by: Ivan Molodetskikh <yalterz@gmail.com>
Diffstat (limited to 'wiki/Example-systemd-Setup.md')
-rw-r--r--wiki/Example-systemd-Setup.md76
1 files changed, 0 insertions, 76 deletions
diff --git a/wiki/Example-systemd-Setup.md b/wiki/Example-systemd-Setup.md
deleted file mode 100644
index beb62a89..00000000
--- a/wiki/Example-systemd-Setup.md
+++ /dev/null
@@ -1,76 +0,0 @@
-When starting niri from a display manager like GDM, or otherwise through the `niri-session` binary, it runs as a systemd service.
-This provides the necessary systemd integration to run programs like `mako` and services like `xdg-desktop-portal` bound to the graphical session.
-
-Here's an example on how you might set up [`mako`](https://github.com/emersion/mako), [`waybar`](https://github.com/Alexays/Waybar), [`swaybg`](https://github.com/swaywm/swaybg) and [`swayidle`](https://github.com/swaywm/swayidle) to run as systemd services with niri.
-Unlike [`spawn-at-startup`](./Configuration:-Miscellaneous.md#spawn-at-startup), this lets you easily monitor their status and output, and restart or reload them.
-
-1. Install them, i.e. `sudo dnf install mako waybar swaybg swayidle`
-2. `mako` and `waybar` provide systemd units out of the box, so you can simply add them to the niri session:
-
- ```
- systemctl --user add-wants niri.service mako.service
- systemctl --user add-wants niri.service waybar.service
- ```
-
- This will create links in `~/.config/systemd/user/niri.service.wants/`, a special systemd folder for services that need to start together with `niri.service`.
-
-3. `swaybg` does not provide a systemd unit, since you need to pass the background image as a command-line argument.
- So we will make our own.
- Create `~/.config/systemd/user/swaybg.service` with the following contents:
-
- ```
- [Unit]
- PartOf=graphical-session.target
- After=graphical-session.target
- Requisite=graphical-session.target
-
- [Service]
- ExecStart=/usr/bin/swaybg -m fill -i "%h/Pictures/LakeSide.png"
- Restart=on-failure
- ```
-
- Replace the image path with the one you want.
- `%h` is expanded to your home directory.
-
- After editing `swaybg.service`, run `systemctl --user daemon-reload` so systemd picks up the changes in the file.
-
- Now, add it to the niri session:
-
- ```
- systemctl --user add-wants niri.service swaybg.service
- ```
-
-4. `swayidle` similarly does not provide a service, so we will also make our own.
- Create `~/.config/systemd/user/swayidle.service` with the following contents:
-
- ```
- [Unit]
- PartOf=graphical-session.target
- After=graphical-session.target
- Requisite=graphical-session.target
-
- [Service]
- ExecStart=/usr/bin/swayidle -w timeout 601 'niri msg action power-off-monitors' timeout 600 'swaylock -f' before-sleep 'swaylock -f'
- Restart=on-failure
- ```
-
- Then, run `systemctl --user daemon-reload` and add it to the niri session:
-
- ```
- systemctl --user add-wants niri.service swayidle.service
- ```
-
-That's it!
-Now these three utilities will be started together with the niri session and stopped when it exits.
-You can also restart them with a command like `systemctl --user restart waybar.service`, for example after editing their config files.
-
-To remove a service from niri startup, remove its symbolic link from `~/.config/systemd/user/niri.service.wants/`.
-Then, run `systemctl --user daemon-reload`.
-
-### Running Programs Across Logout
-
-When running niri as a session, exiting it (logging out) will kill all programs that you've started within. However, sometimes you want a program, like `tmux`, `dtach` or similar, to persist in this case. To do this, run it in a transient systemd scope:
-
-```
-systemd-run --user --scope tmux new-session
-```