udiskie is a front-end for UDisks written in python. Its main purpose is automatically mounting removable media, such as CDs or flash drives. It has optional mount notifications, a GTK tray icon and user level CLIs for manual mount and unmount operations. The media will be mounted in a new directory under /media
or /run/media/USER/
, using the device name if possible.
Start the automount and notification daemon and show a system tray icon:
udiskie --tray
Mount or unlock a specific device manually:
udiskie-mount /dev/sdb1
Unmount or remove a specific device manually:
udiskie-umount /media/<device-name>
# or with udisks2
udiskie-umount -2 /run/media/<user>/<device>
See the man page for further instructions
benefit from others' work
- udiskie may be in your distribution's official repositories
- check out the wiki for guidance
If neither of this helps, here are some general hints:
install dependencies:
Required:
- setuptools
- PyGObject
- UDisks (UDisks1 or UDisks2)
- GTK3 (+introspection). GTK2 also works if not using the tray icon.
- docopt (can automatically be installed by pip)
Optional:
- libnotify (+introspection)
- the notification daemon of your choice
- gettext to build translation files (during setup step)
- PyYAML for config file (can automatically be installed by pip)
Access to system resources is mediated using PyGObject, which is why some packages need to be built with +introspection. Check the contents of the folder
/usr/lib/girepository-1.0/
(or similar). There should be the following typelibs:- Gio-2.0
- GLib-2.0
- GObject-2.0
- Gtk-3.0
- Notify-0.7
If you installed the above dependencies, but some of the typelibs are missing they might be distributed in separate packages. Note that the version numbers just indicate what udiskie is tested with, but it may work with other versions as well.
use pip to download and install udiskie itself:
# from PyPI: pip install udiskie # from a local checkout: pip install .
- go back to the wiki and edit. ;)
udiskie requires permission for some polkit actions which are usually granted when using a desktop environment. If your login session is not properly activated you may need to customize your polkit settings. Create the file /etc/polkit-1/rules.d/50-udiskie.rules
with the following contents:
polkit.addRule(function(action, subject) {
var YES = polkit.Result.YES;
var permission = {
// required for udisks1:
"org.freedesktop.udisks.filesystem-mount": YES,
"org.freedesktop.udisks.luks-unlock": YES,
"org.freedesktop.udisks.drive-eject": YES,
"org.freedesktop.udisks.drive-detach": YES,
// required for udisks2:
"org.freedesktop.udisks2.filesystem-mount": YES,
"org.freedesktop.udisks2.encrypted-unlock": YES,
"org.freedesktop.udisks2.eject-media": YES,
"org.freedesktop.udisks2.power-off-drive": YES
};
if (subject.isInGroup("storage")) {
return permission[action.id];
}
});
This configuration allows all members of the storage group to run udiskie.
udiskie comes with a set of themeable custom Tango-style GTK icons for its tray icon menu. The installer tries to install the icons into GTK's default hicolor theme. Typically this is located in /usr/share/icons/hicolor
. If you have any problems with this or you need a custom path you can manually do it like so:
cp ./icons/scalable /usr/share/icons/hicolor -r
gtk-update-icon-cache /usr/share/icons/hicolor
When doing a local installation, for example in a virtualenv, you can manually change the installation prefix for the icon data files like so:
python setup.py install --install-data ~/.local
The icons roughly follow the Tango style guidelines. Some icons incorporate the CDROM icon of the base icon theme of the Tango desktop project (released into the public domain).
udiskie is developed on github. Feel free to contribute patches as pull requests here.
Try to be consistent with the PEP8 guidelines. Add unit tests for all non-trivial functionality if possible. Dependency injection is a great pattern to keep modules flexible and testable.
Commits should be reversible, independent units if possible. Use descriptive titles and also add an explaining commit message unless the modification is trivial. See also: A Note About Git Commit Messages.
Further resources:
You can use the github issues to report any issues you encounter, ask general questions or suggest new features. There is also a public mailing list on sourceforge if you prefer email.