mgsloan / todoist-shortcuts

Browser extension which adds comprehensive keyboard shortcuts to Todoist, beyond what is offered by Todoist itself
MIT License
313 stars 23 forks source link

Add functions / shortcuts to get URL and title from current task (under cursor) #189

Closed mdbraber closed 2 years ago

mdbraber commented 2 years ago

It would be nice if we could select and copy URLs and titles from the current task under the cursor. This is also helpful with external scripting like the macOS app I'm building that wraps Todoist in Webview and also offers AppleScript support. It works with functions like below. This also is (partly) present in the current Todoist keyboard shortcuts as "Copy link to task" (Command-Shift-,). Would it be possible to integrate this and maybe even add a shortcut to it?

  // Get the URL for the task under the cursor
  function getCursorUrl() {
    return "https://todoist.com/showTask?id=" + getTaskId(requireCursor());
  }

  // Get the title for the task under the cursor
  function getCursorTitle() {
    const classes = ['content', 'task_content'];
    let result
    withUniqueClass(requireCursor(), classes, all, (content) => {
        result = content.innerText;
    });
    return result
  }
jakelfreeman commented 2 years ago

This isn't the ideal solution, but as a bridge... I created a macro via KeyboardMaestro for doing just this. See attached for a copy of the macro, probably need to tweak it before it works for your purposes as I built this just for my own personal use. I imagine you can do something similar with AHK or another macro program if you prefer. Get Task Email.kmmacros.zip

mdbraber commented 2 years ago

Thanks @jakelfreeman. It would be nice though if we could add these functions as they're pretty straightforward and would allow a more robust solution.

mgsloan commented 2 years ago

Included in version 139!

* `ctrl+c` - copy title and url of task in markdown format
* `ctrl+,` - copy task title
* `ctrl+shift+,` - copy task url
jakelfreeman commented 2 years ago

Would it also be possible to do this for the "add comments via email" option (feel free to split this into a separate open item)?

mgsloan commented 2 years ago

Oh interesting I didn't know about email-to-comment. It'd be possible, but a bit tricky to add because it seems like the comments email address is only available via a context menu on the task info page. I'd accept a PR adding such functionality!

On Tue, Jan 18, 2022 at 11:21 AM jakelfreeman @.***> wrote:

Would it also be possible to do this for the "add comments via email" option (feel free to split this into a separate open item)?

— Reply to this email directly, view it on GitHub https://github.com/mgsloan/todoist-shortcuts/issues/189#issuecomment-1015688255, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAFQKQAPFMQMHS6WY54U53UWWVR5ANCNFSM5LUFPRGQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you modified the open/close state.Message ID: @.***>