How to trigger Xmonad.Prompt.AddFile on recurrent times?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to trigger Xmonad.Prompt.AddFile on recurrent times?

Alejandro Garcia
Hello In order to help with my personal productivity.
I want to register what I'm doing every 15 minutes or so.

And using Xmonad.Prompt.AddFile is very easy.
Currently I launch it with a key combination and I can start writing
what I'm doing in this moment.

However, no I would like to automatically launch AddFile every 15 minutes...
Ideally from cron (which I know)
or maybe xmonad has a way to do it itself?



--
Alejandro García F. (elviejo)

Too brief? Here's why! http://emailcharter.org

EOM – End Of Message. The whole message is in the subject don't need to open it.
NNTR – No Need To Respond. Help cut down on all those “cool” and
“thanks” emails.
SINGLE SUBJECT. Send one email for one topic, this makes replies easy..
CLEAR CALL TO ACTION: Ask for some specific result very clearly.
_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Reply | Threaded
Open this post in threaded view
|

Re: How to trigger Xmonad.Prompt.AddFile on recurrent times?

Platon Pronko
Hi!

I'm not an expert, but it seems that forking a thread inside XMonad itself wouldn't work - there is no function that will allow you to convert X () back to IO (), thus you can't use the usual forkIO calls.

You can probably implement something via X events and server-mode hooks: https://hackage.haskell.org/package/xmonad-contrib-0.16/docs/XMonad-Hooks-ServerMode.html

But may I suggest using a much simpler approach and skipping XMonad entirely? You can use for example `yad` or `zenity` to display a graphical input box directly from a script. For example something like the following:

$ yad --text="Current activity:" --entry >> activity-log.txt

Best regards,
Platon Pronko

On 2020-04-22 18:05, Alejandro Garcia wrote:

> Hello In order to help with my personal productivity.
> I want to register what I'm doing every 15 minutes or so.
>
> And using Xmonad.Prompt.AddFile is very easy.
> Currently I launch it with a key combination and I can start writing
> what I'm doing in this moment.
>
> However, no I would like to automatically launch AddFile every 15 minutes...
> Ideally from cron (which I know)
> or maybe xmonad has a way to do it itself?
>
>
>
_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Reply | Threaded
Open this post in threaded view
|

Re: How to trigger Xmonad.Prompt.AddFile on recurrent times?

Brandon Allbery
There are also time tracking programs for this.

The way to do this inside xmonad is to send a ClientMessage event which is handled in the handleEventHook. You could send the event from a cron job, or fork a thread which opens its own server connection (X11 only pretends to be thread safe) and sends it after a delay.

On Wed, Apr 22, 2020, 11:53 Platon Pronko <[hidden email]> wrote:
Hi!

I'm not an expert, but it seems that forking a thread inside XMonad itself wouldn't work - there is no function that will allow you to convert X () back to IO (), thus you can't use the usual forkIO calls.

You can probably implement something via X events and server-mode hooks: https://hackage.haskell.org/package/xmonad-contrib-0.16/docs/XMonad-Hooks-ServerMode.html

But may I suggest using a much simpler approach and skipping XMonad entirely? You can use for example `yad` or `zenity` to display a graphical input box directly from a script. For example something like the following:

$ yad --text="Current activity:" --entry >> activity-log.txt

Best regards,
Platon Pronko

On 2020-04-22 18:05, Alejandro Garcia wrote:
> Hello In order to help with my personal productivity.
> I want to register what I'm doing every 15 minutes or so.
>
> And using Xmonad.Prompt.AddFile is very easy.
> Currently I launch it with a key combination and I can start writing
> what I'm doing in this moment.
>
> However, no I would like to automatically launch AddFile every 15 minutes...
> Ideally from cron (which I know)
> or maybe xmonad has a way to do it itself?
>
>
>
_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad

_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Reply | Threaded
Open this post in threaded view
|

Re: How to trigger Xmonad.Prompt.AddFile on recurrent times?

Matthew Nicholson
In reply to this post by Alejandro Garcia
You could use xdotool, github.com/jordansissel/xdotool, to trigger the keyboard shortcut.
For example `xdotool key super+f` fakes pressing the super key and f.

On Wed, 22 Apr 2020 at 16:06, Alejandro Garcia <[hidden email]> wrote:
Hello In order to help with my personal productivity.
I want to register what I'm doing every 15 minutes or so.

And using Xmonad.Prompt.AddFile is very easy.
Currently I launch it with a key combination and I can start writing
what I'm doing in this moment.

However, no I would like to automatically launch AddFile every 15 minutes...
Ideally from cron (which I know)
or maybe xmonad has a way to do it itself?



--
Alejandro García F. (elviejo)

Too brief? Here's why! http://emailcharter.org

EOM – End Of Message. The whole message is in the subject don't need to open it.
NNTR – No Need To Respond. Help cut down on all those “cool” and
“thanks” emails.
SINGLE SUBJECT. Send one email for one topic, this makes replies easy..
CLEAR CALL TO ACTION: Ask for some specific result very clearly.
_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad

_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
vrs
Reply | Threaded
Open this post in threaded view
|

Re: How to trigger Xmonad.Prompt.AddFile on recurrent times?

vrs
In reply to this post by Alejandro Garcia
Hi,
I used to use arbtt for this kind of thing, you may want to check it out:
https://arbtt.nomeata.de/

I only stopped using it because it turned out I didn't much care about
the stats after all. But it did in fact work so well that I often forgot
it existed.

-vrs

Quoting Alejandro Garcia (2020-04-22 17:05:42)

> Hello In order to help with my personal productivity.
> I want to register what I'm doing every 15 minutes or so.
>
> And using Xmonad.Prompt.AddFile is very easy.
> Currently I launch it with a key combination and I can start writing
> what I'm doing in this moment.
>
> However, no I would like to automatically launch AddFile every 15 minutes...
> Ideally from cron (which I know)
> or maybe xmonad has a way to do it itself?
>
>
>
> --
> Alejandro García F. (elviejo)
>
> Too brief? Here's why! http://emailcharter.org
>
> EOM – End Of Message. The whole message is in the subject don't need to open it.
> NNTR – No Need To Respond. Help cut down on all those “cool” and
> “thanks” emails.
> SINGLE SUBJECT. Send one email for one topic, this makes replies easy..
> CLEAR CALL TO ACTION: Ask for some specific result very clearly.
> _______________________________________________
> xmonad mailing list
> [hidden email]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad