zsh.li Pinkhat Memories Me About ?

Dear My
Linux

how fedi amin reads you

POST_AT

Today you will learn how your admin (@admin@gentoo.live), reads you, notifications on account are shown in my terminal using shell scripts, the only requirement is to install this python app (toot) toot

This works for me because I always have several terminals opened, each time I have a new prompt (i.e, after running a command) my admin notifications are displayed if there are new.

1. First I run this script with cron each 15 minutes (*/15 * * * * *):

#! /bin/bash
if ping -c 1 -q duckduckgo.com >&/dev/null ; then
toot notifications | head -20 > /tmp/admin
fi

2. I created the following script:

#! /bin/sh
cd /tmp
if  ! sha256sum -c admin.sum >/dev/null; then
cat /tmp/admin
sha256sum admin > admin.sum
fi

3. Add the following environment variable to .bashrc to run the second script:

PROMPT_COMMAND="sh script.sh"

If you are using zsh in .zshrc add this code besides the environment variable:

precmd() { eval "$PROMPT_COMMAND" }

That's all!