Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A simple program to display a warning message if I have been coding for more than 90 mins
#!/usr/bin/env bash
# add to cron tab
# crontab -e
# then append:
# */30 * * * * /home/kevin/
# need to have:
# xhost local:mpromber > /dev/null
# in bashrc
# fetch the pid of my editor process
pids=($(pgrep atom))
if [[ -z "$pid" ]]; then
echo "atom proccess not found"
uptime=$(ps -p "$pid" -o etimes=)
mins=$((uptime / 60))
if [[ $mins -gt 90 ]]; then
zenity --warning --text="you've been coding for $mins minutes" --display=:0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.