Menu

Menu reference

Thomas Luebking

Custom <xml> menu</xml>

The global menu supports a customizable menu, found in ~/.kde/share/apps/be.shell/MainMenu.xml.
The structure is:

<menubar>
    <menu [label|menu]="???">
        [<menu [label|menu]="???" [preExec="???"] [preExecTimeout="nnn"]/>]
        [<action label="???" [exec|dbus]="???"/>]
        [<separator/>]
    </menu>
</menubar>

It's nearly the same code as in XBar (which was ported from BE::Shell)

The first node is always "\<menubar>"
To add a menu entry, add a "\<menu>" node, this will add a popup menu.

It's attributes can be either

  • menu
    A reference to another xml file, following this very same structure (i.e. "inherit" another file)
    The path is relative to ~/.kde/share/apps/be.shell/ and an ".xml" suffix is applied automatically, eg. "subpath/submenu" turns to "~/.kde/share/apps/be.shell/subpath/submenu.xml"
  • label
    A label for the popup entry, defined in the following subnodes
  • windowlist
    Adds a window list, generated by BE::Shell
  • BE::Config
    Adds the BE::Shell config menu (the one you get by rightclicking on the Desktop)
  • preExec ("menu=subpath/submenu" only!)
    An executable to be run before the menu pops up (usually a script writing the menu definition) Needs to be an absolute path, no bash aliases either
  • preExecTimeout (defaults to "250", "menu=subpath/submenu" only!)
    The maximum amount of time in ms to allow the preExec command to block the GUI before it's cancelled.

The actual popup menu entries can be subnodes

  • \<menu>
    Yet another submenu

  • \<action>
    An active item, that actually triggers sth., can also be put directly into the \<menubar> node, though this is rather uncommon.

    It's attributes can be either

    • label

      A label for the entry, overriding that in any given service
    • icon

      An icon for the entry, overriding that in any given service
    • dbus

      A dbus call, separate by semicolons.
      \<bus>;\<service>;\<path>;\<interface>;\<method>[;\<parameter_1>[;\<parameter_2>[;...]]]
    • exec
      either a service name or an executable, or a path, or ... basically anything you can type into krunner or konqueror, ie. "gg:KDE" will google for KDE!
      If this is a service, it's label and icon can be overridden by the related attributes
  • \<separator>

    Yeah... guess what that might be.

Example

<menubar>
<menu menu="MainMenu/kate"/>
<menu label="Desktop">
    <action label="XTerm" exec="xterm"/>
    <action label="Toggle FX" dbus="session;org.kde.kwin;/KWin;org.kde.KWin;toggleCompositing"/>
    <separator/>
    <action label="Run Conky" exec="conky -c $HOME/.conky/mytop.conf"/>
    <action label="Quit Conky" exec="killall conky"/>
</menu>
<action label="Edit Menu" exec="kwrite $HOME/.kde/share/apps/be.shell/MainMenu.xml"/>
</menubar>

MongoDB Logo MongoDB