Make `exwm-manage-configurations' more user friendly

* exwm-manage.el (exwm-manage-configurations): Specify type for each
configuration option.
This commit is contained in:
Chris Feng 2019-08-11 00:00:00 +00:00
parent a1cf0d9b85
commit d78c562f9a

View file

@ -74,28 +74,64 @@ criterion would be applied."
:type '(alist :key-type (sexp :tag "Matching criterion" nil) :type '(alist :key-type (sexp :tag "Matching criterion" nil)
:value-type :value-type
(plist :tag "Configurations" (plist :tag "Configurations"
:key-type :options
(choice (((const :tag "Floating" floating) boolean)
(const :tag "Floating" floating) ((const :tag "X" x) number)
(const :tag "X" x) ((const :tag "Y" y) number)
(const :tag "Y" y) ((const :tag "Width" width) number)
(const :tag "Width" width) ((const :tag "Height" height) number)
(const :tag "Height" height) ((const :tag "Border width" border-width) integer)
(const :tag "Border width" border-width) ((const :tag "Fullscreen" fullscreen) boolean)
(const :tag "Fullscreen" fullscreen) ((const :tag "Floating mode-line" floating-mode-line)
(const :tag "Floating mode-line" floating-mode-line) sexp)
(const :tag "Tiling mode-line" tiling-mode-line) ((const :tag "Tiling mode-line" tiling-mode-line) sexp)
(const :tag "Floating header-line" ((const :tag "Floating header-line"
floating-header-line) floating-header-line)
(const :tag "Tiling header-line" tiling-header-line) sexp)
(const :tag "Char-mode" char-mode) ((const :tag "Tiling header-line" tiling-header-line)
(const :tag "Prefix keys" prefix-keys) sexp)
(const :tag "Simulation keys" simulation-keys) ((const :tag "Char-mode" char-mode) boolean)
(const :tag "Workspace" workspace) ((const :tag "Prefix keys" prefix-keys)
(const :tag "Managed" managed) (repeat key-sequence))
((const :tag "Simulation keys" simulation-keys)
(alist :key-type (key-sequence :tag "From")
:value-type (key-sequence :tag "To")))
((const :tag "Workspace" workspace) integer)
((const :tag "Managed" managed) boolean)
;; For forward compatibility. ;; For forward compatibility.
(other)) ((other) sexp))))
:value-type (sexp :tag "Value" nil)))) ;; TODO: This is admittedly ugly. We'd be better off with an event type.
:get (lambda (symbol)
(mapcar (lambda (pair)
(let* ((match (car pair))
(config (cdr pair))
(prefix-keys (plist-get config 'prefix-keys)))
(when prefix-keys
(setq config (copy-tree config)
config (plist-put config 'prefix-keys
(mapcar (lambda (i)
(if (sequencep i)
i
(vector i)))
prefix-keys))))
(cons match config)))
(default-value symbol)))
:set (lambda (symbol value)
(set symbol
(mapcar (lambda (pair)
(let* ((match (car pair))
(config (cdr pair))
(prefix-keys (plist-get config 'prefix-keys)))
(when prefix-keys
(setq config (copy-tree config)
config (plist-put config 'prefix-keys
(mapcar (lambda (i)
(if (sequencep i)
(aref i 0)
i))
prefix-keys))))
(cons match config)))
value))))
;; FIXME: Make the following values as small as possible. ;; FIXME: Make the following values as small as possible.
(defconst exwm-manage--height-delta-min 5) (defconst exwm-manage--height-delta-min 5)