Skip to content

Commit

Permalink
Add a selection hook in select-from-menu.
Browse files Browse the repository at this point in the history
This lets the caller do something every time an item is selected.

A use case for this is is a "visual-pull-from-windowlist", which pulls
the selected window every time you select it.
  • Loading branch information
ralt authored and PuercoPop committed Sep 14, 2017
1 parent 88c4e90 commit 4fd7d0f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions menu.lisp
Expand Up @@ -243,6 +243,7 @@ Returns the selected element in TABLE or nil if aborted. "
(when prompt-line
(push prompt-line strings)
(incf highlight))
(run-hook-with-args *menu-selection-hook* menu)
(echo-string-list screen strings highlight))
(multiple-value-bind (action key-seq) (read-from-keymap keymap)
(if action
Expand Down
5 changes: 5 additions & 0 deletions primitives.lisp
Expand Up @@ -59,6 +59,7 @@
*pre-command-hook*
*post-command-hook*
*selection-notify-hook*
*menu-selection-hook*
*display*
*shell-program*
*maxsize-border-width*
Expand Down Expand Up @@ -328,6 +329,10 @@ the command as a symbol.")
"Called after a :selection-notify event is processed. It is called
with 1 argument: the selection as a string.")

(defvar *menu-selection-hook* '()
"Called after an item is selected in the windows menu. It is called
with 1 argument: the menu.")

;; Data types and globals used by stumpwm

(defvar *display* nil
Expand Down
1 change: 1 addition & 0 deletions stumpwm.texi.in
Expand Up @@ -2152,6 +2152,7 @@ $$$ *urgent-window-hook*
$$$ *event-processing-hook*
$$$ *pre-command-hook*
$$$ *post-command-hook*
$$$ *menu-selection-hook*

@node Modules, Hacking, Hooks, Top
@chapter Modules
Expand Down

0 comments on commit 4fd7d0f

Please sign in to comment.