jschlatow / taskopen

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

No actions applicable on any annotations #153

Closed TeaWhyDee closed 2 years ago

TeaWhyDee commented 2 years ago

I've just installed it (never used it before) through AUR (2.0.0beta). I cannot open my annotations. I ran this command: task 52 annotate www.taskwarrior.org Then I ran taskopen 52 and got the following:

No actions applicable.
Attaching to task 52 'test'.
Type a file extension (or none):
Annotating task cfc4decb 'test'.
Annotated 1 task.

It doesn't matter what I type it always acts the same.

Output of taskopen diagnostics:

Environment
  Platform:       Linux
  Taskopen:       fatal: No names found, cannot describe anything.
  Taskwarrior:    2.6.2
  Configuration:  /home/tea/.taskopenrc
Current configuration
  Binaries and paths:
    taskbin            = task
    taskargs           =
    editor             = /usr/bin/nano
    path_ext           = /usr/share/taskopen/scripts
  General:
    debug              = false
    no_annotation_hook = addnote $ID
    task_attributes    = priority,project,tags,description
  Action groups:
  Subcommands:
    default            = normal
  Actions:
    files
      .target          = annotations
      .regex           = ^[\.\/~]+.*\.(.*)
      .labelregex      = .*
      .command         = xdg-open $FILE
      .modes           = batch,any,normal

Part of output of task 52:

Date         Modification
2022-09-06   Annotation of 'www.taskwarrior.org' added.
20:11:15     
2022-09-06   Annotation of 'Notes' added.
20:11:59
jschlatow commented 2 years ago

@TeaWhyDee Thanks for trying taskopen.

As I can see from your diagnostics output, you have not configured an action that can deal with your annotations. You currently only have a files action that matches on everything that starts with /, ., or ~. Depending on how your system is configured, you could try passing everything to xdg-open as a starting point by changing the files.regex to .*. Alternatively, you could define a separate action for this. Let me share an excerpt of my config (as reported by taskopen diagnostics:

  Actions:
    url
      .target          = annotations
      .regex           = ((?:www|http).*)
      .labelregex      = .*
      .command         = qutebrowser $LAST_MATCH 2>/dev/null
      .modes           = batch,any,normal
    notes
      .target          = annotations
      .regex           = ^Notes\.(.*)
      .labelregex      = .*
      .command         = editnote ~/Notes/tasknotes/$UUID.$LAST_MATCH "$TASK_DESCRIPTION" $UUID
      .modes           = batch,any,normal

Here, you also see the special case of the Notes annotation. If a task is annotated with this, a file named after the task's UUID is opened. At /usr/share/taskopen/script/, you find the corresponding editnote script as well as the addnote script that is executed when no actionable annotation was found. You've already seen the latter in action when it asked you for an optional file extension.

For a more detailed explanation of how taskopen is configured, you may have a look at the taskopenrc manpage.

TeaWhyDee commented 2 years ago

Thank you, this cleared it up. It's a little confusing that taskopen doesn't have an action for links by default (I assumed it would try to xdg-open), while the description and README state that it can open links. Maybe a clarification in README would be nice.

jschlatow commented 2 years ago

It's a little confusing that taskopen doesn't have an action for links by default (I assumed it would try to xdg-open), while the description and README state that it can open links.

Good point ;-)