Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing of custom setxkb options. #52

Merged
merged 1 commit into from May 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion util/kbd-layouts/kbd-layouts.lisp
Expand Up @@ -14,6 +14,9 @@
;; :swapped-> Swap Ctrl and CapsLock
(defvar *caps-lock-behavior* nil)

;; Custom option string appended to setxkbmap
(defvar *custom-setxkb-options* nil)

;;;;;;;;;;;;;;;;;;;;;;
;; Helper functions ;;
;;;;;;;;;;;;;;;;;;;;;;
Expand All @@ -40,13 +43,14 @@
;;;;;;;;;;;;;;

(defcommand switch-keyboard-layout () ()
"Perform the actual layout switching."
(let* ((layout (pop *available-keyboard-layouts*))
(caps (ecase
*caps-lock-behavior*
(:normal "caps:capslock")
(:ctrl "ctrl:nocaps")
(:swapped "ctrl:swapcaps")))
(cmd (format nil "setxkbmap ~a -option ~a" layout caps)))
(cmd (format nil "setxkbmap ~a -option ~a~@[ ~a~]" layout caps *custom-setxkb-options*)))
(run-shell-command cmd t)
(message (format nil "Keyboard layout switched to: ~a" layout))))

Expand Down
1 change: 1 addition & 0 deletions util/kbd-layouts/package.lisp
Expand Up @@ -3,6 +3,7 @@
(defpackage #:kbd-layouts
(:use #:cl #:stumpwm)
(:export *caps-lock-behavior*
*custom-setxkb-options*
keyboard-layout-list))