mirror of
https://github.com/stumpwm/stumpwm-contrib.git
synced 2026-09-10 07:26:25 -04:00
Add the stump-lock module, a screenlocker.
This commit is contained in:
parent
2fa5814111
commit
a9a26a327d
34
util/stump-lock/README.org
Normal file
34
util/stump-lock/README.org
Normal 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
17
util/stump-lock/lock.lisp
Normal 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))))))
|
||||
3
util/stump-lock/package.lisp
Normal file
3
util/stump-lock/package.lisp
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(defpackage #:stump-lock
|
||||
(:use #:cl)
|
||||
(:export #:*password*))
|
||||
8
util/stump-lock/stump-lock.asd
Normal file
8
util/stump-lock/stump-lock.asd
Normal 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")))
|
||||
Loading…
Reference in a new issue