How can I bring up the lock screen from within a python app? I would like the application to do that for me instead of pressing the Ctrl-Alt-L separately.
Asked
Active
Viewed 2,853 times
1 Answers
8
For Ubuntu:
os.popen('gnome-screensaver-command --lock')
(Source)
For Windows:
import ctypes
ctypes.windll.user32.LockWorkStation()
(Source)

Community
- 1
- 1

Stephen Rauch
- 47,830
- 31
- 106
- 135
-
1what if gnome is not install, e.g if xfce is install what to do then? – Hossein Mar 07 '20 at 08:16