From 0a5677f9a10b31fa1a39861704c0fff4b6a15d66 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 12 Oct 2015 15:15:24 +0200 Subject: use systemd user unit to (auto-)start --- Makefile | 2 +- README.md | 8 ++++---- mpd-notification.desktop | 8 -------- systemd/mpd-notification.service | 9 +++++++++ 4 files changed, 14 insertions(+), 13 deletions(-) delete mode 100644 mpd-notification.desktop create mode 100644 systemd/mpd-notification.service diff --git a/Makefile b/Makefile index 8e9bacb..f5716dd 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ install: install-bin install-doc install-bin: mpd-notification $(INSTALL) -D -m0755 mpd-notification $(DESTDIR)/usr/bin/mpd-notification - $(INSTALL) -D -m0644 mpd-notification.desktop $(DESTDIR)/etc/xdg/autostart/mpd-notification.desktop + $(INSTALL) -D -m0644 systemd/mpd-notification.service $(DESTDIR)/usr/lib/systemd/user/mpd-notification.service install-doc: README.html $(INSTALL) -D -m0644 README.md $(DESTDIR)/usr/share/doc/mpd-notification/README.md diff --git a/README.md b/README.md index e3be1fb..08e021f 100644 --- a/README.md +++ b/README.md @@ -45,14 +45,14 @@ followed by: This will place an executable at `/usr/bin/mpd-notification`, documentation can be found in `/usr/share/doc/mpd-notification/`. -Additionally a desktop file is installed to `/etc/xdg/autostart/`, this -automatically starts the program when logged in to a desktop environment. +Additionally a systemd unit file is installed to `/usr/lib/systemd/user/`. Usage ----- -Just run `mpd-notification` after installation or re-login to desktop -environment for autostart. +Just run `mpd-notification` to run it once. A systemd user service can be +started and/or enabled with `systemctl --user start mpd-notification` +or `systemctl --user enable mpd-notification`. `mpd-notification` accepts some arguments: diff --git a/mpd-notification.desktop b/mpd-notification.desktop deleted file mode 100644 index 1dec877..0000000 --- a/mpd-notification.desktop +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Name=MPD Notification -Icon=sound -Exec=/usr/bin/mpd-notification -Terminal=false -Type=Application -StartupNotify=false -Categories=Utility diff --git a/systemd/mpd-notification.service b/systemd/mpd-notification.service new file mode 100644 index 0000000..e0dae1b --- /dev/null +++ b/systemd/mpd-notification.service @@ -0,0 +1,9 @@ +[Unit] +Description=MPD Notification + +[Service] +Type=simple +ExecStart=/usr/bin/mpd-notification + +[Install] +WantedBy=default.target -- cgit v1.2.3-54-g00ecf