Fast User Switching/Apple Menu?

18,898

If adding a keyboard shortcut would be acceptable, then one can invoke CGSession -suspend to show the fast user switching. (You can use CGSession -switchToUserID `id -g bob` , for example, to switch to a specific user.)

Searching for that word CGSession will reveal many options, like Equivalent of Win-L on Mac or Create a keyboard shortcut for fast user switching in Mac OS X.

And rather than adding it to the Apple menu, in 10.6 Snow Leopard it's quite easy to add it to the Services menu of each application:

  • Start Applications » Automator

  • Select "Service" for the template of the new Automator workflow

  • In the top of the right pane, select "Service receives no input in any application"

  • Drag action "Run Shell Script" from the left pane into the workflow on the right pane

  • Leave Shell at its default "/bin/bash", and replace the default command cat with the following, without any line breaks:

    /System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend

  • Optional: click the Run button to test

  • Hit Cmd-S to save. The name you type will be the name in the Services menu. The workflow will be saved in ~/Library/Services.

Fast User Switching in Automator

To assign a keyboard shortcut, in 10.6:

  • Open System Preferences » Keyboard » pane Keyboard Shortcuts
  • Select "Services" in the left pane
  • Scroll down to General in the right pane
  • Double-click to the right of the Automator workflow you just created
  • Press the keys you want to use, and switch panes to ensure the new shortcut is saved
    • Please note that in 10.6 there is a bug that might prevent you from assigning services to function keys.
Share:
18,898

Related videos on Youtube

cust0s
Author by

cust0s

Updated on September 17, 2022

Comments

  • cust0s
    cust0s almost 2 years

    I like fast user switching but I'm not keen on it in my menu bar, I'm wondering if it's possible to put it in the Apple menu? Or somehow change the Logout option in the Apple menu to switch users instead?

  • Gurjeet Singh
    Gurjeet Singh almost 10 years
    I tried assigning Cmd-L as the shortcut, to make is similar to Windows' Win-L, but that didn't work because some applications, like Web Browsers, use Cmd-L shortcut too. So I ended up assigning Cmd-Shift-L, instead.
  • Gurjeet Singh
    Gurjeet Singh almost 10 years
    I tried assigning Cmd-L as the shortcut, to make is similar to Windows' Win-L, but that didn't work because some applications, like Web Browsers, use Cmd-L shortcut too. I tried some other combinations, but none of them worked in all the apps I use regularly. So I ended up assigning Cmd-Shift-2, instead.
  • Arc676
    Arc676 almost 9 years
    Just to make this more up-to-date: I can confirm this still works on Yosemite 10.10.5.
  • Jay Sullivan
    Jay Sullivan almost 3 years
    For anyone wondering how to edit an existing "Service": in finder, navigate to ~/Library/Services (or press Cmd-Shift-G and type the path directly), then double click on your "Service". It should open in automator.