Add the stump-lock module, a screenlocker.

This commit is contained in:
Florian Margaine 2021-01-21 23:11:29 +01:00 committed by Javier Olaechea
parent 2fa5814111
commit a9a26a327d
4 changed files with 62 additions and 0 deletions

View file

@ -0,0 +1,34 @@
* stump-lock
This module allows you to lock your screen while away from your
keyboard.
Note: this is *not* a _secure_ screenlocker. It is a convenient
one. The threat it is protecting against is your cat, not your hacker
neighbor.
** Requirements
None. This is done natively.
** Usage
Put the following in your =~/.stumpwmrc=:
#+begin_src lisp
(load-module "stump-lock")
#+end_src
And you need to define a password:
#+begin_src lisp
(setf stump-lock:*password* "my super secret password")
#+end_src
You can now bind the =lock-screen= command to a key:
#+begin_src lisp
(define-key *top-map* (kbd "s-l") "lock-screen")
#+end_src
That's it!

17
util/stump-lock/lock.lisp Normal file
View file

@ -0,0 +1,17 @@
(in-package #:stump-lock)
(defvar *password* nil
"The password to unlock.")
(stumpwm:defcommand lock-screen () ()
(unless *password*
(error "A password needs to be set. Please read the instructions."))
(loop
(if (string= (let ((stumpwm::*input-history* nil))
(stumpwm:read-one-line
(stumpwm:current-screen)
(format nil "The screen is locked.~%Enter password: ")
:password t))
*password*)
(return)
(sleep (+ 2 (random 3.0))))))

View file

@ -0,0 +1,3 @@
(defpackage #:stump-lock
(:use #:cl)
(:export #:*password*))

View file

@ -0,0 +1,8 @@
(defsystem "stump-lock"
:serial t
:description "Screen locker in StumpWM"
:author "Florian Margaine <florian@margaine.com>"
:license "GPLv3"
:depends-on ("stumpwm")
:components ((:file "package")
(:file "lock")))