Home > Default > Udisksvm GUI UDisks wrapper without writing udev rules

Udisksvm GUI UDisks wrapper without writing udev rules

November 30Hits:0
Advertisement
The scripts udisksvm and traydvm are now written in python and use the gobject introspection approach.
Here is the link in AUR:
https://aur.archlinux.org/packages/udisksvm/
Here is the README content for explanations:
The 'udisksvm' and 'traydvm' scripts operate between udisks2 and a window
manager with a mouse and a system tray available. They listen to events and act
accordingly with removable media.
The 'traydvm' GUI utility displays a systray icon showing a plugged-in device,
with a right-click menu to perform actions on it.
The icon represents a file system/partition on the disk; so if there are
several partitions, there are one icon for each file system on them.
With a MBR partition table, only primary partitions are managed presently.
udisks2------>udisksvm----------->traydvm--------->systray icon
| |
| |
V V
(automounting) right-click menu
(non optical disks only) |
|
V
commands to device media
|
|
V
notification
The automounting feature is disabled by default.
It can be enabled for non-optical disks with the '-a', '--auto' command line
option.
The old '-n', '--noauto' option is still recognized but not used anymore.
A notification pops up after a 'Mount' or 'Unmount' action by the right-click
menu.
This feature is enabled by default, and can be disabled by the '-s',
'--silent' command line option.
In its present form there are only three actions : 'Mount', 'Unmount', 'Eject'
The 'Mount' action operates on data optical disks, and on block devices with
plain partitions, ie not a container of other partitions or not contained in
another partition.
The 'Eject' action is only activated for an unmounted optical disk.
And only one CD/DVD drive at /dev/sr0 is considered.
The tooltip when the mouse pointer hovers over the icon gives the device name,
the label or the UUID and the state of the device, with the mountpoint, normally
in /run/media/<user_name>, where the mounted media can be accessed in a file
manager.
The 'traydvm' utility has no configuration file: the popup menu and the actions
are predefined in the script.
The 'udisksvm' and 'traydvm' scripts use the UDisks2 DBus API.
If used in a systemd configuration (default in Arch Linux) they also need to
be ran in an active systemd-logind session:
loginctl show-session $XDG_SESSION_ID
should have a line with 'Active=yes'
For example, in Openbox and Tint2 with systray enabled, only add this line in
$HOME/.config/openbox/autostart to launch udisksvm with default options and
without text output:
udisksvm >/dev/null &
To see output and errors from the script, run it in a console without the
redirection to /dev/null;
for more verbosity, run it with the '-d' or '--debug' option.
The file system types and mount options are controlled by UDisks2.
UDisks2 is rather restrictive presently:
'flush' is available for 'vfat' file system,
'sync' for 'ext2' file system.
These options are included in the scripts.
The traydvm script ignores all changes made to partitions or file
system types or label, while it is running; if such changes are made
on a device, while traydvm is running on it, the device has first to be
plugged out/in to re-launch traydvm on it.
These scripts can be extended to develop a more complete management of
removable media in a GUI oriented approach.
But they can simply be used as is, to automount, unmount or re-mount a USB
memory stick or an external disk, or for accessing data on optical CD/DVD
disks, only with mouse clicks.
They can also be used to only show system tray icons, with other tools to do
automounting or manual mounting/unmounting.
Edit for up to date infos with the 2.3.0 release.
See also other comments at the #58 post
Last edited by berbae (2013-12-18 15:20:57)

Answers

alleyoopster wrote:Is there a way of having the device volume label or the mount path reflected in the icons tooltips rather than the unhelpful uuid currently displayed?
The "DeviceMountPaths" property is an array of strings rather than a single string.
So if I use in default.xml :
<tooltip executable="/bin/echo">
<arg>-n</arg>
<ref>DeviceMountPaths</ref>
</tooltip>
I get a wrong format of text.
Initially I used a script named "echo-mount" instead of "/bin/echo" to reformat the output of the string array:
#!/bin/bash
# echo-mount script
MOUNTPATH=$(echo $1 |cut -d \' -f 2)
echo -n $MOUNTPATH
That gives something like /dev/sdb1 as tooltip text.
But I removed that to have something simpler.
Concerning the "IdLabel" property, it is not always there; if no label is set, the string is empty.
So I chose to use the "IdUuid" property which should be always available and is a single string.
It seemed easier to use and it is also the name of the folder in /media where udisks mounts the device.
But the default.xml configuration file could surely be modified to show the Label when it is available, something like :
<icon icon="gtk.STOCK_HARDDISK">
<displayed_if>
<and>
<match key="DeviceIsPartition" bool="true"/>
<match key="DeviceIsMounted" bool="true"/>
<not>
<match key="IdLabel" string=""/>
</not>
</and>
</displayed_if>
<!--
Tooltip text is "IdLabel" when it is mounted with a label.
-->
<tooltip executable="/bin/echo">
<arg>-n</arg>
<ref>IdLabel</ref>
</tooltip>
</icon>
<icon icon="gtk.STOCK_HARDDISK">
<displayed_if>
<and>
<match key="DeviceIsPartition" bool="true"/>
<match key="DeviceIsMounted" bool="true"/>
<match key="IdLabel" string=""/>
</and>
</displayed_if>
<!--
Tooltip text is "IdUuid" when it is mounted without a label
-->
<tooltip executable="/bin/echo">
<arg>-n</arg>
<ref>IdUuid</ref>
</tooltip>
</icon>
I didn't test it yet on my machine.
But if you test it, can you tell me please if it works as expected ?
So I could incoporate the change more quickly in the AUR package.
Thanks for your contribution.
Last edited by berbae (2011-05-14 15:46:53)

Read other 25 answers

Tags:

Related Articles

  • Udisksvm GUI UDisks wrapper without writing udev rulesNovember 30

    The scripts udisksvm and traydvm are now written in python and use the gobject introspection approach. Here is the link in AUR: https://aur.archlinux.org/packages/udisksvm/ Here is the README content for explanations: The 'udisksvm' and 'traydvm' scr

  • Writing udev rules [SOLVED]November 30

    Hi guys. I'm on a mission to run win7 on QEMU, and I also want to be able to use my USB-ports. Now, archwiki tells me to do this: $ qemu-system-i386 -usbdevice host:vendor_id:product_id disk_image You can find vendor_id and product_id of your device

  • My /etc/udev/rules.d is empty? [SOLVED]November 30

    The other week i installed a virtal inviroment in QEMU, i read a little bit about writing udev-rules, in order to work with USB. but for some reason.. the folder in mentioned in the topic happends to be empty.. and it just strikes me, because when go

  • [Solved] Auto-open a file manager after mounting with udev rulesNovember 30

    Hellooooo, I followed the udev Wiki for auto mounting USBs and it now works great. The only problem is: how can I automatically open a file manager of the mounted directory? I tried putting this at the end of the "ACTION=="add"," secti

  • [SOLVED] udev rule no longer workingOctober 11

    I have a udev rule set up to automatically mount an ext4 filesystem when I plug a certain thumb drive in.  It was working fine until yesterday (probably due to updates).  Here is the rule, in file /etc/udev/rules.d/99-gfk.rules: KERNEL=="sd?2",

  • [SOLVED]Udevd fails to recognize rules in /lib/udev/rules.dOctober 11

    I've been having a few crashes since the update of udev earlier this week (so far only on my laptop where the Xserver hangs and requires a hard reboot to get anything working again).  While investigating the logs, I ran across the following errors: O

  • Udev rules don't workNovember 30

    I am on my laptop, where I am trying to write some udev rules. Firstly, as a test I tried to make a symlink when connecting my ext hd. $ udevadm info /dev/sdb E: ID_PART_TABLE_UUID=ea04843c-526e-45bf-9d45-beba1b180285 $ cat /etc/udev/rules.d/61-rules

  • Using disk label on udev rules?November 30

    Hello, Until just a few hours ago, when I plugged my external hard drive in I had to run a script to mount it with sudo, as I couldn't get it automounted. Then I saw a workaround in some thread over here, using the udev rules proposed at the bottom o

  • [Solved] udev rule not workingNovember 30

    Hi! I'm trying to set my trackpoint sensitivity and speed using an udev rule: [[email protected] ~]$ ls -l /etc/udev/rules.d/ total 4 -rw-r--r-- 1 root root 113 Sep 14 01:54 10-trackpoint.rules [[email protected] ~]$ cat /etc/udev/rules.d/10-trackpoint.rules #

  • [SOLVED]system fails to boot since adding udev rules for automountingOctober 11

    Hello I have recently been trying to use udev rules to automount, and putting together stuff from the wiki, forums and general googling around have produced the following set of rules: # automounts usb hdd and pendrives as usbhd-sdx; no messing aroun

Copyright (C) 2019 wisumpire.com, All Rights Reserved. webmaster#wisumpire.com 15 q. 0.740 s.