Announcement

Collapse
No announcement yet.

Trying to perfect my first "solid" action. Where to find complete list of entries?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Trying to perfect my first "solid" action. Where to find complete list of entries?

    I'm have written a "Eject" feature for removable devices because if you choose "Safely Remove" it powers down and disconnects the device. I find this is highly annoying because you now have to pull the USB stick or SDCard out and re-insert it to use again.

    I have it written and it totally works:
    Code:
    [Desktop Entry]
    Actions=open;
    Type=Service
    X-KDE-Action-Custom=true
    X-KDE-Solid-Predicate=[ IS StorageVolume AND StorageVolume.ignored == false ]
    
    [Desktop Action open]
    Exec=udisksctl unmount -b %d
    Icon=media-eject
    Name=Unmount Removable Device


    The code above is in ~/.local/share/solid/actions/eject_removable.desktop and works immediately when the file is placed there. When I select "Disks and Devices"

    The part I need help with is a want to option to unmount to only appear when the device is actually mounted. I believe this is the line that might make this happen:
    Code:
    X-KDE-Solid-Predicate=[ IS StorageVolume AND StorageVolume.ignored == false ]
    but I tried to add "AND StorageVolume.mounted == true" and this only causes the action to not show at all. It seems the option I want is not what I guessed at.

    What I'm asking is if anyone knows of a resource that has all the available Predicates in it. I've gone through the KDE tutorial but have found no index.

    Please Read Me

    #2
    I provide the following not because I don't think you don't know about it, but because maybe it's so simple a solution you've overlooked it.

    Google query: in Ubuntu Linux, is there a way to Eject a removable USB device without powering it down?

    AI Overview

    Yes, in Ubuntu Linux, you can unmount (eject) a USB device to safely remove it without cutting power to the port by
    using umount` in the terminal or by choosing "Eject" instead of "Safely Remove" in the file manager. This detaches the file system while keeping the USB device active.






















    Windows no longer obstruct my view.
    Using Kubuntu Linux since March 23, 2007.
    "It is a capital mistake to theorize before one has data." - Sherlock Holmes

    Comment


      #3
      The point of using a "solid" action is to avoid having to launch the file manager or use the terminal to eject a USB device. The devices already appear in "Disk & Devices" so by adding a solid action to my account, I can "eject" (unmount) without other tools. Think of it like a shortcut.

      It's comparable to "Reformat or Edit with File Manager" that is in Disk & Devices by default. One certainly can manually launch KDE Partition Manager and select a device. Or you can select the device AND launch Partition Manager in one go from Disk & Devices.

      Please Read Me

      Comment


        #4
        AI Overview

        To safely eject a USB device in KDE without powering it off, use the predicate
        StorageAccess.accessible == false. This ensures the device is unmounted (making it safe to remove) but does not trigger udisksctl to power down the drive. This predicate can be used in Action rules, as seen in this discussion on KDE Discuss.

        Recommended Solid Predicates
        • StorageAccess.accessible == false: The best option to simply unmount the filesystem.
        • OpticalDisc.available == false: If the device is detected specifically as an optical drive (CD/DVD).

        Why X-KDE-Solid-Predicate Often Powers Off
        Modern KDE (using udisks2) treats "Safely Remove" as a signal to fully power down the USB device, which causes it to disappear from the GUI entirely. The predicates above help to only stop file system access, leaving the USB powered.

        Alternatives if Predicates Fail
        If the drive still powers down, you may need to use a custom action with a shell script instead of a Solid predicate:
        • Unmount and Sync: udisksctl unmount -b /dev/sdX && sync.
        • Keep Powered: Avoid udisksctl power-off.
        If you're interested in managing these settings, you might want to look into the KDE Solid documentation.






















        Windows no longer obstruct my view.
        Using Kubuntu Linux since March 23, 2007.
        "It is a capital mistake to theorize before one has data." - Sherlock Holmes

        Comment


          #5
          In KDE Solid, the property is StorageVolume.isMounted, not StorageVolume.mounted.
          Try this line :
          X-KDE-Solid-Predicate=[ IS StorageVolume AND StorageVolume.isMounted == true AND StorageDrive.isRemovable == true ]

          That last bit makes it so it only targets removable devices

          𝕷𝖎𝖓𝖚𝖝 𝕱𝖔𝖗 𝕷𝖎𝖋𝖊
          Kubuntu 25.10,KDE Plasma Version: 6.4.5,Kernel: 6.17.0-14-generic (64-bit),Graphics Platform: X11
          2 × Celeron® Dual-Core CPU T3500 @ 2.10GHz
          Memory: 4 GiB of RAM (3,8 GiB usable)
          Graphics Processor: llvmpipe​

          Comment

          Users Viewing This Topic

          Collapse

          There are 2 users viewing this topic.

          Working...
          X