VMware Workstation prevents screen lock on a Linux (Ubuntu GNOME) host

2

I have a laptop that runs Ubuntu 16.04 with GNOME, and inside of this laptop I have VMware Workstation 12.5.1 running Windows 10.

My problem is that when I close the laptop with the VM in focus, it will go to sleep, but will not lock the screen, leaving me with this error message:

Unable to lock
Lock was blocked by an application

I tried following the VMware advice, but it's not actually relevant for the "close laptop lid" scenario.

The best approach I see is to try and press the Ctrl+Alt escape sequence with xdotool before the system tries to lock itself, but neither ways I tried to achieve this have worked.

I tried to make a dbus-monitor script - but this event is only sent upon a successful lock. I'm thinking if I could somehow monitor a failure to lock instead, this could work, but I do not know how to do that.

Another possible approach could be just overriding the block somehow, and making GNOME lock no matter what, but I worry that might cause problems like me not being able to enter my password, if the VM still captures all keystrokes.

Ezhik

Posted 2016-11-01T12:00:39.780

Reputation: 21

Answers

0

A few potential solutions:

  1. systemd script that would lock the screen on sleep - press the escape key sequence with xdotool, and then lock.

  2. Detect sleep (screen timeout) in the VM and then communicate that to the host

  3. Use something like xautolock to escape from the VM before the lock is triggered

Ezhik

Posted 2016-11-01T12:00:39.780

Reputation: 21