Last active
June 29, 2024 04:51
-
-
Save zkarj735/6db9d80816ed4b147fede889efd26ac2 to your computer and use it in GitHub Desktop.
A SwiftBar plugin to show how many external disks are connected
This file contains hidden or 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 | |
# Get a count of the number of external disks | |
count=$(df -Hl | grep '^/dev.*\s/Volumes' | wc -l | tr -d '[:space:]') | |
# Assuming less than 10, turn the number into an SF symbol, e.g. "5.square" | |
strip=$(echo -n "$count.square") | |
# Generate a list of the volume names to include in the menu for info | |
vols=$(df -Hl | grep '^/dev.*\s/Volumes' | sed -e 's|^/dev/.*/Volumes/||' | sort) | |
# Output | |
echo ":$strip: | sfcolor=#ffffff sfsize=18\n---\n$vols" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment