Created
February 13, 2023 16:44
-
-
Save qoomon/a87c3a3b98137e37f6ba8c4cf75b237b to your computer and use it in GitHub Desktop.
xBar - Colima Status
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# <xbar.title>Colima Status</xbar.title> | |
# <xbar.author>Bengt Brodersen</xbar.author> | |
# <xbar.author.github>qoomon</xbar.author.github> | |
# <xbar.desc>Displays Colima Status - https://github.com/abiosoft/colima</xbar.desc> | |
source ~/.zprofile | |
DOCKER_RUNNING_ICON='iVBORw0KGgoAAAANSUhEUgAAACoAAAAqCAYAAADFw8lbAAAAAXNSR0IArs4c6QAAAIRlWElmTU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAACQAAAAAQAAAJAAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAACqgAwAEAAAAAQAAACoAAAAAxiJEngAAAAlwSFlzAAAWJQAAFiUBSVIk8AAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDYuMC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KGV7hBw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ZpgR2N2EIuKsNgnRdwa+FW4kMNwny6OiI+S7PBEGqiTpq1mucqgILrkpqNbiplmUI4X5XKBRMxaLft0CBNZmbzmHwj//TPtnM5XKsmfVlIAlCYDd9giTYTQr82fAtrq+v7/b39+XJXuZfoKj2EfYZs3bZxHWPkRx+iCDkJ3A9WRRy5VdUq9VbUH/JRRA3edWEf9Ey5Cjiumma56VSqXEfSGKQxQ8hOGdnE+EnSOSlwFdSs1Kp1OjXe7rZnye85nQs6CD87XQ6zeJrzZu4Bh1vKZsgweR33DjvaZP+V7HtXifI1Y9I7ClqqlgnWIIjHqSWztsHn2yfcYd/UCBXYZNz5W5UjuDezeIae5PP57lri3UVjtyPBi5YRQhOVRKC44UCEkzoPuFM9Bwb9L3ymXBpV2AvLi4SMPgCt0WOBvnJhcMmWWFfgee7EgcU5+gc58EkOK5FpEzU6i8HBwffOF/5UWtXbV2gfiPtdnsXTqswnMdHS5iOlRCYEjJOYcuvHueGG2JdN5PJNJD3l2ruQ0Fy/W9AqfAbq9VqERyANECkADaO8Sjyir8JzG8bbAH3bIL3W4wNsCkTJWfgzT2/TfpZm9A4n4ca/Nv1fr+rACFg/7qlfS+bSycGgwED9zPwExE0W+usZCqZAAAAAElFTkSuQmCC' | |
DOCKER_STATUS_FILE='/tmp/xbar_docker_status' | |
docker_status=$(cat $DOCKER_STATUS_FILE) | |
if [ $# = 0 ] | |
then | |
if [ $docker_status = starting ] | |
then | |
echo "|templateImage=$DOCKER_PROGRESS_ICON" | |
echo '---' | |
echo "Starting Colima..." | |
exit 0 | |
fi | |
if [ $docker_status = stopping ] | |
then | |
echo "|templateImage=$DOCKER_PROGRESS_ICON" | |
echo '---' | |
echo "Stopping Colima..." | |
exit 0 | |
fi | |
if colima status >/dev/null | |
then | |
echo "|templateImage=$DOCKER_RUNNING_ICON" | |
echo '---' | |
echo "Stop Colima | terminal=false bash=$0 param1=stop" | |
else | |
echo "| templateImage=$DOCKER_STOPPED_ICON" | |
echo '---' | |
echo "Start Colima | terminal=false bash=$0 param1=start" | |
fi | |
exit 0 | |
fi | |
if [ $1 = start ] | |
then | |
echo "starting" > $DOCKER_STATUS_FILE | |
colima start | |
echo "" > $DOCKER_STATUS_FILE | |
exit 0 | |
fi | |
if [ $1 = stop ] | |
then | |
echo "stopping" > $DOCKER_STATUS_FILE | |
colima stop | |
echo "" > $DOCKER_STATUS_FILE | |
exit 0 | |
fi | |
exit 1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment