dwl-run: add cleanup - dotfiles - 🍚 personal arsenal of "rice"
HTML git clone https://git.drkhsh.at/dotfiles.git
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
DIR commit 7f4b2d9ed03a6ebd5093b033492bdb3e4ddb5b3c
DIR parent fd282f966a8d4f57b16a72f70f540dd11d7ceb18
HTML Author: drkhsh <drkhsh@escpe.net>
Date: Tue, 13 May 2025 15:58:59 +0200
dwl-run: add cleanup
Diffstat:
M bin/.local/bin/dwl-run | 6 ++++++
M bin/.local/bin/user-session | 21 +++++++++++++++------
2 files changed, 21 insertions(+), 6 deletions(-)
---
DIR diff --git a/bin/.local/bin/dwl-run b/bin/.local/bin/dwl-run
@@ -1,5 +1,11 @@
#!/bin/sh
+cleanup() {
+ echo "cleaning up"
+ user-session stop
+}
+trap cleanup INT TERM QUIT
+
# session
export XDG_SESSION_TYPE=wayland
export XDG_SESSION_DESKTOP=dwl
DIR diff --git a/bin/.local/bin/user-session b/bin/.local/bin/user-session
@@ -3,9 +3,18 @@ set -e
_exists() {
type $1 > /dev/null 2>&1
}
-if _exists systemctl; then
- systemctl --user import-environment
- systemctl --user start gui.target &
-elif _exists openrc; then
- openrc --user gui &
-fi
+case "$1" in
+ "stop")
+ if _exists systemctl; then
+ systemctl --user stop gui.target
+ fi
+ ;;
+ *)
+ if _exists systemctl; then
+ systemctl --user import-environment
+ systemctl --user start gui.target &
+ elif _exists openrc; then
+ openrc --user gui &
+ fi
+ ;;
+esac