Jump to content

“Empty Trash” is calling Finder, even when using an alternative


vitor

Recommended Posts

I’ve recently started using Path Finder, which allows me to essentially kill Finder, and work only with it. However, it seems that empty trash does not check for this. From what I understand, reading the forum, maybe this should be Path Finder’s job (informing Alfred of this case), but other options like “Reveal in Finder” and ejecting media, work correctly, so maybe Alfred is doing something specific with Finder, here.

I’ve mocked up a quick way of how I’d see this working

# Check for Finder and alternatives
tell application "System Events" to set isFinderRunning to (name of processes) contains "Finder"
tell application "System Events" to set isPathFinderRunning to (name of processes) contains "Path Finder"

# Empty the trash
if (isFinderRunning) then
	tell application "Finder" to empty trash
	
else if (isPathFinderRunning) then
	# Get frontmost app
	tell application "System Events" to set frontApp to name of first process whose frontmost is true
	
	# Empty trash
	tell application "Path Finder"
		activate
		empty
	end tell
	
	# Return to frontmost app
	tell application frontApp to activate
	
end if

This would also leave room for other implementations with other Finder alternatives; it still gives it precedence, but if it isn’t already open, it won’t call it. Maybe Alfred isn’t using AppleScript at all for this, but that’s just a quick mockup to open the discussion and see if it would be a possibility.

Edited by Vítor
Link to comment
Share on other sites

Alfred provides the default system commands to get people started with a stock OS X setup. You can use workflows to replace the default empty trash commands as suggested, so I won't be building specific support for other apps by default.

 

The main reason being, if Path Finder deprecated its AppleScript support or if Path Finder isn't installed, you get AppleScript failures.

 

I'm moving this to closed.

Link to comment
Share on other sites

I’ve recently started using Path Finder, which allows me to essentially kill Finder, and work only with it. However, it seems that empty trash does not check for this. From what I understand, reading the forum, maybe this should be Path Finder’s job (informing Alfred of this case), but other options like “Reveal in Finder” and ejecting media, work correctly, so maybe Alfred is doing something specific with Finder, here.

I’ve mocked up a quick way of how I’d see this working

# Check for Finder and alternatives
tell application "System Events" to set isFinderRunning to (name of processes) contains "Finder"
tell application "System Events" to set isPathFinderRunning to (name of processes) contains "Path Finder"

# Empty the trash
if (isFinderRunning) then
	tell application "Finder" to empty trash
	
else if (isPathFinderRunning) then
	# Get frontmost app
	tell application "System Events" to set frontApp to name of first process whose frontmost is true
	
	# Empty trash
	tell application "Path Finder"
		activate
		empty
	end tell
	
	# Return to frontmost app
	tell application frontApp to activate
	
end if

This would also leave room for other implementations with other Finder alternatives; it still gives it precedence, but if it isn’t already open, it won’t call it. Maybe Alfred isn’t using AppleScript at all for this, but that’s just a quick mockup to open the discussion and see if it would be a possibility.

 

I'll also add, as a fellow Path Finder user, that you can't effectively disable Finder. Path Finder does some tricks to get about 90% of the way there but that last 10% is unavoidable. Most new Path Finder users give it a shot and end up disabling the use of Path Finder as a full Finder replacement. The rough edges just get too annoying. Setup a hot key to activate Path Finder and you'll forget Finder is even there most of the time.

Link to comment
Share on other sites

Alfred provides the default system commands to get people started with a stock OS X setup. You can use workflows to replace the default empty trash commands as suggested, so I won't be building specific support for other apps by default.

 

The main reason being, if Path Finder deprecated its AppleScript support or if Path Finder isn't installed, you get AppleScript failures.

 

I'm moving this to closed.

 

The error shouldn’t occur (except on the changing dictionary case) since it’s checking for Finder first, but I agree — manually adding support for all the variables would become unmaintainable. Since I don’t know how exactly Alfred empties the trash (it seems it would be via AppleScript), then maybe there could be an easy option to just “tell whoever is in charge of it to empty the trash”.

 

I'll also add, as a fellow Path Finder user, that you can't effectively disable Finder. Path Finder does some tricks to get about 90% of the way there but that last 10% is unavoidable. Most new Path Finder users give it a shot and end up disabling the use of Path Finder as a full Finder replacement. The rough edges just get too annoying. Setup a hot key to activate Path Finder and you'll forget Finder is even there most of the time.

 

I’m starting to realise that, there doesn’t even seem to currently be a way to empty the trash without displaying an “are you sure” prompt. It’s a shame, though, but I wanted to be sure that was really the case. It seems the Finder is just to integrated to work around it.

Thank you both.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...