Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre/post triggers for VIT actions #209

Open
thehunmonkgroup opened this issue Oct 15, 2019 · 9 comments
Open

Pre/post triggers for VIT actions #209

thehunmonkgroup opened this issue Oct 15, 2019 · 9 comments
Milestone

Comments

@thehunmonkgroup
Copy link
Member

I've been thinking about how VIT behaves after creating a new task -- currently it simply reloads the report fresh.

There's some convenience things we could do, but I'm unclear about how useful they might be, and /or how best to implement them. Ideas:

  • Focus on the added task after the report reloads. This could be just hard wired, or a config value with a sensible default (which is?)
  • Run a custom action/command after the task is added. Examples could be {ACTION_TASK_EDIT} or !rw myscript.sh {TASK_UUID}. Obviously a config option disabled by default.

Looking for some thoughts on the above and any other suggestions folks might have.

@scottkosty
Copy link
Member

  • Focus on the added task after the report reloads. This could be just hard wired, or a config value with a sensible default (which is?)

I think this was also requested at #109.

  • Run a custom action/command after the task is added.

Interesting. This opens up a huge box of possibilities. Perhaps you want to avoid this rabbit hole, but I cannot help but think about it so I log some thoughts here: What are all the possible triggers/signals that hooks could condition on? Adding/modifying/completing/deleting a task are some examples; detecting that pending.data changed (#191) is another. Perhaps this relates to the plugin architecture that you have in mind.

@thehunmonkgroup thehunmonkgroup changed the title Focus behavior on new task creation Execute actions/scripts after some VIT action Oct 15, 2019
@thehunmonkgroup thehunmonkgroup changed the title Execute actions/scripts after some VIT action Pre/post triggers for VIT actions Oct 15, 2019
@thehunmonkgroup
Copy link
Member Author

Cool, excellent idea, and glad I asked!

I've updated the title of the issue accordingly.

It should be fairly easy to implement these custom post triggerrs (and for that matter, pre triggers), and to add config options for each of them. At the plugin level, if/when that is implemented, we could emit events for each of the triggers that any plugin can listen for.

So now, we need to make some decisions:

  • What VIT actions do we want a pre/post trigger for?
  • What's the format of the config options for pre/post triggers?

@thehunmonkgroup thehunmonkgroup added this to the v2.x milestone Oct 15, 2019
@scottkosty
Copy link
Member

scottkosty commented Oct 15, 2019

Ah good point about pre-triggers! Probably we should study interfaces of other frameworks. I've never actually used Taskwarrior hooks or Git hooks.

I would add another question that might affect decisions: what are some motivating examples for practical things that this feature can be used for? It might be nice to go through the list of issues and see if any of them could be addressed with this sort of framework. I can take a look at that, but probably not for a couple of weeks.

@scottkosty
Copy link
Member

I can take a look at that, but probably not for a couple of weeks.

I wasn't able to get to this and am not sure when I will now. @thehunmonkgroup if you are waiting on me to do this, let me know and I will try to get to it when I can.

@thehunmonkgroup
Copy link
Member Author

@scottkosty I'm not rushing this issue at all, so when you have time go ahead and post your findings here.

@scottkosty
Copy link
Member

@thehunmonkgroup sounds good, thanks.

@ahillio
Copy link

ahillio commented Jun 29, 2020

This would be a lovely feature enhancement, most particularly in my case to be able to automatically highlight/select a task after it's created.

Is this proposed pre/post hook triggers dependent on a plugin architecture first being implemented?

@thehunmonkgroup
Copy link
Member Author

@ahillio I don't think it is, as long as it's architected to easily support the addition of the plugin architecture in the future it could be done first.

@nfraprado
Copy link
Contributor

I just noticed that when a task is added, the cursor goes back to the first task in the report, probably due to the report being reloaded.

  • Focus on the added task after the report reloads. This could be just hard wired, or a config value with a sensible default (which is?)

To me it would make most sense to always focus on the previously focused task, so that could be the default.

Maybe then setting the config value to focus on the added task would focus on the previously focused task as a fallback if it isn't in view?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants