site  contact  subhomenews

Enhanced desktop drive icons

July 21, 2011 — BarryK
This is something that I have wanted to do for a long time. I always diligently unmount partitions by right-click on a desktop drive icon then choose to unmount from the popup menu. Sometimes however, the right-click doesn't get interpreted as a right-click, due to mouse movement, and it gets interpreted as a left-click or I have even had the icon disappear. Besides, it would be nice to eliminate having to do it via a popup menu.

Now, I have eliminated the need for the right-click menu. A simple left-click can unmount a partition. this snapshot shows what mounted icons look like:

There is no longer any need for icon themes to have the sets of drive icons representing mounted and unmounted, for example 'drive48.png', 'drive_mnt48.png' and 'drive_mnt_boot48.png'.
Now, all that is needed is 'drive48.png' and the other two are autogenerated using a modified form of Vovchik's PNG overlay utility, named 'pngoverlay', see previous post:

This requires two template images, /usr/local/lib/X11/pixmaps/closebox_outline48.png and /usr/local/lib/X11/pixmpas/locked_outline48.png. These latter two images can also be included in a desktop icon theme if it is desired to overwrite the defaults in /usr/local/lib/X11/pixmaps.
'pngoverlay' now generates 'drive_mnt48.png' and 'drive_mnt_boot48.png'.

To achieve the above, the scripts /usr/sbin/icon_switcher and /usr/sbin/icon_switcher_cli were modified.

Now that there is a little "close box" on the icon, if the mouse-pointer position is determined when a left-click is made on a desktop icon, it is then possible to perform an unmount.
This is what is done, using the 'getcurpos' utility. The script /usr/local/bin/drive_all has been modified to run 'getcurpos' and detect if there was a click in the "close box".

All of the above depends on the existence of /usr/local/lib/X11/pixmaps/closebox_outline48.png and /usr/sbin/pngoverlay. If either are missing, then there is a fallback to previous behaviour (not supporting the "close box", and the 'drive_mnt48.png' and 'drive_mnt_boot48.png' images will be required in a theme).

This is in Woof, will be uploaded very soon.


Right-click still drops icon
Username: gjuhasz
Barry, this is a nice solution for drive icons, but right-clicking on another icon in this row can still accidentally delete it due to the unfortunate positioning of "Remove item(s)" feature in ROX menu. The only solution is moving this Remove menu point from the main menu to a sub-menu. This way the second "click" (that arrives unintentionally from the mouse hardware) will not find the cursor over the Remove item(s) menu point. My workaround was moving the drive icons a few pixels upwards (I configured ICON_PLACE_EDGE_GAP=96 in /etc/eventmanager)

themes page update
Username: BarryK
"I have updated the Puppy themes page:

Open ROX window when USB drive inserted
Username: Terryphi
"Here is a feature I would like to see in Puppy as default action: Automatically open a ROX window for a newly inserted USB drive.

Enhanced desktop drive icons
Username: ttuuxxx
"Hi Barry I was wondering if you could package this up so I could add it to 2.14X :) I've always hated it when it would delete my icons and I would have to restartX to get them back :) Excellent job on fixing this :) ttuuxxx

Another item
Username: PaulBx1
""Automatically open a ROX window" That would require automatically mounting. I'd rather we don't do that. I like manual mounts. Makes me feel like I'm more in control. :) One thing that has bothered me is when unmounting a flash drive, for example after copying a large file to it, the drive icon goes "unmounted" where you can still see transfers going on to the drive (via the drive light flashing). If you pulled the drive out using the icon as the unmounted indicator, you could corrupt the data. I'm guessing the icon changes to "unmounted" when the command is issued, rather when it is completed. At least last time I looked, the behavior was like that.

unmount solution
Username: 8-bit
"I am with PaulBx1 on the copying while unmounting is going on. How about just adding a sync command that would complete before the flash drive was shown as unmounted. I have sometimes opened a terminal and typed "sync" and waited for the process to complete before unmounting a drive to be sure any copying of a file was completed.

Auto mount
Username: BarryK
"Terryphi, I think that we already have that feature, selectable in the EventManager. Paulbx1, 8-bit, There is a 'sync' after the 'umount' command, then the icon changes to the unmounted state. However, yes, there is still activity, as indicated by the LED in the USB drive.

Unmount delay
Username: BarryK
"I have put a "sleep 1" into function 'icon_unmounted_func' in file /etc/rc.d/functions4puppy4. Note, this function is called from /sbin/pup_event_frontend_d. So, when a drive is unmounted, there will be an extra one second delay before Rox updates the desktop drive icon to the unmounted status.

Managing Drive Icons
Username: CLAM01
"I add my voice to giuhasz' in regard to the problematic position of the "remove item" option in the right-click menu, and second his suggestion to put the "remove" option in a sub-menu. The "remove" option would fit in the "app dir" sub-menu, I think. One could slow mouse double-click response I suppose... The other two options that are sometimes accidentally selected by an auto-double-click are "edit item" and "show location", which pop up a box and a Rox respectively, both less shocking than the icon disappearing (when it's good to have the right-click pmount option). I also add my vote against auto-mounting of other than /home drives. Being paranoid I would like a means to easily unset (and set) unused drives, to have them not appear, in icons or pmount, unless one wanted all or one. A potential problem I see with left-click mount and left-click-again unmount would come when one had a drive mounted with a filer window open on one virtual desktop and wanted to open another filer on another virtual desktop. The usual is to change virtual desktops and left click the mounted drive icon to open a filer window there. The 'second' left-click unmounting the drive could leave an application on the first virtual desktop with unsaved work, perhaps trying to do an auto-save to an unmounted non-/home drive. Hopefully the app would be unclosable, rather than able to write to nowhere, then close. I also agree with PaulBx1 and 8-bit that a "wait-til-I-finish" warning and then "OK-to-remove" umount sequence would be good for physically removable drives.

Lucid Puppy 5.2.6
Username: bigpup
"Barry, Lucid Puppy 5.2.5 is being updated and bug fixed. There has been requests to have this put into the update. Could you please provide what is needed to Playdayz?

pngoverlay problem
Username: BarryK
"Oh, I had modified vovchik's png overlay utility so that it does not open a window, however, it still won't run if X is not running. icon_switch_cli is being called before X starts. I have had to implement a (hopefully temporary) hack, call pngoverlay from with /usr/sbin/delayedrun, which is after X has started. I was up most of the night trying to do the same as pngoverlay using the netpbm utilities. Gave up, sent an email to Bryan, the netpbm maintainer, asking about some things that puzzle me.

Tags: woof