How to automatically close an application on shutdown (graceful close, not kill)?

I try to call wmctrl -c "App" in powerbtn.sh, but it does not work. The same wmctrl command works perfectly when typed in terminal or called from a script without superuser rights.

Why does it not work in powerbtn.sh and how to fix it?


A normal shutdown gracefully closes all processes anyway - that is, it calls SIGTERM on them, then waits for them to terminate - SIGTERM being the normal way of telling a process to close and allowing it to do any clean-up work necessary before actually terminating.

That is, you don't need to worry about doing this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.