You are not logged in.
Pages: 1
Hi again
after working out how to get my documents pipe menu working i made this up.
this will list all mounted filesystems and show the % space used in a pipemenu aswell as let you open it.
there are some flaws mind
it will show usb devices that have been pulled and not unmounted.
it will also not show friendly names for mount points.. so thunar might show Ipod Blah but my script will show /media/disk-1 etc
improvements and sugestions welcome
Thanks
Matthew
#!/usr/bin/python -O
import commands, os, obxml, sys
mount1=[] ###better than temp and temp1 var's
mount2=[]
#Mount point label
mountpoint = commands.getoutput('df | grep / | cut -c57-70')
#Used space
spaceused= commands.getoutput('df | grep / | cut -c51-55')
### only sys arg is the filemanger eg thunar
menu = obxml.ObMenu()
menu.newPipe()
if len(sys.argv) == 1:
menu.createItem(None, "ERROR: Wrong number of arguments:", "Execute", "true")
menu.createItem(None, "%s command" % (sys.argv[0]), "Execute", "true")
menu.printXml()
sys.exit(1)
### get spaces used from df
space = spaceused.split('\n')
for spaces in space:
mount2.append(spaces)
### get mount points from df
filenames = mountpoint.split('\n')
for filename in filenames:
mount1.append(filename)
test3 = len(mount1)
for i in range(test3):
if mount1[i] =="/dev/shm":
exit
else:
menu.createItem('dirlist', " "+ mount1[i] + " "+mount2[i]+" Used", "execute",(sys.argv[1]) +" " +mount1[i] )
menu.printXml()
"is adult entertainment killing our children or is killing our children entertaining adults?" Marilyn Manson
Offline
Pages: 1