key.lisp 443 B

12345678910111213141516171819202122
  1. ;;; key.lisp
  2. (in-package #:boxes/keymap/key)
  3. (defun normalize-key (key)
  4. (etypecase key
  5. (stumpwm::key key)
  6. (string (stumpwm:kbd key))
  7. (character (stumpwm:kbd (string key)))))
  8. (defmacro ensure-normalized-key (place)
  9. `(setf ,place (normalize-key ,place)))
  10. (deftype key () 'stumpwm::key)
  11. (defun key= (keybinding1 keybinding2)
  12. (check-type keybinding1 key)
  13. (check-type keybinding2 key)
  14. (equalp keybinding1 keybinding2))