Fix mount icons surviving unmount, and all volumes sharing one identity - #359
Open
svan71 wants to merge 2 commits into
Open
Fix mount icons surviving unmount, and all volumes sharing one identity#359svan71 wants to merge 2 commits into
svan71 wants to merge 2 commits into
Conversation
_getMountName() computed a name and then returned the literal 'Volume', so every mount collapsed onto a single id and a single /tmp desktop entry. The entry was written only when absent, so its Name, Exec and Icon stayed frozen on the first drive mounted after boot, and no second drive could ever get an icon. Mount bookkeeping now reconciles against Gio.VolumeMonitor.get_mounts() instead of applying add/remove deltas. On 'mount-removed' the GMount has already lost its drive and volume, so any id derived from its name at that point can disagree with the id it was added under, leaving the icon behind for the rest of the session. Both handlers also refresh now - the dock only reconciles mount icons from layout(), which a plain animate() never reaches while the dock is autohidden. Also unmount via 'gio mount -u' rather than umount(8), which needs root for anything that is not a fuse mount and bypasses udisks when it does succeed, quote paths, and fall back to the location URI for network mounts.
setupMountIcon() writes /tmp/<user>-mount-<name>-dash2dock-lite.desktop per mount and nothing ever removed it, so entries for unmounted volumes survived the rest of the session - and any still present when the session ended stayed in /tmp indefinitely. checkMounts() now sweeps the entries against the reconciled mount table, which covers both cases without tracking removals separately.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two mount-icon problems with the same origin, plus the /tmp entries they leave behind.
One identity for every volume
_getMountName()computed a name and then returned the literal'Volume', so every mount collapsed onto a single id and a single/tmp/<user>-mount-volume-…desktopentry. That entry was written only when absent, so itsName,ExecandIconstayed frozen on whichever drive was mounted first after boot, and no second drive could ever get an icon of its own.The entry is now always rewritten — name, path and icon belong to whatever is mounted right now.
Icons surviving unmount
Mount bookkeeping applied
mount-added/mount-removeddeltas. Onmount-removedtheGMounthas already lost its drive and volume, so an id derived from its name at that point can disagree with the id it was added under — and the icon is left behind for the rest of the session.Bookkeeping now reconciles against
Gio.VolumeMonitor.get_mounts()instead of applying deltas, so it never has to derive an id from a mount that is already going away. Both handlers also refresh now: the dock only reconciles mount icons fromlayout(), which a plainanimate()never reaches while the dock is autohidden.Leftover /tmp entries
setupMountIcon()writes one desktop entry per mount and nothing ever removed it, so entries for unmounted volumes survived the session — and any still present when the session ended stayed in/tmpindefinitely.checkMounts()now sweeps the entries against the reconciled mount table, which covers both cases without tracking removals separately.Also
The unmount action used
umount(8), which needs root for anything that is not a fuse mount and unmounts behind udisks' back when it does work. It now usesgio mount -u.Verification
On GNOME 50, with a loop-device volume mounted and unmounted in a nested headless shell: the icon appears and disappears with the mount, a second volume gets its own icon and name, and the stale
/tmpentry is gone after reconcile. No JS errors.