efa-cli Integration with Argos Gnome Extension
Argos is a GNOME Shell extension by Peter Waller that turns small shell scripts into drop-down menus in the top bar. Whatever your script outputs (system metrics, API data, anything), Argos shows it, and lets you interact with it right from the desktop.
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-cli
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 the 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 repository's 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 menu bar 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.
New to efa-cli? Start with Introducing EFA-CLI, or see departures on your phone with EVA-PWA.