Custom nemo action for user mounted drives, how?

Please post suggestions for improvement of Cinnamon on:
https://github.com/linuxmint/Cinnamon
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
red-lichtie

Custom nemo action for user mounted drives, how?

Post by red-lichtie »

I'm trying to add a popup action to my removable drives in nemo using a nemo_action file.

I've create the file "~/.local/share/nemo/actions/umount.nemo_action" with the following contents:

Code: Select all

[Nemo Action]
Active=true
EscapeSpaces=true
Exec=/bin/umount %F
Selection=S
Extensions=any;
Conditions=removable;
Name=Unmount %f
Comment=Unmounts the device
But it never appears.

If I change Conditions to:

Code: Select all

Conditions="removable";
then it always appears.

What is wrong with the condition ?

What am I doing wrong?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
red-lichtie

Re: nemo_action not showing up

Post by red-lichtie »

I've had a look at the source code that does the test for "removable" and it looks like this:

Code: Select all

...
            } else if (g_strcmp0 (condition, "removable") == 0) {
                gboolean is_removable = FALSE;
                if (g_list_length (selection) > 0) {
                    GMount *mount = nemo_file_get_mount (selection->data);
                    if (mount) {
                        GDrive *drive = g_mount_get_drive (mount);
                        if (drive) {
                            if (g_drive_is_media_removable (drive))
                                is_removable = TRUE;
                            g_object_unref (drive);
                        }
                    }
                }
                condition_type_show = is_removable;
            } else if (g_str_has_prefix (condition, "gsettings")) {
...
After some checking up it would appear that g_drive_is_media_removable identifies devices with removable media not a removable device.

So basically, how do I identify a unmountable mount point as a condition?

How do I know using gsettings or dbus if the selection is mounted and I can umount it ?
Locked

Return to “Cinnamon”