Making The Ultimate Habit trigger alarm system for your linux Computer.

If you wish to hack with me to make your own simple habit trigger alarm system then please read on:

Let us hack in steps.

Open your command shell — ctrl+alt+T

Type this in your shell :

DISPLAY=:0.0 zenity info — text=”Do your habits”

now type in this :

at now << EOF
DISPLAY=:0.0 zenity — info — text=””
EOF

For this project , create a new folder called habits.

cd habits

gedit testme.sh

add below command to testme.sh :

at now << EOF
DISPLAY=:0.0 zenity — info — text=””
EOF

go to command shell :

sh testme.sh

now edit testme.sh so that it has below command :

at now + 1 minute << EOF
DISPLAY=:0.0 zenity — info — text=””
EOF

Now replace (now+1 minute) with the actual time by looking at your system clock , add 1 minute to your current time.

edit testme.sh as below :

at<your current time + 1 minute> << EOF
DISPLAY=:0.0 zenity — info — text=””
EOF

Now Think about what time you wish to get the trigger for your habits?

In my case — I want a trigger alarm at 13:20 to go to my team standup meeting.

you decide your time . we will now add the time , command in your bashrc file.

All commands added in .bashrc file are executed the moment you open a new terminal on your computer.

open your .bashrc file to edit it

cd && gedit .bashrc

add this line to your bashrc :

at 13:30 << EOF
DISPLAY=:0.0 zenity — info — text=””
EOF

Test whether the command added to .bashrc by editing the time above to the next minute of your current time. open the command shell so all commands in bashrc are executed.

Now instead of zenity modal boxes that showup , let us open gtk windows for more flexibility to add features in the future.

add this to testme.sh

at now <<EOF
DISPLAY=:0.0 python /home/user/code/python/hello.py
EOF

create hello.py with below code:

import gi
import time
gi.require_version(“Gtk”, “3.0”)
from gi.repository import Gtk
def showAlert ():

window = Gtk.Window(title=”Hello World”)

window.connect(“destroy”, Gtk.main_quit)
window.show()
Gtk.main()

showAlert ()

check if adding in bashrc displays the boxes twice.

add to crontab =e

20 13 * * * sh /home/user/code/python/testme.sh

your testme.sh should look like this:

#!bin/bash
DISPLAY=:0.0 python /home/user/code/python/hello.py

In case you want a simpler setup and it is ok if the triggers happen only after you open the command prompt atleast once, then:

just add this to your .bashrc file :

at 12:00 <<EOF
DISPLAY=:0.0 python /home/user/code/python/hello.py
EOF
at 18:20 <<EOF
DISPLAY=:0.0 python /home/user/code/python/hello.py
EOF

The .bashrc file is called whenever you open your terminal.

so if you open terminal multiple times — multiple trigger windows will be open for you.

All feedback , comments are heartily welcome.

Programmer and Entrepreneur.

Programmer and Entrepreneur.