orgzly / orgzly-android

Outliner for taking notes and managing to-do lists
https://www.orgzly.com
GNU General Public License v3.0
2.68k stars 305 forks source link

open app with search results via tasker plugin or intent #784

Open thephatmaster opened 3 years ago

thephatmaster commented 3 years ago

The one thing Orgzly can't do, which my current system can (Tasker + Tasks.org - formerly Astrid) is context (in GTD speak, tag/category/property in Org-speak) specific reminders.

I can create a tasker task that (via a plugin) can open Astrid/Tasks.org displaying all items related to a context. I imagine this is via a search.

I love being able to have my home tasks pop up when I get near my home cell tower, shopping lists appearing automatically at the shop, and my work tasks pop up when my laptop's Bluetooth comes on etc.

I (naïvely) assume staring a search via an intent, or a tasker plugin is trivial?

lytex commented 3 years ago

I just get this working using ActivityManager (actually I'm using a termux emulation, but it shouldn't matter)

am start -a android.intent.action.MAIN -n com.orgzly/com.orgzly.android.ui.main.MainActivity --es "com.orgzly.intent.extra.QUERY_STRING" "search term" --activity-clear-task

The only downside is that orgzly is closed when you run this so you will lose all the history

This should be pretty straightforward to apply to Tasker

thephatmaster commented 3 years ago

This works fantastically well via termux, thank you.

My sub-optimal solution so far was to use touchtask to simulate taps on the search button and enter text

I want "search term" to be dynamic, and don't want to buy another plugin, so I'll do a bit of digging / asking to see how I can implement this natively with tasker's send intent action.

Thanks again,

On Thu, 24 Dec 2020, 00:53 lytex, notifications@github.com wrote:

I just get this working using ActivityManager https://developer.android.com/studio/command-line/adb#am (actually I'm using a termux emulation https://github.com/termux/TermuxAm, but it shouldn't matter)

am start -a android.intent.action.MAIN -n com.orgzly/com.orgzly.android.ui.main.MainActivity --es "com.orgzly.intent.extra.QUERY_STRING" "search term" --activity-clear-task

The only downside is that orgzly is closed when you run this so you will lose all the history

This should be pretty straightforward to apply to Tasker

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/orgzly/orgzly-android/issues/784#issuecomment-750665660, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANAHP2EXPUV7ZWF4T6X5HU3SWKGH7ANCNFSM4UF3ZVCQ .

lytex commented 3 years ago

You're welcome!

Very interesting idea. Termux is wonderful and pretty powerful, and I'm currently exploring it.

You can create a dialog box using termux-dialog and create a bash script, and then you can either launch it using termux-widget or termux-tasker.

You may encounter something useful in my orgzly-integrations repo, I'm hacking together a bunch of solutions with termux and python, such as git synchronization before it was implemented!

thephatmaster commented 3 years ago

I'm having some difficulty with running this this shell command in tasker. Perhaps the --activity-clear-task is causing issues?

It only works as expected if tasker is open. If tasker is not it seems Orgzly times out immediately.

If I set the task to (1) open Orgzly; (2) wait 4s (3) run shell command, Orgzly opens for 4s, then immediately closes.

I'm finding this hard to debug, can you offer any suggestions?

On Thu, 24 Dec 2020, 19:49 lytex, notifications@github.com wrote:

You're welcome!

Very interesting idea. Termux is wonderful and pretty powerful, and I'm currently exploring it.

You can create a dialog box using termux-dialog https://wiki.termux.com/wiki/Termux-dialog and create a bash script, and then you can either launch it using termux-widget https://wiki.termux.com/wiki/Termux:Widget or termux-tasker https://wiki.termux.com/wiki/Termux:Tasker.

You may encounter something useful in my orgzly-integrations https://github.com/lytex/orgzly-integrations repo, I'm hacking together a bunch of solutions with termux and python, such as git synchronization before it was implemented!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/orgzly/orgzly-android/issues/784#issuecomment-750952889, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANAHP2HIEIMNV3H2U2RQISDSWOLL7ANCNFSM4UF3ZVCQ .

lytex commented 3 years ago

See https://github.com/termux/TermuxAm/issues/4, I'm having kind of this problem in termux also. It seems since Android 10, apps aren't allowed by default to launch intents from the background, but there are workarounds.

I think the Activity Manager is different in Tasker and termux, so maybe this option --activity-clear-task behaves differently.

thephatmaster commented 3 years ago

Thanks, I haven't tried it in termux in the background (don't know how maybe via cron?), but in tasker it certainly can't, even though tasker has the draw over permission. If only there was a way to get tasker to open itself!

On Sun, 3 Jan 2021, 17:57 lytex, notifications@github.com wrote:

See termux/TermuxAm#4 https://github.com/termux/TermuxAm/issues/4, I'm having kind of this problem in termux also. It seems since Android 10, apps aren't allowed by default to launch intents from the background, but there are workarounds.

I think the Activity Manager is different in Tasker and termux, so maybe this option --activity-clear-task behaves differently.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/orgzly/orgzly-android/issues/784#issuecomment-753653590, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANAHP2BILH7SS4YWX53PNKLSYCVZ3ANCNFSM4UF3ZVCQ .

lytex commented 3 years ago

Sure! am start -a android.intent.action.MAIN net.dinglisch.android.taskerm should do it (works from termux)

However you may encounter better information at r/tasker and/or tasker forum.

thephatmaster commented 3 years ago

Awesome, thanks!

On Sun, 3 Jan 2021, 23:11 lytex, notifications@github.com wrote:

Sure! am start -a android.intent.action.MAIN net.dinglisch.android.taskerm should do it (works from termux)

However you may encounter better information at r/tasker https://www.reddit.com/r/tasker/ and/or tasker forum https://forum.joaoapps.com/index.php?forums/tasker/.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/orgzly/orgzly-android/issues/784#issuecomment-753690039, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANAHP2EO633BBCEKHNUCL7DSYD2S5ANCNFSM4UF3ZVCQ .

ronnac commented 7 months ago

Not directly related, but orgzly searches can also be opened from a chrome based Android browser using chrome intents, e.g. intent://#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;package=com.orgzly;component=com.orgzly/com.orgzly.android.ui.main.MainActivity;S.com.orgzly.intent.extra.QUERY_STRING=t.phone;end Hence, you can create a shortcut on your home screen for the context 'phone'.

Another way to create such search shortcuts is via 'Sesame search & shortcuts'.