I was using from time ago this extension for Gnome named Argos which allows to create useful data views using scripts written in whatever language of choice available, bash included.

So far I had just a simple extension writing a unicode character, but with the suggestion of my colleage Javi Ramirez, I decided to use the motivational idea to write a simple script to calculate how much you’ve earned so far in the day and show that information at a glance on your menu bar.

File is available here, and must be named like showmethemoney.1s.sh inside your argos folder.

Content is very simple:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
# Author: Pablo Iranzo Gómez (Pablo.Iranzo@gmail.com)
# Description: Script to calculate earned money so far in the day
# Adjust DAILY to the daily income, adjust DAYSTART hour and DAYEND hour to your working schedule

# Customize to suit your details
DAYSTART="8:00"
DAYEND="17:00"
DAILY=1000
SYMBOL="€"



URL="github.com/p-e-w/argos"
DIR=$(dirname "$0")

EARNED=""
DAILYTOTAL=$(echo "scale=4; $DAILY/(9*60*60)"| bc)
UNIXSTART=$(date --date="${DAYSTART}" +"%s")
UNIXNOW=$(date +"%s")
UNIXEND=$(date --date="${DAYEND}" +"%s")

if [[ ${UNIXNOW} -gt ${UNIXEND} ]]; then
    EARNED=${DAILY}
elif [[ ${UNIXNOW} -gt ${UNIXSTART} ]]; then
    EARNED=$(echo "scale=2; $DAILYTOTAL * (${UNIXNOW}-${UNIXSTART})" | bc)
else
    EARNED="0"
fi

STRING="💰 ${EARNED}${SYMBOL} 💰"

echo "$STRING | refresh=true"
echo "---"
echo "$URL | iconName=help-faq-symbolic href='https://$URL'"
echo "$DIR | iconName=folder-symbolic href='file://$DIR'"

It checks if day has started or it’s over and if in between, it calculates the amount based on unix epoch.

For more details about developing them, check argos link above!

Enjoy!

Like this post? Share on: TwitterFacebookEmail


Pablo Iranzo Gómez Avatar Pablo Iranzo Gómez opensource enthusiast and Lego fan doing some python simple programs like @redken_bot in telegram, etc
Comments

comments powered by Disqus

Keep Reading


Published

Category

tech

Tags

Stay in Touch