HOWTO: Get RSS-glx(Really Slick Screensavers) to work on KDE4 and also add all xscreensavers

From Sabayon Wiki
Revision as of 12:34, 22 September 2009 by Mikey0000 (Talk | contribs) (packages you need to emerge:)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Guide to get RSS screensavers working and configurable on ether 32bit or 64bit Sabayon Linux:

Unfortunately the kdeartwork package doesn't detect that we've installed xscreensaver so we have to edit a couple of files to get around that if later on it does work then congrats!!

what we are going to do:

 Rebuild kdeartwork-kscreensaver so it builds kxsconfig & kxsrun needed for xscreensaver and RSS
 install rss-glx
 run my python script to fix the .desktop files


packages you need to emerge:

 we may as well emerge everything now and have it over and done with
emerge --fetchonly =kdeartwork-kscreensaver-4.3.1 rss-glx xscreensaver
Question.png
Up to you if you want to install all these packages as we will need to do that at least to rss-glx and xscreensaver for the script later on


 we need to copy our kdeartwork file to our home dir and extract for editing
cp /usr/portage/distfiles/kdeartwork-4.3.1.tar.bz2 ~/
tar -xjf kdeartwork-4.3.1.tar.bz2 kdeartwork-4.3.1


 and then edit three files: 
File: kdeartwork-4.3.1/kscreensaver/kxsconfig & kxsrun
bool KXSConfigDialog::create()
{
    QWidget *main = new QWidget(this);
    setMainWidget(main);
    QVBoxLayout *topLayout = new QVBoxLayout(main);
    topLayout->setSpacing(spacingHint());
    QHBoxLayout *layout = new QHBoxLayout();
    topLayout->addLayout(layout);
    layout->setSpacing(spacingHint());
    KVBox *controlLayout = new KVBox(main);
    controlLayout->setSpacing(spacingHint());
    layout->addWidget(controlLayout);
    ((QBoxLayout*)controlLayout->layout())->addStrut(120);

    KConfig config(mConfigFile);

    QString xmlFile = "/doesntexist";
#ifdef XSCREENSAVER_CONFIG_DIR
    xmlFile = "XSCREENSAVER_CONFIG_DIR"; -------!! CHANGE THIS FOR BOTH KXSCONFIG AND KXSRUN
#endif 
Question.png
This fixes kxsconfig and tells it where to find our configuration files /usr/share/xscreensaver/config change the file location of the last xmlpath to the one here and make sure not to put an ending slash


 Remove the check for xscreensavers and remove the if statement around kxsconfig and xsavers:
File: kdeartwork-4.3.1/kscreensaver/CMakeLists.txt
find_package(KDE4Workspace)

if(KDE4WORKSPACE_FOUND)
	macro_optional_find_package(OpenGL)
	macro_log_feature(OPENGL_FOUND "OpenGL" "API for developing portable, interactive 2D and 3D graphics applications" "http://mesa3d.sourceforge.net" FALSE "" "Provides 3D screensavers.")
	add_subdirectory( kdesavers ) 
	add_subdirectory( kpartsaver ) 
	add_subdirectory(kxsconfig)
	add_subdirectory(xsavers)
        

elseif(KDE4WORKSPACE_FOUND)
	message(STATUS "kscreensaver can't be compiled. Please install kdebase/workspace before to compile it (need kscreensaver.h)")
endif(KDE4WORKSPACE_FOUND) 


 Now to compress and replace the original kdeartwork with our edited one
mv /usr/portage/distfiles/kdeartwork-4.3.1.tar.bz2 kdeartwork-4.3.1.bak
tar -cjf ~/kdeartwork-4.3.1.tar.bz2 ~/kdeartwork-4.3.1
cp ~/kdeartwork-4.3.1.tar.bz2 /usr/portage/distfiles/ 
 We have to trick portage and create a new digital signature for our file
Stop.png
You MUST do this otherwise it will see your file as corrupted and create a checksum failure
 rm /usr/portage/kde-base/kdeartwork-kscreensaver/Manifest 
cd /usr/portage/kde-base/kdeartwork-kscreensaver/
ebuild kdeartwork-kscreensaver-4.3.1.ebuild digest 
Question.png
this may emerge some packages, let it as long as it is not kdeartwork-yourversion and if it is you've done something wrong

now emerge kdeartwork like normal

emerge kdeartwork-kscreensaver
Question.png
It will say it can't find any xscreensavers don't worry it doesn't matter

So now we should be ready to install RSS-GLX and/or xscreensaver

emerge rss-glx xscreensaver
 and for the finishing touch save as foo.py run this script as root # python foo.py
<syntaxhighlight lang="
#Author Michael Arthur
#creates new .desktop files to replace rss-glx's and adds the rest of the screensavers too
import os, glob
import fnmatch
import platform

#directories /usr/share/xscreensaver/config *.xml
# /usr/lib64/misc/xscreensaver screensavers
# /usr/share/kde4/services/ScreenSavers
#read in a list of xscreensavers and check for .desktop files
#remove the xscreensaver and rss-glx files
#and create replacement .desktop files

if(platform.machine() == 'x86_64'):
    Screensavers = os.listdir('/usr/lib64/misc/xscreensaver/')
   # xmlpath = os.listdir('/usr/share/xscreensaver/config/')
    serviceFiles = os.listdir('/usr/share/kde4/services/ScreenSavers/')
    
else:
#im not actually sure this file dir is correct for 32bit please edit accordingly
    path = os.listdir('/usr/lib/misc/xscreensaver/')
   # xmlpath = os.listdir('/usr/share/xscreensaver/config/')
    serviceFiles = os.listdir('/usr/share/kde4/services/ScreenSavers/')

    
if ((os.access('/usr/share/kde4/services/ScreenSavers/', os.W_OK))== False):
    print "ERR: File access failed! run as root"
else:
    desktopPath = '/usr/share/kde4/services/ScreenSavers/'
    
    for infile in Screensavers:
        if infile != 'rss-glx_install.pl':
            try:
                os.remove(desktopPath + infile +'.desktop')
            except OSError:
                pass

    for infile in Screensavers:
        set = 0
        if infile != 'rss-glx_install.pl':
            try:              
                i = serviceFiles.index(infile+'.desktop')
            except ValueError:
                set = 1               
                if set == 1:
           #write new .desktop file
        #WARNING comment out this line when testing
                    os.chdir(desktopPath)
                    desktopfile = open(infile + '.desktop', 'w')
                    desktopfile.write('[Desktop Entry]\nEncoding=UTF-8\nExec=/usr/lib64/misc/xscreensaver/'+ infile +' -- -window-id %w\nIcon=preferences-desktop-screensaver\nType=Service\nX-KDE-ServiceTypes=ScreenSaver\nActions=Setup;InWindow;Root;\nX-KDE-Category=OpenGL Screen Savers\nX-KDE-Type=OpenGL\nName='+ infile +' (GL)\n\n[Desktop Action Setup]\nExec=kxsconfig /usr/lib64/misc/xscreensaver/'+ infile +'\nName=Setup...\n\n[Desktop Action InWindow]\nExec=kxsrun /usr/lib64/misc/xscreensaver/'+ infile +' -- -window-id %w\nName=Display in specified window\nNoDisplay=true\n\n[Desktop Action Root]\nExec=kxsrun /usr/lib64/misc/xscreensaver/'+ infile +' -- -root\nName=Display in root window\nNoDisplay=true\n')
                    desktopfile.close()
      
" enclose="none">Python</syntaxhighlight>

Now open up your screensavers and under opengl you have them all!