Cancel open operation


#1

I’m registering an opener using atom.workspace.addOpener.
If this opener receives as input a certain file, I want it to be able to do something with this file and then ensure that it’s not actually opened. If my opener return nothing, the file will be opened anyway using atom.project.openSync.

Anyone have ideas on how I can accomplish this?


#2

This begs the question, “If it doesn’t open a file, then why is it an opener?”


#3

It’s a package to open files with a certain extension externally.
I don’t want atom to open up my pdf’s and giving me a bunch of ascii :smile:
Neither do I want to use some js implemented pdf viewer.
The package can be found here.

The reason I’m implementing this using an opener is that openers are what’s called when a file is double clicked in tree-view or using command-p.

So far I’ve though about just returning a custom view with a spinbox that gets destroyed after the file has been opened by the external program, similar to what the settings-view package does. Not a great success so far.

Any ideas would be greatly appreciated.


#4

Yeah, I don’t think you can get there from here. Have you tried overriding the double-click handler for the relevant tree-view items? That won’t help for the fuzzy-finder, but it’s a start perhaps.

I think your best bet is to create a feature request to extend Workspace.addOpener with the ability to have another type of opener. There’s already an options object that can be passed back to customize how it behaves.


#6

Or you could have a custom view and tab that are hidden and then destroyed, That could happen in a fraction of a second.