Repository navigation
List drives that aren't mounted yet, and mount them on a click or as they're plugged in - #22
AyushKr2003 wants to merge 17 commits into
Conversation
[Medium impact] The changes reach Folio's local drive and sidebar workflows. The stale-row fix needs one more case before merging: ejected optical media can still leave an old mounted row. Findings
SummaryFolio lists unmounted drives and mounts them when opened. It also mounts eligible removable drives automatically and leaves folders when their drive disappears.
|
317340a to
c256d8e
Compare
Devices listed only what was already mounted, so another system's partitions and a stick that nothing had mounted never showed. It now lists GIO's volumes, as Nautilus does: udisks leaves out the system's own and hidden partitions (EFI, recovery), and the list follows plugging, mounting and unmounting at once instead of on the 15-second poll. - A click on one that isn't mounted mounts it and opens it. udisks asks the session's polkit agent where it needs permission, and an encrypted drive's passphrase is asked for in the window, kept for no session. - A drive plugged in that udisks marks to mount by itself is mounted, unless GNOME's automount setting is off. A desktop automounter (udiskie, a shell) gets two seconds' head start, so nothing is mounted, or asked for its passphrase, twice. - A mounted drive has an eject button: removable ones are ejected, others unmounted. Panes in a drive that goes away, from here or elsewhere, go home first. - An encrypted drive that unlocks with nothing mountable inside says so, instead of nothing happening.
A wrong passphrase and a retry left the first reply's timer running, so it could cancel the corrected attempt early. A new request now stops the last reply's timer, and each reply starts its own.
An encrypted drive that unlocked but was slow to mount its filesystem still read as "nothing on it that can be mounted" once the minute ran out. Now that's said only when nothing inside the unlocked device is a filesystem, by udev's record of it; otherwise it's reported as timed out.
487ecd6 to
cf6773f
Compare
Main now lets go of mounted drives itself (Places::eject and leave, the drive menu and its eject button), so the branch keeps only what main lacks: GIO's unmounted volumes in Devices, mounting one with its passphrase put in the window, and mounting a drive as it's plugged in. A drive's questions go to the user, as an unverified server's do, and an unmount from anywhere is left through Places::leave.
|
I built much the same thing locally before finding this, so I'll leave drives to this PR. Two things from mine that might be worth folding in:
|
# Conflicts: # src/main.cpp
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
# Conflicts: # src/Sidebar.qml # src/i18n/en.json
…losed window's mount A drive plugged in or mounted while the mounts were still being read (an NFS mount that stopped answering, say) waited for that unrelated reading to finish before it showed in Devices, even an unmounted drive that needs no filesystem read at all. The Devices list is now made again from GIO's volumes and the last finished reading as soon as GIO says something changed; what's free on a new drive fills in with the next reading. A window closed after a drive's passphrase went in dropped its mount's cancellable without cancelling it, and the minute-long timer went with the window, so a drive that unlocked with nothing to mount inside left GVfs's mount pending for good. The window now cancels it on its way out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A drive plugged in is left two seconds to the desktop's own automounter (udiskie, a shell) and mounted by Folio if it's still unmounted then. For an encrypted drive that's no sign the other one is done: it can still be waiting on its passphrase, and Folio would ask for it a second time. An encrypted drive is now never mounted as it's plugged in; it shows in Devices and mounts, asking once, on a click. What udev found on a device is read in one place, Drives::usageOf, which the Mounter's check for a drive that unlocked with nothing to mount inside now uses too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Before/after of the sidebar on today's main (this branch merged locally onto it). Real drives can't be faked offscreen, so both sides are fed the same made-up machine: three partitions that aren't mounted ( |
An unmounted drive has no path, so it matched a folder under no row (Home itself), and Tab landed on the last drive.
| for (const QVariant &drive : drives) | ||
| if (!listed.contains(drive.toMap().value("path").toString())) | ||
| devices << drive; |
There was a problem hiding this comment.
Unmounted drives keep old rows
If readMounts() is stalled when a drive is unmounted, devicesFrom() adds its new unmounted row, then appends the old mounted row from m_lastMounts. A removed drive also keeps its old row. Clicking that stale row opens the old mount folder instead of mounting the drive, and the row remains until the stalled read finishes.
Exclude cached rows for volumes GIO now reports as unmounted or removed, while preserving mounts GIO does not manage.
Knowledge Base Used: Storage discovery and mounts
While a mount reading is stalled, Devices is built from the last one. A drive unmounted since then got its unmounted row and its old mounted row too, and one pulled out kept its row; clicking either opened a folder that was no longer the drive's. A drive whose device GIO now lists unmounted, or whose device node is gone, is left out; mounts GIO doesn't manage stay.

Devices lists only drives that are already mounted. On a machine that also has Windows and another Linux install, none of those partitions show until they're mounted by hand, while Nautilus lists them all and mounts one on a click.
Letting go of a drive is now
main's own (Places::ejectandleave, the eject button and the drive menu, from #32 and #53), so this branch is merged withmainand builds on that rather than adding a second way to eject.What changes
Acer(Windows),53 GB Volume,ryoku(another Arch). A mounted volume is the rowphysicalDrivesalready makes for it (free space, Eject or Unmount), with its volume id added; mounted drives GIO doesn't know (an fstab mount under/mnt) follow, as before, and a mounted volumephysicalDrivesleaves out (the system's own) stays out. The list follows plugging, mounting and unmounting at once viaGVolumeMonitor, instead of waiting for the 15-second poll.g_volume_mount), and so do ⏎ and the drive menu's Mount. udisks asks the session's polkit agent where it needs permission. An encrypted drive's passphrase is asked for in the window through the mount prompt, which then reads "Unlock" and shows only a Passphrase field. The passphrase isn't saved. A drive's questions go to the user, as an unverified server's do.org.gnome.desktop.media-handling automountwhen that schema is installed. A desktop automounter (udiskie, a shell) gets two seconds' head start, so a drive isn't mounted twice and an encrypted one isn't asked for its passphrase twice. The mount goes through the last window used, so it can ask for a passphrase. "TESTSTICK is mounted" shows as a notice.Places::leave, so panes go home and previews close, as they do formain's own eject.The GIO code lives in a new
Drivesclass (drives.h/.cpp).MountergainsmountVolume()alongsidemount(), sharing its prompt, andPlaces::devicesFromputs the two lists together. Unmounted rows have nopathand norelease, so the eject button and Format stay away from them.Tested
main.bin/test: 194 passed, including the reworkedplacesListDrivesNotMountedYetandenglishCatalogMatchesTheSources(the new strings are inen.json). The one failure,previewerPicksAViewerForEachType(CR2 →image), depends on the Qt image plugins installed here and fails the same way onmain./run/media/<user>/ryokuthrough the polkit agent and opened it. Unmounting it from a terminal (gio mount -u) sent the pane home.udisksctl loop-setup(udiskie paused) was mounted by Folio after the delay, with the notice. With udiskie running, udiskie mounted it and Folio left it alone.