Created
January 21, 2022 17:37
-
-
Save LinArcX/69052ae7f5b1a8e70ae5872084c2d94d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; async-run function | |
(defparameter *async-shell* (uiop:launch-program "bash" :input :stream :output :stream)) | |
(defun async-run (command) | |
(write-line command (uiop:process-info-input *async-shell*)) | |
(force-output (uiop:process-info-input *async-shell*)) | |
(let* ((output-string (read-line (uiop:process-info-output *async-shell*))) | |
(stream (uiop:process-info-output *async-shell*))) | |
(if (listen stream) | |
(loop while (listen stream) | |
do (setf output-string (concatenate 'string | |
output-string | |
'(#\Newline) | |
(read-line stream))))) | |
output-string)) | |
;; my keyboard layout function | |
(defun linarcx-keyboard-layout (ml) | |
(declare (ignore ml)) | |
(let ((cmd "xkb-switch -p")) | |
(string-trim '(#\Newline) (async-run cmd)))) | |
(add-screen-mode-line-formatter #\L #'linarcx-keyboard-layout) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment