… of many things …

March 25, 2009

New MacHeist Bundle

Filed under: Mac — Tags: — Jason Rogers @ 10:06 am

Just picked up the new MacHeist Bundle: http://www.macheist.com/bundle/u/110143/

June 22, 2008

Fast User Switching via Keyboard

Filed under: Mac — Tags: — Jason Rogers @ 9:28 pm

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:
  1. #!/bin/sh
  2. # Fast User Switching from the command line
  3. # I saved mine as /usr/local/bin/fus
  4.  
  5. CGSession='/System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/CGSession'
  6.  
  7. case "$#" in
  8. 0)
  9. # display login screen
  10. exec "$CGSession" -suspend
  11. exit
  12. ;;
  13. esac
  14.  
  15. # No reason to display the login panel for the current user
  16. case "$1" in
  17. "$USER" | "$UID")
  18. exit 0
  19. ;;
  20. esac
  21.  
  22. # can pass in a (short) username or userid
  23. id=`/usr/bin/id -u "$1"` || exit
  24.  
  25. # display login panel for user
  26. exec "$CGSession" -switchToUserID "$id"

The Apple Script I use to invoke this from TextExpander is:

APPLESCRIPT:
  1. do shell script "/usr/local/bin/fus "

Powered by WordPress