How to replace Gnome 3.4 Screensaver with Xscreensaver

Write tutorials and howtos in here
More tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Do not start a support topic here please, Before you post please read this

How to replace Gnome 3.4 Screensaver with Xscreensaver

Postby maxibuntu on Sun Dec 09, 2012 9:03 am

The Gnome 3 screensaver is nothing compared to Xscreensaver so I replaced it.

All the following commands can be run from a Terminal, like for instance gnome-terminal. You can easily select and copy a command from this page, then paste it in a terminal, and hit enter.

I have a sudo setup on LMDE, if you have an su setup like on standard Debian, use:

Code: Select all
su -


...and enter the root password, and commands.

But we will continue with the sudo version:

Remove Gnome Screensaver and install Xscreensaver:

Code: Select all
sudo apt-get remove --purge gnome-screensaver
sudo apt-get install xscreensaver


Remove old autostart entry for gnome-screensaver.

Code: Select all
rm -fv ~/.config/autostart/gnome-screensaver.desktop


Create a link gnome-screensaver-command > xscreensaver-command to enable screenlocking with Crtl-Alt-L.

Code: Select all
sudo ln -fs /usr/bin/xscreensaver-command /usr/bin/gnome-screensaver-command


Put the following code in ~/.config/autostart/xcreensaver.desktop by running:

Code: Select all
gedit ~/.config/autostart/xcreensaver.desktop


Then copy/paste the following code in gedit and save the file.

Code: Select all
[Desktop Entry]
Name=Screensaver (xscreensaver)
Comment=Start screensaver
Type=Application
Icon=preferences-desktop-screensaver
TryExec=xscreensaver
Exec=xscreensaver -no-splash
NotShowIn=XFCE;KDE;
Hidden=false
X-GNOME-Autostart-enabled=true


You can of course also do this with gnome-session-properties, but if you also run XFCE be sure to edit the xscreensaver.desktop file to contain NotShowIn=XFCE; . That is because XFCE starts Xscreensaver from /etc/xdg/xfce4/xinitrc and not with an autostart xscreensaver.desktop file.

Now there's one thing left: To make the "Lock screen" menu entry in Gnome 3 work, we have to create a file /usr/local/bin/xscreensaver-dbus-screenlock.py with the following content:

Code: Select all
sudo gedit /usr/local/bin/xscreensaver-dbus-screenlock.py


Paste the following code in gedit, and save the file.

Code: Select all
#!/usr/bin/python
# Make the Gnome 3 screenlock menu entry work with xscreensaver and dbus
# Call this script with an autostart entry from ~/.config/autostart/
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()


Make the file executable:

Code: Select all
sudo chmod +x /usr/local/bin/xscreensaver-dbus-screenlock.py


Finally, add an autostart entry in ~/.config/autostart/xscreensaver-dbus-screenlock.desktop with the following content:

Code: Select all
gedit ~/.config/autostart/xscreensaver-dbus-screenlock.desktop


Paste the code in gedit and save.

Code: Select all
[Desktop Entry]
Type=Application
Name=Xscreensaver Lock Screen
Comment=Make Xscreensaver screenlocklock work with Gnome 3 menu
TryExec=xscreensaver-dbus-screenlock.py
Exec=xscreensaver-dbus-screenlock.py
X-GNOME-Autostart-enabled=true
Hidden=false
OnlyShowIn=GNOME;Unity;
maxibuntu
Level 2
Level 2
 
Posts: 87
Joined: Thu Nov 24, 2011 9:56 am
Location: Rotterdam, Netherlands

Linux Mint is funded by ads and donations.
 

Re: How to replace Gnome 3.4 Screensaver with Xscreensaver

Postby Pigsy on Wed Jan 23, 2013 7:56 am

Thanks for this how-to, it worked well on my Mint 14 (64bit with Cinnamon) :)
User avatar
Pigsy
Level 1
Level 1
 
Posts: 8
Joined: Tue Apr 24, 2012 6:17 am

Re: How to replace Gnome 3.4 Screensaver with Xscreensaver

Postby Pythzor on Sun Aug 18, 2013 2:58 pm

I haven't had any luck with getting xscreensaver to use Pictures folder slideshow. Nevertheless, the screensaver app that I've found to work as good as the Gnome 2 screensaver (and just as easily) is the Mate Screensaver (see screenshot).
Attachments
Screenshot-3.png
AMD Athlon II X2 220 Processor × 2 , 2.8 GHz, 6 GB, Nvidia PNY 210, 1 TB hdd: Windows 7; Ubuntu 13.10; Linux Mint 16 Petra. /// Gateway E4000, Intel Pentium 4, 1.8 Ghz; 1.0 GB RAM, Geforce 5500; 32 bit; Windows 7, PCLinuxOS 201404 Mate Desktop.
Pythzor
Level 3
Level 3
 
Posts: 158
Joined: Fri Jul 09, 2010 7:05 pm


Return to Tutorials / Howtos

Who is online

Users browsing this forum: No registered users and 3 guests