mirror of
https://github.com/stumpwm/stumpwm-contrib.git
synced 2026-09-10 07:26:25 -04:00
Better name for end-session command variable, added configuration example to README
This commit is contained in:
parent
ce05cce7ca
commit
0372363161
|
|
@ -12,6 +12,8 @@
|
|||
(add-to-load-path #p"path-to-contrib/util/end-session")
|
||||
;; actually load the module
|
||||
(load-module "end-session")
|
||||
;; Use loginctl instead of the default systemctl
|
||||
(setf end-session:*end-session-command* "loginctl")
|
||||
#+END_SRC
|
||||
*** Commands Provided:
|
||||
- =end-session= Prompts for shutdown, restart, or logoff. You can
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
;;; DEALINGS IN THE SOFTWARE.
|
||||
;;;
|
||||
|
||||
(defvar *base-command* "systemctl")
|
||||
(defvar *end-session-command* "systemctl")
|
||||
|
||||
(defun yes-no-diag (query-string)
|
||||
"Presents a yes-no dialog to the user asking query-string.
|
||||
|
|
@ -43,7 +43,7 @@ Returns true when yes is selected"
|
|||
(let ((choice (yes-no-diag "Really suspend?")))
|
||||
(when choice
|
||||
(echo-string (current-screen) "Suspending...")
|
||||
(run-shell-command (concat *base-command* " suspend")))))
|
||||
(run-shell-command (concat *end-session-command* " suspend")))))
|
||||
|
||||
(defun close-all-apps ()
|
||||
"Closes all windows managed by stumpwm gracefully"
|
||||
|
|
@ -58,7 +58,7 @@ Returns true when yes is selected"
|
|||
(echo-string (current-screen) "Shutting down...")
|
||||
(close-all-apps)
|
||||
(run-hook *quit-hook*)
|
||||
(run-shell-command (concat *base-command* " poweroff")))))
|
||||
(run-shell-command (concat *end-session-command* " poweroff")))))
|
||||
|
||||
;; can't name the function "restart"
|
||||
(defcommand restart-computer () ()
|
||||
|
|
@ -67,7 +67,7 @@ Returns true when yes is selected"
|
|||
(echo-string (current-screen) "Restarting...")
|
||||
(close-all-apps)
|
||||
(run-hook *quit-hook*)
|
||||
(run-shell-command (concat *base-command* " reboot")))))
|
||||
(run-shell-command (concat *end-session-command* " reboot")))))
|
||||
|
||||
(defcommand logout () ()
|
||||
(let ((choice (yes-no-diag "Close all programs and quit stumpwm?")))
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
(defpackage #:end-session
|
||||
(:use #:cl :stumpwm)
|
||||
(:export #:*base-command*))
|
||||
(:export #:*end-session-command*))
|
||||
|
|
|
|||
Loading…
Reference in a new issue