I have very heavily modified Pmount, my drive mounter GUI application. I decided to go for a tabbed interface, as I wanted to pass a parameter to pmount, say for the CD drive, and have Pmount startup with that tab on top. For example, if there is a pup_dock CD icon in the tray, if I click on it I want Pmount to open with the CD tab on top.
Ditto if I plugin a USB drive, if Pmount is running, I want it to automatically refresh, but also show the USB tab on top.
These are the components that make all of this work:
This is a C program that reads kernel uevents for drives being inserted and removed, and prints to stdout.
This is a shell script that receives the uevents via hotplug2stdout and processes them. If a drive is plugged in, an icon is created in the JWM tray. If Pmount is currently running, it is refreshed. If a drive is unplugged, its icon will disappear from the tray and if Pmount is running it is refreshed.
This is the dockapp that shows icons in the tray. The pup_eventd script calls pup_dock to create and destroy icons in the tray.
I currently have only a maximum of four icons, for the categories of USB, CD/DVD, memory-card and diskette. If a USB drive is plugged in, then a USB-icon will be in the tray, and clicking on it opens Pmount (with USB tab on top).
Note, I upgraded /usr/sbin/probedisk script to work better with the above utilities.
There are still some lose ends. I don't yet know of a low-resource way to monitor if a CD/DVD disc is inserted or removed.
Thanks to Everitt for the input to hotplug2stdout and for a good suggestion how to monitor mounting and unmounting.
Hmm, it's 3.10am, time to turn this computer off.
Comments:Posted on 11 May 2008, 9:22 by kirk
Unfortunately Icewm and OpenBox (actually LxPanel) can't swallow apps into the tray. Just GTK2 eggtray apps work with those.
I prefer JWM , but I find my self using other window managers because of the full screen bug with JWM. The full screen problems with Gxine and Flash are a JWM bug. Not a problem when using Icewm or OpenBox. This was reported on the JWM mailing list a few months ago, I think by HairyWill. Still a problem with the CVS version as of last week.
Anyway maybe it would be more effective if you would send Joe an email about this. Though I haven't saw much activity with the JWM project, hope it's not dead.
Posted on 11 May 2008, 11:30 by BarryK
I sent bug reports to Joe back when I was testing MPlayer ...about 5 months ago. No reaction. Joe seems to have taken a break from the project. I do hope he gets interested in it again.
Um, so you can't create an Xlib-only egg-tray app? -- or is that a contradiction in terms?
Posted on 11 May 2008, 20:05 by prehistoric1
polling, trays, JWM and Icewm
Perhaps I missed it, Barry, but did you end up having to poll to tell if partitions were mounted, or is this all interrupt/signal driven?
Really too bad about Joe and the full-screen bug. That is the major reason I stopped fighting Icewm on Chihuahua. (I don't use full screen much, but it mattered to others.) We now have some nasty concurrency problems which almost never show up on fast machines, because the probability of hitting a critical section just right is low. When they do show up I either can't see what's going on or can't use the keyboard.
There's nothing wrong with polling, as long as everything uses the same loop. Right now there are several system monitor applications in Chihuahua which do their own polling. Just sticking them in trays is begging for wm concurrecy problems. Add the concurrency of HotPup and this is a mess to debug.
I have worked with simulator and real-time control problems enough to be hypersensitive to variations in latency. The snappy response of JWM, bringing up the main menu in a flash, even on slow machines, was a breath of fresh air. I intend to experiment with some tweaks to Icewm to get the same performance from it - after I've succeeded in finding those nondeterministic bugs. I thought we had reduced them to tolerable levels, until I did an installation which changed some timings. Now, I'm determined to make the problems as bad as possible to root them out.
You're on the right track, Barry. This is the right way to handle mount/unmount.
Posted on 12 May 2008, 10:02 by Jesse
mut2 for nice handling
I emailed you an updated mut2 with built in app 'mediaplug', is that the nice sort of handling that you're looking for?