changeset 46:3d0ec6eb83fb

merge
author Jeff Hammel <k0scist@gmail.com>
date Sat, 27 Mar 2010 09:50:43 -0700
parents 069a739d88ad (diff) fc4b830a61e8 (current diff)
children a0636527f809
files python/install_config.py
diffstat 3 files changed, 65 insertions(+), 100 deletions(-) [+]
line wrap: on
line diff
--- a/.fluxbox/menu	Fri Mar 26 14:00:35 2010 -0700
+++ b/.fluxbox/menu	Sat Mar 27 09:50:43 2010 -0700
@@ -1,102 +1,21 @@
-# Generated by fluxbox-generate_menu
-#
-# If you read this it means you want to edit this file manually, so here
-# are some useful tips:
-#
-# - You can add your own menu-entries to ~/.fluxbox/usermenu
-#
-# - If you miss apps please let me know and I will add them for the next
-#   release.
-#
-# - The -r option prevents removing of empty menu entries and lines which
-#   makes things much more readable.
-#
-# - To prevent any other app from overwriting your menu
-#   you can change the menu name in .fluxbox/init to:
-#     session.menuFile: /home/you/.fluxbox/my-menu
 [begin] (Fluxbox)
-      [exec] (term) {gnome-terminal} 
-      [exec] (firefox) {firefox} </var/tmp/portage/fluxbox-0.9.15.1-r2/temp/home/.fluxbox/icons/firefox-icon.xpm>
-      [exec] (blank) {xset dpms force off}
-[submenu] (Terminals)
-      [exec]   (xterm) {xterm} 
-      [exec]   (gnome-terminal) {gnome-terminal} </var/tmp/portage/fluxbox-0.9.15.1-r2/temp/home/.fluxbox/icons/gnome-terminal.xpm>
-      [exec]   (small gterm) {gnome-terminal --window-with-profile=tterm --zoom=0.86}
+
+[include] (~/.fluxbox/applications)
+
+[submenu] (fluxbox)
+[exec] (edit init) { emacs ~/.fluxbox/init}
+[exec] (edit keys) { emacs ~/.fluxbox/keys}
+[config] (Configure) 
+[submenu] (Styles)
+ [stylesdir] (~/.fluxbox/styles)
 [end]
-[submenu] (Net)
-[submenu] (Browsers)
-      [exec]   (firefox) {firefox} </var/tmp/portage/fluxbox-0.9.15.1-r2/temp/home/.fluxbox/icons/firefox-icon.xpm>
-      [exec]   (konqueror) {konqueror}
-      [exec]   (lynx) {xterm -e lynx fluxbox.org} 
-[end]
-[submenu] (Mail)
-      [exec]   (evolution) {evolution} 
-[end]
-[submenu] (chat)
-      [exec]   (irssi) {gnome-terminal --window-with-profile=tterm --zoom=0.75 --geometry=65x17-0-18 -e irssi}
-      [exec]   (xchat) {xchat-2} 
-	[exec] (gaim) {gaim}
+[workspaces] (Workspace List) 
+[restart] (gnome-session) {gnome-session}
+[commanddialog] (Fluxbox Command) 
+[reconfig] (Reload config) 
+[restart] (Restart) 
+[exec] (About) {(fluxbox -v; fluxbox -info | sed 1d) 2> /dev/null | xmessage -file - -center} 
+[separator] 
+[exit] (Exit) 
 [end]
 [end]
-[submenu] (Editors)
-      [exec]   (emacs) {emacs}
-      [exec]   (meld)  {meld}
-      [exec]   (gedit) {gedit} 
-      [exec]   (nano) {xterm -e nano} 
-      [exec]   (vim) {xterm -e vim} 
-      [exec]   (vi) {xterm -e vi} 
-[end]
-[submenu] (Multimedia)
-  [submenu] (Graphics)
-      [exec] (gimp)     {gimp}
-      [exec] (inkscape) {inkscape}
-      [exec] (dia) {dia}
-  [end]
-  [submenu] (Audio)
-	[exec] (audacity) { audacity }
-	[exec] (xmms) { xmms }
-  [end]
-  [submenu] (Video) 
-	[exec] (gxine) { gxine }
-	[exec] (realplay) { realplay }
-  [end]
-  [exec] (amarok) { amarok }
-[end]
-[submenu] (X-utils)
-      [exec]   (xclock) {xclock}
-      [exec]   (clrscr) {clrscr | xclip -i}
-      [exec]   (xkill) {xkill}
-      [exec]   (gkrellm) {gkrellm}
-      [exec] (Reload .Xresources) {xrdb -load /home/jhammel/.Xresources}
-[end]
-[submenu] (Office)
-      [exec]   (OpenOffice) {soffice}
-      [exec]   (xclock) {xclock} 
-      [exec]   (cal)    {xterm -geometry 21x9 -T "`date +'%b %-d'`" -e 'cal; sleep 10' }
-      [exec]   (evince) {evince}
-[end]
-[submenu] (fluxbox)
-	[exec] (edit menu) { emacs ~/.fluxbox/menu}
-	[exec] (edit init) { emacs ~/.fluxbox/init}
-	[exec] (edit keys) { emacs ~/.fluxbox/keys}
-      [config] (Configure) 
-[submenu] (Styles)
-      [stylesdir] (~/.fluxbox/styles)
-[end]
-      [workspaces] (Workspace List) 
-[submenu] (Tools)
-      [exec] (Window name) {xprop WM_CLASS|cut -d \" -f 2|xmessage -file - -center} 
-      [exec] (Screenshot - JPG) {import screenshot.jpg && display -resize 50% screenshot.jpg} 
-      [exec] (Screenshot - PNG) {import screenshot.png && display -resize 50% screenshot.png} 
-[end]
-[submenu] (Window)
-      [restart] (gnome) {gnome-session} 
-[end]
-      [commanddialog] (Fluxbox Command) 
-      [reconfig] (Reload config) 
-      [restart] (Restart) 
-      [exec] (About) {(fluxbox -v; fluxbox -info | sed 1d) 2> /dev/null | xmessage -file - -center} 
-      [separator] 
-      [exit] (Exit) 
-[end]
-[end]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/python/html2flux.py	Sat Mar 27 09:50:43 2010 -0700
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+
+import sys
+from lxml import etree
+
+from lsex import lsex # local import
+executables = set([i.rsplit('/', 1)[-1] for i in lsex() ])
+
+def printmenu(dl, output, top=True):
+    
+    # XXX should do more checking
+    for child in dl.iterchildren():
+        if not top and child.tag == 'a':
+            print >> output, '[submenu] (%s)' % child.text
+        if child.tag == 'dt':
+            label = ' '.join([ i.strip() for i in child.itertext() if i.strip() ])
+        if child.tag == 'dd':
+            command = ' '.join([ i.strip() for i in child.itertext() if i.strip() ])
+            executable = command.split()[0]
+            if executable in executables:
+                print >> output, '[exec] (%s) {%s}' % (label, command)
+        if child.tag == 'dl':
+            printmenu(child, output, top=False)
+    if not top:
+        print >> output, '[end]'
+
+def main(args = sys.argv[1:]):
+
+    # setup input, output
+    if args:
+        htmlfile = file(args[0])
+    else:
+        htmlfile = sys.stdin
+    html = htmlfile.read()
+    fluxout = sys.stdout
+
+    # get first element
+    dom = etree.fromstring(html)
+    dl = dom.find('.//dl')
+
+    printmenu(dl, fluxout)
+
+if __name__ == '__main__':
+    main()
--- a/python/install_config.py	Fri Mar 26 14:00:35 2010 -0700
+++ b/python/install_config.py	Sat Mar 27 09:50:43 2010 -0700
@@ -50,9 +50,11 @@
 # install some python
 install_develop('smartopen')
 
-postinstall_commands = [ ['ln', '-s', os.path.join(HOME, 'smartopen', 'bin', 'smartopen'), os.path.join(HOME, 'bin', 'smartopen') ] ]
+postinstall_commands = [ ['ln', '-s', os.path.join(HOME, 'smartopen', 'bin', 'smartopen'), os.path.join(HOME, 'bin', 'smartopen') ],
+                         ]
+execute(*postinstall_commands)
 
-execute(*postinstall_commands)
+
 
 # TODO:
 # - ubuntu packages to install: