hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
21.36k stars 898 forks source link

Execute program on startup without disowning it and stop it on exiting Hyprland #7578

Open Nanderty opened 2 months ago

Nanderty commented 2 months ago

Description

It would be nice to have an option to execute a program that stays a child of Hyprland and gets stopped once Hyprland exits, prefferably with a customizable kill command. Something like: exec-once-no-disown = executable, 15

Vladimir-csp commented 2 months ago

If you use systemd, you can launch with:

systemd-run --user -u your-app.service --property=PartOf=hyprland-session.service --property=After=hyprland-session.service -- your-app

When hyprland-session.service is deactivated, your-app.service should be brought down too.

Nanderty commented 2 months ago

Thank you for the suggestion! I should have clarified that this request is especially about usage with other init systems and service managers. The idea is, that a process or supervision tree can be spawned from Hyprland, inheriting its environment, providing a clear process tree by not being disowned and be correctly stopped once Hyprland stops.