aboutsummaryrefslogtreecommitdiff
path: root/resources
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2023-08-27 07:37:36 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2023-08-27 07:37:36 +0400
commitd268cfcf9f2d86a58456f3f3b946a763d1cc6140 (patch)
tree6b086ff15246e3a68c3e5a7052f8adcf50dfeb62 /resources
parent99484afe526dde4c04050f0ea7c98dc63f444fdf (diff)
downloadniri-d268cfcf9f2d86a58456f3f3b946a763d1cc6140.tar.gz
niri-d268cfcf9f2d86a58456f3f3b946a763d1cc6140.tar.bz2
niri-d268cfcf9f2d86a58456f3f3b946a763d1cc6140.zip
Add initial session / systemd integration
Diffstat (limited to 'resources')
-rwxr-xr-xresources/niri-session30
-rw-r--r--resources/niri.desktop6
-rw-r--r--resources/niri.service9
3 files changed, 45 insertions, 0 deletions
diff --git a/resources/niri-session b/resources/niri-session
new file mode 100755
index 00000000..77332e32
--- /dev/null
+++ b/resources/niri-session
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+# Make sure there's no already running session.
+if systemctl --user -q is-active niri.service; then
+ echo 'A niri session is already running.'
+ exit 1
+fi
+
+# Reset failed state of all user units.
+systemctl --user reset-failed
+
+# Set the current desktop for xdg-desktop-portal.
+export XDG_CURRENT_DESKTOP=niri
+
+# Ensure the session type is set to Wayland for xdg-autostart apps.
+export XDG_SESSION_TYPE=wayland
+
+# Import the login manager environment.
+systemctl --user import-environment
+
+# DBus activation environment is independent from systemd. While most of
+# dbus-activated services are already using `SystemdService` directive, some
+# still don't and thus we should set the dbus environment with a separate
+# command.
+if hash dbus-update-activation-environment 2>/dev/null; then
+ dbus-update-activation-environment --all
+fi
+
+# Start niri and wait for it to terminate.
+exec systemctl --user --wait start niri.service
diff --git a/resources/niri.desktop b/resources/niri.desktop
new file mode 100644
index 00000000..5470fe76
--- /dev/null
+++ b/resources/niri.desktop
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Name=Niri
+Comment=A scrollable-tiling Wayland compositor
+Exec=niri-session
+Type=Application
+DesktopNames=niri
diff --git a/resources/niri.service b/resources/niri.service
new file mode 100644
index 00000000..97c6e449
--- /dev/null
+++ b/resources/niri.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=A scrollable-tiling Wayland compositor
+BindsTo=graphical-session.target
+Wants=graphical-session-pre.target
+After=graphical-session-pre.target
+
+[Service]
+Type=notify
+ExecStart=/usr/bin/niri