Is there any official/bult-in way to switch user using command line? I know that I can lock screen by
gnome-screensaver-command --lock (which is part of GNOME Flashback BTW) or
loginctl lock-session but I want to lock screen AND switch to GDM greeter.
Basically I want to have shortcut to switch user but there is no such option in Settings/Devices/Keyboard. There is only “lock screen” which does not satisfy me. Now, I solved this problem by creating script in my ~/.local/bin (which I have in $PATH) and using it in manually added keyboard shortcut in desktop settings. The script is here:
#!/bin/bash loginctl lock-session gdbus call \ --system \ --object-path /org/gnome/DisplayManager/LocalDisplayFactory \ --dest org.gnome.DisplayManager \ --method org.gnome.DisplayManager.LocalDisplayFactory.CreateTransientDisplay \ > /dev/null
Is there better solution?