Skip to content

Instantly share code, notes, and snippets.

@flegfleg
Created January 19, 2022 16:38
Show Gist options
  • Save flegfleg/289f6934f82fd8d1b82d969a1dc7a1d2 to your computer and use it in GitHub Desktop.
Save flegfleg/289f6934f82fd8d1b82d969a1dc7a1d2 to your computer and use it in GitHub Desktop.
xbar plugin: show hooked documents count
#!/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