diff options
| author | 2022-07-22 21:12:45 -0700 | |
|---|---|---|
| committer | 2022-07-22 21:12:45 -0700 | |
| commit | e8cdf76fbfaa6bd6c79b7a44a22e277c62781c9e (patch) | |
| tree | 749343a36b3e08e8fc8acb52b0cae352e8d3067e /oni/kbd.scm | |
| parent | 7957b236de1638fdcc1c9d16780c463defd8f961 (diff) | |
| download | new-dotfiles-e8cdf76fbfaa6bd6c79b7a44a22e277c62781c9e.tar.gz new-dotfiles-e8cdf76fbfaa6bd6c79b7a44a22e277c62781c9e.zip | |
Move a couple of keybindings to herbstluftwm
Diffstat (limited to 'oni/kbd.scm')
| -rw-r--r-- | oni/kbd.scm | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/oni/kbd.scm b/oni/kbd.scm new file mode 100644 index 0000000..eb7f8d7 --- /dev/null +++ b/oni/kbd.scm @@ -0,0 +1,29 @@ +(define-module (oni kbd) + #:use-module (ice-9 match) + #:use-module (srfi srfi-1) + + #:export (kbd)) + +(define (convert-modifier mod) + (match mod + ("C" "Ctrl") + ("M" "Mod1") + ("S" "Shift") + ("s" "Mod4"))) + +(define (convert-key key) + (match key + ("RET" "Return") + ("SPC" "space") + ("<backspace>" "BackSpace") + (_ key))) + +(define (kbd str) + (let ((parts (string-split str #\-))) + (string-join + (fold-right (lambda (key previous) + (if (null? previous) + (list (convert-key key)) + (cons (convert-modifier key) previous))) + '() parts) + "-"))) |
