efa-cli Integration with Argos Gnome Extension
Argos is a simple, flexible extension for GNOME Shell that allows users to display dynamic information in the top bar by writing small scripts. Created by Peter Waller, it transforms shell scripts into custom drop-down menus, making it a powerful tool for developers and power users. By providing real-time updates on various system metrics, API data, or any information your script can handle, Argos enables easy monitoring and interaction right from the desktop environment.
To add a simple command to Argos, you need to create a shell script that outputs the information in a specific format. The output is then displayed as a menu item in the top bar.
In this post, I will show you how to integrate the efa-cli with Argos Gnome Extension.
Install Efa
First, install efa-cli. You can do this by running the following command in your terminal:
wget https://github.com/simonjenny/efa-cli/blob/master/builds/efa?raw=true -O efa
chmod a+x efa && sudo mv efa /usr/local/bin
Create Argos Script
Create a new file in your Argos Config Directory ~/.config/argos
and name it departures.r.60s.sh
. The file name declares a reload of every 60 seconds. (More information about Filename format is available on the repositories README)
Open the file with your favorite text editor and add the following code:
#!/usr/bin/env bash
r=$(efa departures "YOUR STOP NAME" --limit=1 --json | jq '.[].realtime')
echo " $r' "
Replacing YOUR STOP NAME
with your desired stop name.
The Script will be added to the Menubar with the output of the realtime departure information in Minutes of the next transport at your chosen stop.
If you want a more precise output, you can use the GID to limit the output, for example, in a specific direction and spice up the output with some emojis:
#!/usr/bin/env bash
r=$(efa departures ch:23004:6192:1:1 --gid --limit=1 --json | jq '.[].realtime')
if [ $r -gt 2 ];then
echo " 🚏 $r' "
else
echo " 🚌💨 "
fi
The GID of a stop can be found by using the "efa stopinfo" command.