Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
 

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: UCI menu, for dmenu or wmiimenu< Next Oldest | Next Newest >
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Aug. 14 2006,19:23 QUOTE

I've been playing with dwm quite a lot the last couple of weeks, and enjoying it much. The dmenu utility (a stripped-down version of wmiimenu) is very cool when mixed with a little scripting.

This is a little script that will list *.uci files using dmenu or wmiimenu (included with wmii.uci), and run mydsl-load on the selected item.  If it's already mounted it will be listed with "(M)".

It could easily be extended to use other types of extensions, but since I use *.uci 99.94% of the time I didn't bother =o)

Code Sample
#!/bin/bash

cd $HOME/mydsl/optional #change to location of *.uci files

for i in *.uci; do
grep -q "\/$i " /etc/mtab
[ "$?" == "0" ] && i="${i}(M)"
[ -n "$UCI_LIST" ] &&  UCI_LIST="$UCI_LIST,$i" ||  UCI_LIST="$i" #this check might be unnecessary
done

UCI_FILE=`echo "$UCI_LIST" | tr ',' '\n' | dmenu` #or wmiimenu
[ -n "$UCI_FILE" ] && mydsl-load ${UCI_FILE%(M)}


EDIT: updated dwm link.
NOTE: dmenu has recently been added to the myDSL repository. The package includes a heavily tweaked (and improved, imo) version of this script.


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Aug. 14 2006,20:46 QUOTE

Minor tweaks....
Code Sample
#!/bin/bash

cd $HOME/mydsl/optional
for i in *.uci; do
grep -q "\/$i " /etc/mtab
[ "$?" == "0" ] && i="${i}(M)"
UCI_LIST=`echo -e "$UCI_LIST\n$i"`
done

UCI_FILE=`echo "$UCI_LIST" | grep -v ^$ | dmenu`
[ -n "$UCI_FILE" ] && mydsl-load ${UCI_FILE%(M)}

grep -v ^$ removes the initial blank line...not vital, but looks cleaner.  I'm hoping to  set the UCI_LIST variable so the blank isn't there to begin with, but only if I can do it while keeping commands and bytes to a minimum.


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
1 replies since Aug. 14 2006,19:23 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

 
reply to topic new topic new poll
Quick Reply: UCI menu

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code