How can I allow the screen to auto-lock when virtualbox is focused?

On my linux (ubuntu 20.04) workstation i usually have a virtualbox VM with windows 10 running, to get access to some work-related things. If I accidentally leave the virtualbox window focused it prevents the screen saver from locking the screen.

Is there a setting, either in ubuntu or in virtualbox, that allows the screen saver to lock the screen when the virtualbox windows is focused?

Answer

There is no simple solution to this problem. The cause of the problem is that virtualbox captures the mouse pointer when it is focused and then when the screen-saver tries to capture it as well this fails. The only way to solve this would be to make virtualbox release the mouse pointer a moment before the screen-saver activates but I have not found a way to do this.

Attribution
Source : Link , Question Author : Johan , Answer Author : Johan

Leave a Comment