Show VPN status in mode-line

This commit is contained in:
Tom Willemse 2023-04-22 00:32:05 -07:00
parent 7c7af83a27
commit 4ce635661d

View file

@ -16,6 +16,9 @@
(when (eq (sb-ext:process-status process) :exited) (when (eq (sb-ext:process-status process) :exited)
(run-hook *screen-unlocked-hook*))) (run-hook *screen-unlocked-hook*)))
(defun vpn-connected-p ()
(probe-file "/sys/class/net/vpn"))
(defcommand lock-screen () () (defcommand lock-screen () ()
"Lock the screen using i3lock. "Lock the screen using i3lock.
Run `*screen-locking-hook*' before locking it and run `*screen-unlocked-hook*' Run `*screen-locking-hook*' before locking it and run `*screen-unlocked-hook*'
@ -56,7 +59,12 @@ after it has been unlocked."
'(:eval '(:eval
(or (ignore-errors (window-title (current-window))) (or (ignore-errors (window-title (current-window)))
"Unknown")) "Unknown"))
"^>%d ")) "^>"
'(:eval
(if (vpn-connected-p)
"^*5^B[VPN]^b^n "
""))
"%d "))
(mode-line) (mode-line)
(restore-from-file "default") (restore-from-file "default")