stumpwm.stumpwm-contrib/util/app-menu/README.org
2019-11-26 15:49:42 -08:00

52 lines
1.3 KiB
Org Mode

#+TITLE: Application menu for StumpWM
[[./menu-inaction.png]]
* Usage
#+BEGIN_SRC lisp
(load-module "app-menu")
#+END_SRC
Define =app-menu:*app-menu*= in your =.stumpwmrc=. You can use strings
to run shell commands or symbols to run Stumpwm commands
(e.g. to popup existing application instead of start new one
if applcation is already running).
#+BEGIN_SRC lisp
(defcommand firefox () ()
"run firefox"
(run-or-raise "firefox" '(:class "Firefox")))
(setq app-menu:*app-menu*
'(("INTERNET"
;; submenu
("Firefox" firefox) ; call stumpwm command
("Skype" "skypeforlinux") ; run shell script
)
("WORK"
("OpenOffice.org" "openoffice"))
("GRAPHICS"
("GIMP" "gimp")
("Inkscape" "inkscape"))
("urxvt" urxvt)
("K3B" "k3b")))
#+END_SRC
Menus can also be loaded from files:
#+BEGIN_SRC lisp
# Run (app-menu-load-menu-file #P"file") to load in this file.
("INTERNET"
;; submenu
("Firefox" firefox)
("Skype" "skypeforlinux"))
#+END_SRC
Add =show-menu= command to your keybindings, e.g.:
#+BEGIN_SRC lisp
(define-key *top-map* (kbd "M-`") "show-menu")
#+END_SRC
Navigate the menu with =C-n=, =C-p=, or just start typing to jump to a matching
item.