jschlatow / taskopen

Tool for taking notes and open urls with taskwarrior
GNU General Public License v2.0
363 stars 31 forks source link

phone numbers #145

Closed jaker-dotcom closed 2 years ago

jaker-dotcom commented 2 years ago

Hello there, does anyone know of a way to support phone numbers as links? Using manjaro, I also have my phone connected via KDE connect and this makes it possible to click on phone links (internet, PDF etc) and choose to dial them from my phone.

I'd be satisfied if there was any way of doing it with an external script/html trick. Even better if taskopen would support this kind of link as it does with http links.

task 1 ann -- tel: 012345678
taskopen 1

which would then trigger the system link handler (that in my case opens it with KDE connect), maybe via the browsers link handler that triggers upon clicking on 012345678 on websites. Unfortunately it doesn't do the trick to enter the latter or just tel:012345678 in the url bar or as an argument for the browser. That will run a search on it.

Any ideas?

Thanks!

jschlatow commented 2 years ago

@jaker-dotcom Thanks for sharing your use case.

May I point you to the staging branch of taskopen? I haven't released taskopen 2.0 yet, because the man pages still need to be updated, which is quite a boring task. Nevertheless, documentation is available in the wiki. With the new version, your use case is very easy to implement. You'd simply define an action 'phone' either by specifying a regular expression to detect phone numbers or by specifying a regular expression for the label "tel". Then you specify the command to be executed. You could even call a script (e.g. using python phonenumbers) to further check the number for validity. Here is an exemplary (untested) config snippet:

[Actions]
phone.regex = "(0[0-9]+)"
phone.command = "echo $LAST_MATCH"

[CLI]
alias.call = "normal --include=phone"

The icing on the cake here is that the new version allows specifying aliases for taskopen's command line. With the above example, you'd be able to only list the items that match the phone action by typing taskopen call.

Note that you can also achieve the very basic behaviour with taskopen 1.x (it does not support regular expressions for labels though) by defining CUSTOMx_REGEX and CUSTOMx_CMD in your taskopenrc.

jaker-dotcom commented 2 years ago

Thanks for pointing me to it. Nice to know that it's working. I remember having read that there were great plans for taskopen 2.0. I'll dig into it soon!