keymap-examples.lisp 722 B

1234567891011121314151617181920212223242526272829
  1. (in-package :stumpwm)
  2. ;;; Binding keys in "sub-keymap"
  3. (defvar *my-frame-map* (make-sparse-keymap))
  4. (define-key *root-map* (kbd "f") '*my-frame-map*)
  5. (define-key *my-frame-map* (kbd "w") "frame-windowlist")
  6. ;;; Creating a "permanent" map
  7. (defvar *sample-map* (make-sparse-keymap) "sample keymap")
  8. (define-key *sample-map* (kbd "s-n") "pull-hidden-next")
  9. (define-key *sample-map* (kbd "s-q") "exit-sample-map")
  10. (define-key *top-map* (kbd "s-1") "enter-sample-map")
  11. (defcommand enter-sample-map () ()
  12. "Enter to sample-map."
  13. (message "We are in sample-map!")
  14. (push-top-map *sample-map*))
  15. (defcommand exit-sample-map () ()
  16. "Exit from sample-map."
  17. (message "We are in top-map again!")
  18. (pop-top-map))