I copied the following Bash script from MacScripter and combined it with TextExpander's ability to execute Apple Script in order to give me the ability to switch to the Login screen via a keyboard shortcut (I mapped it to 'ffus').
BASH:
-
#!/bin/sh
-
# Fast User Switching from the command line
-
# I saved mine as /usr/local/bin/fus
-
-
CGSession='/System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/CGSession'
-
-
case "$#" in
-
0)
-
# display login screen
-
exec "$CGSession" -suspend
-
exit
-
;;
-
esac
-
-
# No reason to display the login panel for the current user
-
case "$1" in
-
"$USER" | "$UID")
-
exit 0
-
;;
-
esac
-
-
# can pass in a (short) username or userid
-
id=`/usr/bin/id -u "$1"` || exit
-
-
# display login panel for user
-
exec "$CGSession" -switchToUserID "$id"
The Apple Script I use to invoke this from TextExpander is:
APPLESCRIPT:
-
do shell script "/usr/local/bin/fus "
0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment