A work around I successfully used in debian, ubuntu and rhel7 is creating a short python script that's started automatically when you log into the gnome session. Note that in rhel7 the key combination to lock is super + l.
Create /etc/xdg/autostart/gscreenlock.py like this:
#!/usr/bin/python
import dbus
import dbus.service
import dbus.glib
import gobject
import os
class ScreenDbusObj(dbus.service.Object):
def __init__(self):
session_bus = dbus.SessionBus()
bus_name=dbus.service.BusName("org.gnome.ScreenSaver",bus=session_bus)
dbus.service.Object.__init__(self,bus_name, '/org/gnome/ScreenSaver')
@dbus.service.method("org.gnome.ScreenSaver")
def Lock(self):
os.system( "xscreensaver-command -lock" )
if __name__ == '__main__':
object=ScreenDbusObj()
gobject.MainLoop().run()
Then make it executable:
chmod a+rx /etc/xdg/autostart/gscreenlock.py
And edit /etc/xdg/autostart/gscreenlock.desktop like this:
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=gscreenlock
TryExec=/etc/xdg/autostart/gscreenlock.py
Exec=/etc/xdg/autostart/gscreenlock.py
NoDisplay=true
NotShowIn=XFCE;KDE;
Comment=Allows screen locking in gnome
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}