Jump to content

Hi!

I thought someone besides me might be interested in getting a TeamTrees counter set up.

 

1) I created a simple shell script which retrieves the number of trees which will be planted so far:

curl -s https://teamtrees.org/ | grep id=\"totalTrees\" |egrep -o '[[:digit:]]+' | head -1

With this you can choose your way to display it, e.g. a digital screen, a notification, an widget or whatever.. I chose a MacOS notification.

 

To do this I put the script in MacOS automator application like so:

Screen-Shot-2019-10-30-at-14-28-14.png

Changed the icon to a random tree found in google.

And saved it to the Applications folder.

 

2) Then to run hourly I added a plist file to ~/Library/LaunchAgents named org.teamtrees.plist

With the following content: 


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>org.teamtrees</string>

  <key>ProgramArguments</key>
<array>
<string>/usr/bin/open</string>
<string>-W</string>
<string>/Applications/Trees.app</string>
</array>

  <key>StartInterval</key>
  <integer>3600</integer>

  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>

 

3) Loaded it using:

launchctl load org.teamtrees

 

And now I get a notification like this one hourly: 

Screen-Shot-2019-10-30-at-14-36-04.png

 

GL HF!

CPU: Ryzen 3 3600 | GPU: Gigabite GTX 1660 super | Motherboard: MSI Mortar MAX | RAM: G Skill Trident Z 3200 (2x8GB) | Case: Cooler Master Q300L | Storage: Samsung 970 EVO 250G + Samsung 860 Evo 1TB | PSU: Corsair RM650x | Displays: LG 27'' G-Sync compatible 144hz 1080p | Cooling: NH U12S black | Keyboard: Logitech G512 carbon | Mouse: Logitech g900 

Link to comment
https://linustechtips.com/topic/1118824-teamtrees-counter/
Share on other sites

Link to post
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×