#!/usr/sbin/install-menu # -*- mode: shell-script; -*- # # Menu generator script for the SCWM Window Manager # written by Francesco Tapparo # This gets installed into /etc/X11/scwm/scwm_menus on Debian GNU/Linux systems # The version of the menu package that can process this. compat="menu-1" # for local preferences, so that system managers can override title(), # icon(), and maybe later more. Note that to use that in this file, # one has to use title(), and _not_ $title etc. !include menu.h ####################################################### ############## HELPERS FUNCTIONS ###################### ####################################################### # return the scheme function executing directly the executable function call($executable)="(lambda () (execute \"" $executable "\"))" # return the scheme function executing the executable from an xterm function term-call($executable)="(lambda () (execute "\ "\"" esc(term(),"\"") "\"))" # return the scheme function calling a new window manager function call-wm($wman)="(lambda () (restart \"" $wman "\"))" # return the option to specify an icon function icon-option($icon-file)="#:image-left \"" \ $icon-file "\"\n" # return the menu entry executing the scheme command $scheme-command function scwm-menuentry($scheme-command) = \ " (menuitem \"" escfirst(title(),$hotkey,"&") "\"\n" \ ifnempty(icon()," " icon-option(icon())) \ " #:action " $scheme-command ")\n" ############################################# ############# MAIN SECTION ################## ############################################# # Name of the file which scwm will read the menus from genmenu="scwm_menus" # Where the system wide generated file is placed. rootprefix="/etc/X11/scwm/" # Where the user wide generated file is placed userprefix=".scwm" # Title of the top level menu that is made. mainmenutitle="Debian-list" # Some text to go at the top of the autogenerated file. preoutput=";;; Automatically generated scwm file.\n;;; Do not edit\n\n" # In what order we output the menus. treewalk="c(m)" # What keys are not allowed as hotkeys hotkeyexclude=" " # How to start a new menu in the rc file. startmenu="(define " $section "-list \n"\ " (list \n" # how to end a new menu endmenu="))\n" \ "(define " $section "\n"\ " (menu (append (list (menuitem \"" title() "\" #f)) \n"\ " (list menu-separator)\n"\ " " $section "-list)))\n\n\n\n"\ # how to add a submenu to a menu. # Notice that thanks to cpp and some #defines, the submenu is only added if # the submenu actually contains menu entries. submenutitle=scwm-menuentry($section) # The supported display types, in order of preference. supported x11= scwm-menuentry(call($command)) wm = scwm-menuentry(call-wm($command)) vc= scwm-menuentry(call($command)) text=scwm-menuentry(term-call($command)) endsupported