Tips requested for implementing a focus timer / tweaking RSIbreak

Tips requested for focus timer / tweaking RSIbreak

Dear Manjaro community,

There are several tools out there that help with focus
and taking Pomodoro breaks, but so far I have not
found any that does exactly what I need.
Therefore I want to implement something of my own,
or modify the closest existing project RSIbreak (RSI Break - KDE Applications).
While I can program, I do not have much experience
with integrating it with Linux and KDE
(in particular, the KDE edition of Manjaro).

I will first state what I seek,
and thereafter a few ideas of how I may approach it.
I would be very grateful for any advice which approach would
be the best!
(Or for pointing me out to an already existing application
I have missed).

Requirements

  1. By default it turns internet off, in such a way
    that just clicking the button on the desktop
    cannot simply turn it back on.
  2. After every interval, say 25 min, it should
    first aggressively prevent the user from working on,
    for at least 5 minutes.
    A mere notification does not work.
  3. Thereafter it should show a popup, asking for
    confirmation to start the next 25 min interval.
  4. The popup has a second button that allows
    to do one interval of 25 seconds with internet available.
    At the end of this interval the internet should be turned
    off again.

It does not need to be fancy, being quick to implement is more important.

Currently I use a Bash script that sleeps for 25 minutes
and then logs out. But I often forget to turn it back on
(hence point 3),
logging in is in my muscle memory and I tend to continue working
(hence point 2),
and it does not control internet access – a notorious enemy
of getting things done!

Implementation ideas

I currently consider three approaches:

  1. Creating something entirely new.
  2. Forking and modifying the existing project: RSIbreak
    (RSI Break - KDE Applications, present in the Manjaro repositories)
    This is a bit daunting because I have never worked in Qt before.
    It has a wonderful aggressive 5-minute blackout,
    but starts the next session immediately.
    I want to give the user an opportunity to have a walk,
    get a drink, visit the bathroom, etc. between
    session whens needed.
    It also does not control internet.
  3. A bit hacky: RSIbreak allows to execute a command
    at the end of a session.
    Here I could put in my popup application asking for a confirmation.
    RSIbreak can be paused an resumed via dbus,
    so my application could use that.

I am not sure how best to disable internet access.
My best idea so far is running a daemon that turns
WiFi off every minute – I once found a command how
to do that in KDE.
I suppose that it could listen to a dbus command that pauses
it for 25 minutes. Cleaner solutions are very welcome!

Thank you in advance!

I see something about network in Workrave’s settings, but i have not really tested it.

1 Like

So you can put here these two commands - first for disconnecting second for reconnecting internet :wink:

nmcli connection down <connection name>
nmcli connection up <connection name>

And any other command – like kill Firefox (killall firefox)

1 Like

Thank you for the tips!

I could not find anything on Workrave’s website about blocking internet,
but I will try to install it anyway out next week
(currently I don’t have a sufficiently good internet connection for a system update).

If it does not work, I will try to manually hack something together.

I will try to give a progress update later next week.