trunkmaster / nextspace

NeXTSTEP-like desktop environment for Linux
https://trunkmaster.github.io
GNU General Public License v3.0
1.9k stars 69 forks source link

implement "open in workspace" service #311

Closed onflapp closed 4 years ago

trunkmaster commented 4 years ago

@onflapp could you please describe some use cases of this service?

onflapp commented 4 years ago

"Open in Workspace" service allows other applications to open directory in Workspace app. If selected path is a file, open directory it is contained in instead. This can be either done by selecting a path as a text or programmatically via NSPerformService.

Use case:

This functionality is equivalent to "Open in Workspace" service in NextStep and similar to "Show in Finder" in OS X

onflapp commented 4 years ago

@trunkmaster NextSpace could go even further. Imagine you could simply do "ls" select a file name (not full path) and call "Open in Workspace" or "Open in Preview" Terminal could create full path based on its current directory. This could be taken from the title (Mac OS use to do that) or via special escape sequence as Apple's Terminal does it.

Functionality like this would make it easy to integrate command line commands (e.g. gdb or vim) with GUI apps.

trunkmaster commented 4 years ago

@onflapp Nice examples, thanks.

I guess you know about NSWorkspace AppKit's class. Some methods of this class is meant to be supported by "Workspace" application. For example, [[NSWorkspace sharedWorkspace] openFile:@"/Users/me"] should open new File View window rooted at /Users/me. That's how NextStep/OPENSTEP Terminal application implements "Open in Workspace". If you open "Services" submenu of Edit application on OPENSTEP you can't see "Open in Workspace". There's no Services->Workspace submenu either.

Saying that I mean that we don't need to implement Workspace service of any kind. Workspace application API - unlike other applications - is exposed via NSWorkspace class. So if we want "Open in Workspace" in Terminal's "Services" menu we need to implement this functionality in Terminal. You can find examples of NSWorkspace usage in OpenUp application.