0

I am curious how applications like gksu lock screen focus when prompting for a password. I see gksu even has an option "-g", that can disable this behavior.

I am interested in doing something similar for a Python app (I used Quickly to generate the GUI app -- GTK+3) but I can't find any info on how this could be done. I have found things like fullscreen(), etc but I really like how gksu does it.

I am using Lubuntu 14.04 (LXDE)

Any pointers or suggestions would be appreciated.

Monty
  • 3

1 Answers1

0

If you look at the source code you will see the functions grab_keyboard_and_mouse() and ungrab_keyboard_and_mouse(), which do the locking and unlocking.

The core locking and unlocking functions are done by calling the GTK library functions gdk_pointer_grab() and gdk_keyboard_grab() and their ..._ungrab() equivalents.

You would need to make these functions callable from Python, but I don't know if that is a simple task or not. Alternatively, maybe you can find a program which puts up a message box with some input fields and buttons, like an extended xmessage, but locking the screen while it's active.

AFH
  • 17,958