[Users] [SOLVED]Re: Action to integrate Claws with Taskwarrior

Saša Janiška gour at atmarama.com
Sun Sep 19 09:34:56 CEST 2021


On Wed, 14 Jul 2021 07:06:56 -0700
sylpheed at 911networks.com wrote:

Hello and I apologize for taking so long...but I was exploring other options
like Emacs/org-mode, THunderbird, (neo)mutt etc., changing distro (from
Debian/Sid to MXLinux (21)...and finally concluded that both Claws-mail &
Taskwarrior are best (for me) in their class!

> I'm interested.  When you get CM to generate tasks in tw, please let
> us (me in this case) know how you've done it.

So, the integration goes like this:

1) system requirements

You need Claws-mail and Taskwarrior installed as well as Tasklib
(https://github.com/GothenburgBitFactory/tasklib) package as well as Taskopen
(https://github.com/jschlatow/taskopen).


In Debian/mxlinux it's packaged as python3-tasklib.

2. In order to integrate Claws-mail & Taskwarrior I modified the mutt2task
script from task-attach project
(https://github.com/alkim0/task-attach/blob/master/bin/mutt2task) and you have
to put it somewhere in your PATH. 

I named it as claws2task and I include it in the attachment...


Let me just comment few lines:

tw.overrides['gc'] = '0' # workaround for tasklib bug which was debugged 

with the help of tbabej see
https://github.com/GothenburgBitFactory/tasklib/issues/97    

task = Task(tw, description=desc, tags=['inbox','email'])
        task.save()

I want that every task created from within Claws-mail gets two tags: +inbox and
+email...and get annotated with the link to open it from Taskwarrior. Moreover,
task's descriptios is message's Subject prepended with 'claws:', so you're free
to adjust it according to your preferences.

3. Now one needs to add the folowing action as shell commandto Claws-mail which
I put on the Toolbar and named Taskwarrior:

/path/to/the/script/claws2task %f


Now clicking on certain mail or news (NNTP) message should create a new
Taskwarrior task.

4. In order to be able to (task)open the message in Claws-mail, we need to
configure it for xdg-open...

If you query some mail/news message with e.g.

xdg-mime query filetype ~/.claws-mail/imapcache/some/mail/account/INBOX/12345
you should get:

message/rfc822 for imap and
message/news for NNTP messages.

Now, when i was checking default association on my system with:

xdg-mime query default message/rfc822 it was tied to Evolution, while
message/news was not tied to anything.


Create the following file:

[Desktop Entry]
Version=1.0
Type=Application
Name=Claws-mail Select Handler
Comment=Claws-mail integration with Taskwarrior
Icon=applications-other
Exec=claws-mail --select %u
MimeType=x-scheme-handler/claws-select;


as e.g. ~/.local/share/applications/claws-select.desktop and then configure new
filetype with:

xdg-mime default claws-select.desktop message/rfc822
xdg-mime default claws-select.desktop message/news

Check that everything is OK with:

$ env XDG_UTILS_DEBUG_LEVEL=10  xdg-mime query default message/rfc822
Checking /home/gour/.config/mimeapps.list
claws-select.desktop


Now you can also try whether you can open mail/news messages with xdg-open in
your terminal.

Finally, after you create task #xyz within Claws-mail, you should be able to
see it within Taskwarrior -filter with e.g. +inbox +email and then you should
be able to issue: task open #xyz and you should see it it higlighted in
Claws-mail.

Probably, the whole integration could be improved, but for now it's good-enough
for my purposes- ;)

Hope it helps and contact me if you encounter some problems...


Sincerely,
Gour

 from your ~/.claws-mail/imap(news) cache you should get:


-- 
The senses are so strong and impetuous, O Arjuna,
that they forcibly carry away the mind even of a man
of discrimination who is endeavoring to control them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: claws2task
Type: application/octet-stream
Size: 800 bytes
Desc: not available
URL: <http://lists.claws-mail.org/pipermail/users/attachments/20210919/cd70f8f3/attachment.obj>


More information about the Users mailing list