robwalton / alfred-ulysses-workflow

Alfred 3 workflow for Ulysses
http://www.alfredforum.com/topic/9662-ulysses-workflow/
79 stars 10 forks source link

how can I change the workflow for it to open in cmd + 2 view and not cmd + 1 on opening? #1

Closed nikitavoloboev closed 7 years ago

nikitavoloboev commented 7 years ago

from opening to this view (current implementation) :

2016-10-28 at 22 41

to this :

2016-10-28 at 22 43

Thank you.

robwalton commented 7 years ago

Hi Nikita, This is a good idea; doing it this way would keep you at the context level you've already entered via Alfred. Ulysses has no apple scripting or callback support for the mac version. If you want to tinker with the workflow's interaction with Ulysses its not too involved.

I just tried getting Alfred to send a cmd-2 after opening the sheet or group. At first glance it works great, but actually Ulysses has an odd system in that this command toggles between which-ever view you had selected and 'sheets view' (cmd-2). I can't see a way around this except to read the state of a menu command (i.e. where the check mark is). This seems only to be possible if your global accessibility commands are switched on (http://stackoverflow.com/questions/69030/in-applescript-how-can-i-find-out-if-a-menu-item-is-selected-focused);not sure I'm keen to pursue this route though.

If you can work out series of manual interactions with Ulysses that always selects what we want, then I'd be pleased to add it to the workflow. I can't see one though.

--Rob

nikitavoloboev commented 7 years ago

Hey @robwalton I didn't quite manage to get it working still.

I really wish for it to open only on the writing and not have the sidebar there. Perhaps something changed in Ulysses API that we can do?

Thank you.

robwalton commented 7 years ago

Hi @nikitavoloboev I'd been away from this for a while. Glad to hear you are still interested. Was looking the other day and there is indeed a new API in Ulysses 2.7. The x-callback url scheme they use on iOS is now available in macOS: https://ulyssesapp.com/kb/x-callback-url/ . For example:

 `ulysses://x-callback-url/open?id=G4g3rGj2SsAEfKQSAvtwWw`

opens a sheet based on an id. There are two issues though:

  1. It seems (at first glance) to always open in three panel mode, which is not what we want, but at least is consistent. We could use this (wait a bit...arghh) and then send cmd-2 (or 1).
  2. Show stopper: I can't see out how to get the id on os x. It seems to only be accessible from iOS, although once you have it, it is valid on macOS. Have grepped around in the iCloud files which back the ulysses sheets and groups but can't spot anything that looks like an id.

I'll email their support about both issues as I'd quite like this to work too.

robwalton commented 7 years ago

I added a feature to check and then toggle the view state from the menu bar if necessary. Instructions in u:help. This requires Alfred to have assistance services on (but will prompt if it isn't). I hesitated with this solution as its a bit of a security hole---but no worse I imagine than having workflows with arbitrary shell commands. Definitely a good feature.

nikitavoloboev commented 7 years ago

This is amazing. Thank you. :)

robwalton commented 7 years ago

It is much nicer this way; thanks for bugging me to do it! Did you get the v0.9.2 which fixed a race condition when Ulysses opening? Also, master now has a proper find command. Will trial it a bit before releasing this time though!

nikitavoloboev commented 6 years ago

I really wish we could instantly go to a certain state in Ulysses like cmd + 2 or cmd + 3. It would especially be useful when searching for sheets. It's so annoying, opening a sheet and then seeing the lengthy animation come through just so you can go on and start writing. 😞