Hmm this sounds weird, the workflow writes "(logged in)" on users who are listed by the "who" command. I made a small mistake so it will also match a username that is a subset of another username that is logged in... But otherwise it should reliable identify logged in users...
I will correct the mistake when I come home.
Well I checked with who on my Mac and everything there is right, plus the other usernames appearing as logged-in are not subsets of the other ones.
I posted a capture (removing the usernames) here.
On the capture, only the first user is logged in.
This part of the script is not excluding entries that get 0 through who:
# check if the user is logged in, if so then add (logged in) to the name
if [[ $(who | grep -c "$USERNAME ") -gt 0 ]]
LOGINSTATUS=" (Logged In)"
It also looks like the syntax of the entries doesn't match the one on your first capture (e.g.: $RealName is not parsed as my real name):
# fuzzymatch with real name and username
if [[ " $REALNAME" == *\ $QUERY* || $USERNAME == $QUERY* ]]
# if match is found display the user
echo "<item uid=\"fastuserswitch $USERNAME\" arg=\"$USERNAME\">"
echo "<title>$REALNAME$LOGINSTATUS</title><subtitle>Switch to $REALNAME</subtitle>"