Created
January 19, 2022 16:38
-
-
Save flegfleg/289f6934f82fd8d1b82d969a1dc7a1d2 to your computer and use it in GitHub Desktop.
xbar plugin: show hooked documents count
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
#!/usr/bin/env bash | |
# <xbar.title>Hook</xbar.title> | |
# <xbar.version>v1.0</xbar.version> | |
# <xbar.author>Florian Egermann</xbar.author> | |
# <xbar.author.github>flegfleg</xbar.author.github> | |
# <xbar.desc>Show the count of hooked documents in the menu bar.</xbar.desc> | |
count=$(osascript -e' | |
tell application "Hook" | |
set activeItem to (bookmark from active window) | |
set hookedBookmarks to hooked bookmarks of activeItem | |
set hookedBookmarksCount to count of hookedBookmarks | |
return hookedBookmarksCount | |
end tell | |
'); | |
if (($count > 0)) | |
then | |
echo "∞ $count" | |
else | |
echo "∞ | color=gray" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment