2020-04-14 00:09:46 +02:00
|
|
|
;; -*- mode: lisp; -*-
|
|
|
|
|
|
|
|
(in-package :stumpwm-user)
|
|
|
|
|
|
|
|
(ql:quickload "swank")
|
|
|
|
|
|
|
|
(load-module "swm-gaps")
|
|
|
|
|
|
|
|
(defvar *lock-screen-hook* nil
|
|
|
|
"Hook that gets run right before the screen gets locked.")
|
|
|
|
|
|
|
|
(defvar *screen-unlocked-hook* nil
|
|
|
|
"Hook that gets run right after the screen is unlocked.")
|
|
|
|
|
|
|
|
(defun run-stumpwm-hook-on-exit (process)
|
|
|
|
"Run `*screen-unlocked-hook*' if PROCESS' status is `:exited'."
|
|
|
|
(when (eq (sb-ext:process-status process) :exited)
|
|
|
|
(run-hook *screen-unlocked-hook*)))
|
|
|
|
|
|
|
|
(defcommand lock-screen () ()
|
|
|
|
"Lock the screen using i3lock.
|
|
|
|
Run `*lock-screen-hook*' before locking it and run `*screen-unlocked-hook*'
|
|
|
|
after it has been unlocked."
|
|
|
|
(run-hook *lock-screen-hook*)
|
|
|
|
(sb-ext:run-program
|
|
|
|
"/usr/bin/i3lock" '("-n" "-c" "000000")
|
|
|
|
:wait nil
|
|
|
|
:status-hook #'run-stumpwm-hook-on-exit))
|
|
|
|
|
|
|
|
(setf swm-gaps:*inner-gaps-size* 7)
|
|
|
|
(setf swm-gaps:*outer-gaps-size* 7)
|
|
|
|
|
|
|
|
(set-prefix-key (kbd "C-z"))
|
|
|
|
|
|
|
|
(define-key *top-map* (kbd "C-M-l") "lock-screen")
|
|
|
|
|
2020-04-15 07:14:44 +02:00
|
|
|
(swm-gaps:toggle-gaps)
|
2020-04-14 00:09:46 +02:00
|
|
|
|
2020-04-15 07:14:58 +02:00
|
|
|
(with-message-queuing t
|
|
|
|
(let ((programs-in-path (programs-in-path)))
|
|
|
|
(unless (member "i3lock" programs-in-path :test #'string-equal)
|
|
|
|
(echo "Couldn't find the i3lock executable, can't lock screen"))))
|
|
|
|
|
2020-04-14 00:09:46 +02:00
|
|
|
(swank:create-server :dont-close t)
|