Skip to content

Instantly share code, notes, and snippets.

@corentinbettiol
Last active January 13, 2021 19:14
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save corentinbettiol/634b6f95928ccb702ac790f16a584caf to your computer and use it in GitHub Desktop.
Save corentinbettiol/634b6f95928ccb702ac790f16a584caf to your computer and use it in GitHub Desktop.
Homemade timetracking in its simplest form.

What ?

It's a very simple timetracking tool for linux users that use systemd services & zenity.

screenshot (source)

How to install

  1. Put timetracking.sh on your computer.
    Do not forget to set correct paths & chmod +x the script
  2. Create file /etc/systemd/system/timetracker.service (put content of timetracker.service inside).
    Do not forget to set correct path to timetracking.sh & systemctl enable timetracker
  3. Apply changes with sudo systemctl daemon-reload

Screenshots

img

img

img

Licence

WTFPL2

[Unit]
Description=Really simple timetracking tool.
[Service]
Type=simple
Environment="DISPLAY=:0"
Environment="XAUTHORITY=/home/YOUR USER HERE/.Xauthority"
ExecStart=/YOUR/PATH/TO/timetracking.sh
Restart=on-failure
[Install]
WantedBy=multi-user.target
#!/bin/sh
#
# timetracking.sh - a really simple semi automated timetracking tool
# version 1.0.1
#
# Licensed under WTFPL v2 - see https://wtfpl2.com/
# Corentin Bettiol - 2020
#
# The goal here is to ask what you are doing 5 minutes after your computer startup,
# and then every 30 minutes.
# > (/etc/systemd/system/timetracker.service)
savetimeandtextinfile () {
filelocation="/home/co/suivi/timetracking.txt"
txt=$(zenity --entry --text="What are you doing right now?" --title="timetracking.sh - [$datetime]" --width="330" --display=:0.0)
datetime=$(date '+%d/%m/%Y %H:%M:%S')
echo "[$datetime] $txt" >> $filelocation
}
sleep 300
savetimeandtextinfile
while sleep 1800;
do
savetimeandtextinfile
done
@arsenico13
Copy link

Nice, thanks!

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