Re: FVWM: Script output into menu

From: Mikko Heiskanen <mikko_at_whitecortex.net>
Date: Tue, 15 Feb 2005 22:00:44 +0200

On Mon, 2005-02-14 at 10:26, Frank Gruellich wrote:
> You miss PipeRead. You start the script and its output is send to
> stdout of fvwm (check the console you ran fvwm from or tail -f your
> ~/.xsession-errors). If you want fvwm to read your output you should
> use PipeRead.
Thanks! Now it is working.
I decided to share this with the list as at least FreeBSD users could
benefit from it nicely (Maybe gentoo users, too?).

AddToFunc makedeinstallmenu
+ I DestroyMenu Recreate deinstallmenu
+ I AddToMenu deinstallmenu
+ I PipeRead 'for i in $(pkg_info -a -o -q|sort); \
do echo "+ %mini.file.xpm%\"$i\" Exec cd /usr/ports/$i; \
    $[TER] -T \'Deinstalling $i\' -e make deinstall"; done'

DestroyMenu deinstallmenu
AddToMenu deinstallmenu
+ DynamicPopupAction makedeinstallmenu

addtomenu management
+ "deinstall" Popup deinstallmenu

A couple of thoughts: ports-tree could be located somewhere else than
/usr/ports; but /usr/ports is the default on free- & openbsd.
If one has lot of programs installed, the menu could be quite long. I'm
open to ideas how to make ports-tree categories as submenus of installed
programs.
Why I used cd /port; make deinstall, and not pkg_delete or something
else? Because of the nifty "changing to root credentials" which is only
available in this method.

About the subtree-idea: a friend of mine gathered the following external
script:
#!/bin/sh

category=""

for line in $(pkg_info -a -o -q|sort); do
  curcat=$(echo $line | awk -F '/' '{ print $1 }')
  app=$(echo $line | awk -F '/' '{ print $2 }')
  
  if [ "$curcat" != "$category" ]; then
    echo "AddToMenu deinstallmenu"
    echo "+ %some.icon%\"$curcat\" Popup $curcat"
    echo "AddToMenu $curcat"
    category=$curcat
  fi
  if [ -n "$app" ]; then
    echo "+ %some.icon%\"$app\" Exec $app"
  fi
done

However, it gets generated multiple times for some odd reason.
If one moves mouse all the time during the execution, then it is created
only once like it should. But if one just waits for menu popup, it gets
generated multiple times. Also, naturally, the execution time is
somewhat longer.

More info about the ports-tree: http://www.freebsd.org/ports
Example output of pkg_info -q -o -a|sort:
archivers/zip
archivers/zoo
www/mozilla
www/netscape

Mikko
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_fvwm.org.
To report problems, send mail to fvwm-owner_at_fvwm.org.
Received on Tue Feb 15 2005 - 14:01:25 GMT

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:57 BST