Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Finder alternatives #7

Open
probablykasper opened this issue Apr 29, 2022 · 3 comments
Open

Support for Finder alternatives #7

probablykasper opened this issue Apr 29, 2022 · 3 comments

Comments

@probablykasper
Copy link

FastDMG doesn't seem to work when replacing Finder with an alternative like Path Finder (You can make Path Finder default in Preferences > General > Set as the default file browser).

Finder can also be disabled using this command:

launchctl unload -w /System/Library/LaunchAgents/com.apple.Finder.plist
@sveinbjornt
Copy link
Owner

My guess is that FastDMG is still doing its job, but the mounted image is not opened in the non-Finder file browser. FastDMG contains this code to open the mounted image:

[[NSWorkspace sharedWorkspace] openFile:mountPoint withApplication:@"Finder" andDeactivate:YES];

As far as I know, there is no way to "generically open a directory in the user's file system browser of choice" on macOS. Only the Finder, unless I were to hack together some nasty AppleScript with explicit support for Path Finder ... which is not going to happen. 99%+ of people just use the Finder, bad as it is.

@JayBrown
Copy link

JayBrown commented May 22, 2023

Users can easily create their own workaround with apps like EventScripts (available on the Mac App Store). There's a "volume mounted" trigger, and you can attach a shell script etc. to that trigger. In my case, I'm using Nimble Commander, so on my system I would then run something like this:

volumepath="$3"
if diskutil info "$volumepath" | grep -q -m 1 "Protocol:.*Disk Image" &>/dev/null ; then
	osascript -e 'activate application "Nimble Commander"' -e 'tell application "System Events" to keystroke "t" using command down'
	open -a "Nimble Commander" "$volumepath"
fi

I guess it would also work with Path Finder too. You just need to check if CMD-T is the shortcut for opening a new tab—it probably is—, and also check if open -a "Path Finder" "$volumepath" would work, i.e. whether it opens "$volumepath" in the newly created tab, or if you need to use another line of osascript to tell Path Finder to reveal the volume path.

@JayBrown
Copy link

JayBrown commented May 22, 2023

My guess is that FastDMG is still doing its job, but the mounted image is not opened in the non-Finder file browser. FastDMG contains this code to open the mounted image:

[[NSWorkspace sharedWorkspace] openFile:mountPoint withApplication:@"Finder" andDeactivate:YES];

As far as I know, there is no way to "generically open a directory in the user's file system browser of choice" on macOS. Only the Finder, unless I were to hack together some nasty AppleScript with explicit support for Path Finder ... which is not going to happen. 99%+ of people just use the Finder, bad as it is.

FastDMG could also send a proprietary NSDistributedNotification for a volume mount containing the full volume path as data (POSIX path). Then users could just compile their own observer for the NSDistributedNotificationCenter and add the above shell script behind it. That way, the user could ensure that the script is only executed, if a disk image has actually been mounted by FastDMG, and not by some other process.

PS: EventScripts doesn't allow users to add their own observers, so it would only work with some quick Objective-C tinkering on the user's part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants