Date: Fri, 1 Feb 2008 22:11:18 GMT From: Dmitry Klimov <lazyklimm@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/120212: some small features for x11-wm/genmenu Message-ID: <200802012211.m11MBIXu029048@www.freebsd.org> Resent-Message-ID: <200802012220.m11MK1Ro029627@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 120212 >Category: ports >Synopsis: some small features for x11-wm/genmenu >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Fri Feb 01 22:20:01 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Dmitry Klimov >Release: FreeBSD 6.3-PRERELEASE >Organization: >Environment: FreeBSD 6.3-PRERELEASE >Description: Patch adds to genmenu(small, slow, but pretty good and simple menu generator) support for urxvt(as terminal), IceWM(as window manager), and primitive "proglist" command line parameter(useful for user-defined application list). usage: %genmenu -p myproglist where proglist is like ---------------8<---begin-of-proglist--------------- terminals | aterm Eterm rxvt urxvt xterm gnome-terminal multi-gnome-terminal konsole + browsers | netscape mozilla firefox galeon skipstone konqueror dillo opera !links !lynx !w3m + ---------------8<---end-of-proglist----------------- (It has the same format as MENUITEMS variable in original script) >How-To-Repeat: >Fix: Patch attached with submission follows: --- /usr/local/bin/genmenu 2007-11-27 17:43:15.000000000 +0300 +++ genmenu 2007-11-28 12:29:00.000000000 +0300 @@ -45,15 +45,29 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# parsing input parameters +until [ -z "$1" ] +do + if [ "$1" = "-f" ] + then + if [ -f "$2" ] + then + MENUITEMS=`cat $2 | grep -v "^[[:blank:]]*#"` + fi + fi +shift +done + # ----------------------------------------------------------------------------- # Configuration # The programs to check for. Menus are generated in the order they appear here # Format: "|" = start items, "!" = run in a terminal, "+" = end submenu. - +if [ -z "$MENUITEMS" ] +then MENUITEMS=" -terminals | aterm Eterm rxvt xterm gnome-terminal multi-gnome-terminal konsole + +terminals | aterm Eterm rxvt urxvt xterm gnome-terminal multi-gnome-terminal konsole + browsers | netscape mozilla firefox galeon skipstone konqueror dillo opera !links !lynx !w3m + @@ -88,7 +102,7 @@ development | glimmer glade kdevelop designer kbabel idle ghex khexedit memprof !tclsh !python !gdb xxgdb !xev + system | gtop !top kpm bp6mon gw guname gnorpm red-carpet monkeytalk bug-buddy gnomecc gkrellm !sndconfig tksysv ksysv gnome-ppp kppp qtisdnlinux internet-config firewall-config printconf-gui +" - +fi # Shells to check for CHKSHELLS="mc sh bash ash sash csh tcsh ksh pdksh zsh" @@ -96,6 +110,7 @@ # Blackbox specific apps to check for BLACKBOX_APPS="blackbox | bbkeys bbkeysconf bbappconf toolbox whiteBOX bbrb bbmail bbsload bbppp bbdate bbws bbpager bbtime bbweather bbpal bbrun bbapm +" +ICEWM_APPS="icewm | icebgset icecc icecursorcfg iceiconcvt iceked icemc icerrun icesndcfg icets icwmcp icewoed" # FluxBox specific apps to check for FLUXBOX_APPS="fluxbox | fluxconf fluxkeys +" @@ -123,7 +138,7 @@ # Terminals to check for (note: only shown in the terminal selection list) -CHKTERMINALS="aterm Eterm rxvt xterm gnome-terminal multi-gnome-terminal konsole" +CHKTERMINALS="aterm Eterm rxvt urxvt xterm gnome-terminal multi-gnome-terminal konsole" # Screensaver command @@ -444,6 +459,10 @@ { echo " [exec] ($1) {$2}" } +ice_prog() +{ + echo " prog \"$1\" - $2" +} wm_prog() { @@ -464,6 +483,10 @@ { echo -e "$1[submenu] ($(mintospc "$2"))$3" } +ice_submenu() +{ + echo -e "$1menu \"$(mintospc "$2")\" folder "$3" {\n" +} wm_submenu() { @@ -487,6 +510,7 @@ case $WM in *box) bb_prog "$(ucfirst "$(app_translate $app)")" "$TERMINAL -e $(defaults $app)" ;; wmaker) wm_prog "$(ucfirst "$(app_translate $app)")" "$TERMINAL -e "$(defaults $app)"" ;; + icewm) ice_prog "$(ucfirst "$(app_translate $app)")" "$TERMINAL -e "$(defaults $app)"" ;; e) e_prog "$(ucfirst "$(app_translate $app)")" "$TERMINAL -e "$(defaults $app)"" >> $ECONFDIR/genmenu/${ESUBTITLE}.menu esac @@ -494,6 +518,7 @@ case $WM in *box) bb_prog "$(ucfirst "$(app_translate $app)")" "$(defaults $app)" ;; wmaker) wm_prog "$(ucfirst "$(app_translate $app)")" "$(defaults $app)" ;; + icewm) ice_prog "$(ucfirst "$(app_translate $app)")" "$(defaults $app)" ;; e) e_prog "$(ucfirst "$(app_translate $app)")" "$(defaults $app)" >> $ECONFDIR/genmenu/${ESUBTITLE}.menu esac fi @@ -509,6 +534,7 @@ case $WM in *box) bb_submenu " " "Applications" "\n" ;; + icewm) ice_submenu " " "Applications" "\n" ;; wmaker) wm_submenu " (\"Applications\"," "\n" ;; e) e_submenu "Applications" "\n" > $ECONFDIR/genmenu.menu esac @@ -530,6 +556,7 @@ if [ "$sublock" = "0" ]; then case $WM in *box) bb_submenu " " "$(ucfirst $item)" ;; + icewm) ice_submenu " " "$(ucfirst $item)" ;; *) if [ "$WM" = "wmaker" -a "$item" != "-" ]; then wm_submenu " (\"$(ucfirst $item)\"," "\n" @@ -549,6 +576,7 @@ if [ "$item" = "+" ]; then case $WM in *box) echo -e " [end]\n" ;; + icewm) echo -e " }\n" ;; wmaker) if [ "$item" = "+" -a "$item_nr" -lt "$(($NR_MENUITEMS - 1))" ]; then echo -ne "\n ),\n" @@ -564,7 +592,8 @@ done case $WM in - *box) echo -e " [end]\n" + *box) echo -e " [end]\n";; + icewm) echo -e " }\n" esac } @@ -677,7 +706,17 @@ echo -e " [end]\n" } - +ice_others() +{ + local thiswm + echo " menu \"Others\" folder {" + for thiswm in $WINDOWMANAGERS; do + if [ "$thiswm" != "$1" ]; then + findprog $thiswm && echo " restart \"$(ucfirst "$(wm_translate $thiswm)")\" - $thiswm" + fi + done + echo -e "}\n" +} wm_restart () { echo " (\"Restart\", RESTART)," @@ -758,7 +797,14 @@ fi bb_exit } +ice_writemenu() +{ + programs + if [ "$DOOTHERS" = "1" ]; then + ice_others $WM + fi +} wm_writemenu() { wm_begin @@ -827,6 +873,27 @@ rm -f ${bbrc}.tmp } +ice_interactive() +{ + local wmrc menu + + ICECONFDIR="$HOME/.icewm" + menu="$HOME/.icewm/menu" + + if [ ! -d "$ICECONFDIR" ]; then + echo -e "\nUnable to find $ICECONFDIR, please run IceWM to generate it!\n" + exit 1 + fi + + if [ -e "$menu" ]; then + yesno "$menu does already exist. Overwrite?" || exit 1 + fi + + echo -e "\nWriting IceWM menu\n" + ice_writemenu >$menu + echo +} + wm_interactive() { local wmrc menu @@ -949,6 +1016,16 @@ wm_interactive } } + findprog icewm && { + yesno "Generate IceWM menu?" && { + WM="icewm" + MENUITEMS="$tmp_menuitems" + realmenu + # need to know when it ends for the nasty proplist format + count_menuitems + ice_interactive + } + } findprog enlightenment && { yesno "Generate Enlightenment menu?" && { >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802012211.m11MBIXu029048>