I wonder if there's a way to create custom pcmanfm action for ejecting usb-drive in lubuntu? I've tried to do this with udisksctl but the --object-path
option is giving me this error:
(udisksctl unmount:10926): GLib-GIO-CRITICAL **: g_dbus_object_manager_get_object: assertion 'g_variant_is_object_path (object_path)' failed
Error looking up object with path /media/user/Flash-Drive
And there's no difference of MIME-types between simple folder and mounted drive so "Eject" action is shown on all folders.
Update
Well, it's seems I've found some kind of solution. This is will unmount and power-off your usb-drive
[Desktop Entry]
Type=Action
Tooltip=Eject selected flash drive
Name=Eject flash drive
Profiles=profile-zero;
Icon=media-eject
[X-Action-Profile profile-zero]
MimeTypes=inode/directory;
Exec=gksudo eject %f
Name=Default profile
Also you can use it without gksudo prompt after adding setuid
to /usr/bin/eject
:
[Desktop Entry]
Type=Action
Tooltip=Eject selected flash drive
Name=Eject flash drive
Profiles=profile-zero;
Icon=media-eject
[X-Action-Profile profile-zero]
MimeTypes=inode/directory;
Exec=eject %f
Name=Default profile
But this action will be shown on all folders. I still have no idea how to make a difference between usb-drive directory and flash-drive directory. I've seen specification Basenames
for .desktop entry which specifies selected file-name (used in empty trash action) so may be there some way to specify file-placement?
Update 2
Okay, I've found appropriate MIME-type according to MIME-info Database - inode/mount-point
, but now action isn't shown on any directory at all. What may cause a problem?
[Desktop Entry]
Type=Action
Tooltip=Eject selected drive
Name=Eject drive
Profiles=profile-zero;
Icon=media-eject
[X-Action-Profile profile-zero]
MimeTypes=inode/mount-point
Exec=eject %f
Name=Default profile
/media/user/Flash-Drive
/media/YOURUSERNAME/USBNAME
You have to replaceuser
andFlash-Drive
with the correct names.