Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add systemd service #115

Merged
merged 1 commit into from
May 29, 2022
Merged

add systemd service #115

merged 1 commit into from
May 29, 2022

Conversation

jtheoof
Copy link
Contributor

@jtheoof jtheoof commented May 25, 2022

Not all sway users rely on the "flaky" exec_always in the sway config.

For example if the app crashes (like it currently does on my machine
after a suspend / resume), then nwg-panel is terminated and never
comes back.

For users using sway-service
this would be a nice addition.

Also this is the required change in the PKGBUILD

diff --git a/PKGBUILD b/PKGBUILD
index 26c5832..f698201 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -20,4 +20,5 @@ package() {
   install -D -t "$pkgdir"/usr/share/pixmaps nwg-panel.svg
   install -D -t "$pkgdir"/usr/share/pixmaps nwg-shell.svg
   install -D -t "$pkgdir"/usr/share/applications nwg-panel-config.desktop
+  install -D -t "$pkgdir"/usr/lib/systemd/user/ nwg-panel.service
 }

Not all sway users rely on the "flaky" `exec_always` in the sway config.

For example if the app crashes (like it currently does on my machine
after a suspend / resume), then `nwg-panel` is terminated and never
comes back.

For users using [sway-service](https://github.com/xdbob/sway-services)
this would be a nice addition.

Also this is the required change in the [PKGBUILD](https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=nwg-panel)

```diff
diff --git a/PKGBUILD b/PKGBUILD
index 26c5832..f698201 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -20,4 +20,5 @@ package() {
   install -D -t "$pkgdir"/usr/share/pixmaps nwg-panel.svg
   install -D -t "$pkgdir"/usr/share/pixmaps nwg-shell.svg
   install -D -t "$pkgdir"/usr/share/applications nwg-panel-config.desktop
+  install -D -t "$pkgdir"/usr/lib/systemd/user/ nwg-panel.service
 }
```
@jtheoof
Copy link
Contributor Author

jtheoof commented May 25, 2022

Please note that this was heavily inspired from mako's service file.

@nwg-piotr
Copy link
Owner

Interesting, thank you. Let me get back to it over the weekend, as we're busy with an urgent job ab the moment.

@jtheoof
Copy link
Contributor Author

jtheoof commented May 26, 2022

Also note that it would be nice to update the wiki after that, but I cannot put it inside this MR.

image

@nwg-piotr
Copy link
Owner

This will also require changes in nwg-shell-config, so can not be done immediately.

@nwg-piotr
Copy link
Owner

Is sway-services necessary to start nwg-panel.service? I tried just copying your file to /usr/lib/systemd/user/ and ended up in:

$ systemctl enable nwg-panel.service
Failed to enable unit: Unit file nwg-panel.service does not exist.

@jtheoof
Copy link
Contributor Author

jtheoof commented May 27, 2022

This is a user service. You need to enable it via systemctl --user enable nwg-panel.service -> This should go to the wiki.

@nwg-piotr
Copy link
Owner

nwg-piotr commented May 27, 2022

Ah, all right. This will be useful for standalone use of panel only. Switching nwg-shell presets requires re-launching nwg-panel with different arguments.

@jtheoof
Copy link
Contributor Author

jtheoof commented May 28, 2022

Yes and it's fully opt-in. Users don't need to use this if they don't want to. I haven't played around with nwg-shell yet. Taking it step by step but looks like a cool project. If I see other tools could benefit from better systemd integration I'll try to contribute.

@nwg-piotr
Copy link
Owner

You've already contributed, as the shell uses swappy by default. Many thanks!

@nwg-piotr nwg-piotr merged commit b5d69f8 into nwg-piotr:master May 29, 2022
@jtheoof jtheoof deleted the systemd-service branch May 29, 2022 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants