marta-file-manager / marta-issues

An issue tracker for Marta File Manager.
https://marta.yanex.org/
331 stars 0 forks source link

(ab)using Marta API (for snippets) #301

Open ghost opened 6 years ago

ghost commented 6 years ago

I sometimes want to have (reasonably advanced) text snippets (default value, multi parameter) but I do not want to have (to buy/ run) a separate app just for snippets cause I do not really want it all that much either.

Can you tell me if this is possible/ makes any sense to do through Marta?

I reckon this is not near the purpose of this app, it's just cause if I have Marta open anyway ... maybe ....

feel free to close 😄

yanex commented 6 years ago

@monouser7dig Sounds nice. But how do you see this feature? Marta has actions, and plugins can contribute custom ones (see also #254). In theory, actions could have parameters, and then you will be able to pass them right from the Actions panel, like copy | source target. Text until | will be the action name (or its part, Actions panel does not require you to enter the whole action name), and the remaining text will become arguments.

ghost commented 6 years ago

It would require to intercept keypresses/ shortcuts even when Marta is not in the foreground

(I want to use the snippets just everywhere not (only) in Marta)

Like ctrl+cmd+alt+i would bring up a window like spotlight/ like Martas cmd+shift+p but not the whole Marta app, one could do a fuzzy search on the snippet names, hit enter and fill out the snippet.

Or just have a direct shortcut to the snippet and Marta in the background would insert that snippet/ show a small text UI that let's one fill out the variable fields of the snippet

yanex commented 6 years ago

Then it's like custom actions + global version of gadgets (external tool support):

{
    "id": "gadget.your.name",
    "name": "Gadget name",
    "global": true, // this gadget can be run outside of Marta window context
    "type": "action",
    "actionId": "your.action.name",
    "options": { "arg1": "Source file:", "arg2": "Target file:" }, // gadget may have some options
    "args": { "source": "$arg1", "target": "$arg2" }
}

Then you create an action (a workflow in Alfred terms) with your.action.name identifier, and that's it. The problem is that actions should also be global.

ghost commented 6 years ago

The problem is that actions should also be global. don't get what you mean but nice to hear that it may eventually even work 😄

yes Alfred does something similar apparently but I have not bought it (yet). Dash (which I have) does actually do almost exactly what I want (and is pleasing to look at/ work with) but they had one missing piece I think no default values and the main issue is that I do not have it opened all the time which makes it kind of useless for this purpose.

yanex commented 6 years ago

Well, actions are run in the ActionContext that wraps pane contexts, its containing window, and there's also a global context. If you run actions outside of Marta window, it should't have both pane and window contexts, and may only have a GlobalContext. This sounds like it's not really a Marta "action". I'd rather name it Command.

ghost commented 6 years ago

okay I mean as long as it's working ...

that's how it looks in dash

ghost commented 6 years ago

another totally unrelated useful feature would be to search safari history in the look up panel it's actually fairly straight forward although there may be less hacky ways 😄 I actually use this from time to time and it works well