Skip to content


buy ms office 2003 online buy windows 7 home premium buy adobe flash 8 cheapest windows 7 professional adobe framemaker 9 price download adobe creative suite 4 master collection cheapest microsoft office 2003 download corel dvd moviefactory 7 download encarta encyclopedia 2009 buy adobe illustrator student get autodesk 3ds max 2010 purchase windows 7 professional after effects for mac buy office cheap how to buy microsoft frontpage adobe after effects cs3 price microsoft mappoint north america 2009 download ms office enterprise 2007 download windows 7 ultimate oem best price adobe flash cs4 for mac download buy adobe flash player 10 microsoft frontpage license buy creative suite 4 web premium font folio 11 download adobe captivate 3 download cheap adobe photoshop norton ghost 12 download full buy adobe illustrator buy windows 7 half price microsoft office 2010 download cubase 5 buy framemaker download buy windows xp sp3 oem buy norton 360 v3 autosketch 9 download buy after effects cheap buy dreamweaver cs3 for mac buy outlook 2007 download adobe flash cs3 for mac download download adobe font folio 11 adobe suite cs3 price adobe illustrator cs3 download microsoft office 2008 discount adobe flash for mac download adobe illustrator cs4 wavelab price buy ms visual studio 2008 download windows 2008 r2 norton 360 price buy microsoft outlook 2007 only buy pcanywhere 12.5 microsoft office project professional 2003 complete package download microsoft office 2003 full version adobe premiere pro cs3 system requirements microsoft office 2003 download full version buy ms office 2003 standard autocad mechanical 2010 download microsoft visio 2007 download download adobe fireworks cs4 windows 7 home premium full discount adobe premiere elements 8 buy adobe presenter 7 buy buy excel 2007 online buy cs3 cheap adobe premiere pro cs3 mac adobe production premium cs4 download price windows 7 ultimate adobe presenter 7 download buy dreamweaver cs4 cheap corel painter x mac download buy visio 2007 professional download corel draw x3 nuendo 4 price cheap dreamweaver download buy windows vista pro photoimpact pro 11 windows 2003 enterprise license cost buy microsoft excel product key cheap adobe premiere pro mac encarta premium 2009 download buy visual studio 2008 license buy windows 7 ultimate download pcanywhere buy buy mappoint 2009 buy access 2007 only buy sql server 2008 enterprise navisworks download norton ghost price buy autocad architecture 2010 buy ms powerpoint buy adobe audition 3 other cheap norton 360 download buy quicken cheap windows vista home basic 32 bit product key buy microsoft office project buy word 2007 quickbooks enterprise cost after effects for mac trial download acrobat 9 cubase 4 price download autocad electrical 2010 windows vista 64 bit price windows datacenter 2008 licensing windows 7 64 bit price purchase windows 7 license key buy excel 2003 download adobe font folio price autodesk 3ds max 2010 download cheapest windows 7 price buy symantec ghost solution suite windows 2008 standard edition autocad architecture 2010 download windows xp buy product key buy windows vista ultimate purchase windows xp sp3 autodesk autocad 2010 price adobe photoshop cs3 sale buy outlook 2007 buy autodesk autocad download cs3 design premium buy microsoft visio 2007 zonealarm antivirus 8 torrent buy pagemaker 6.5 cheap adobe illustrator cs4 download corel painter x mac buy adobe framemaker after effects mac demo buy adobe fireworks buy microsoft office 2003 professional buy excel 2003 online autocad 2009 price purchase adobe premiere pro cs3 buy indesign cs2 turbotax 2009 deluxe download buy microsoft office 2003 standard buy adobe flash cs3 buy quickbooks pro 2007 buy 3ds max 2010 windows vista 64 bit cheap buy photoshop lightroom for mac adobe after effects cs3 download corel painter 11 for mac coreldraw for mac download cheapest windows 7 ultimate full version buy microsoft office 2003 cheap buy adobe illustrator 10 buy encarta premium 2009 quickbooks enterprise discount buy microsoft money 2005 buy adobe cs4 design premium buy quicken 2010 deluxe download microsoft office 2003 professional edition cheap adobe auditio adobe premiere download dreamweaver mac system requirements adobe acrobat 9 cheap buy autocad 2007 quicken rental property manager 2009 download buy windows 7 ultimate 64 bit microsoft encarta premium 2009 dvd norton ghost pricing buy microsoft office 2003 license buy photoshop elements 7.0 buy norton 360 key buy autodesk inventor buy adobe illustrator cs3 cheap autocad inventor price cheapest windows 7 ultimate oem adobe captivate student discount dreamweaver cs3 download autocad mechanical best price microsoft access 2007 buy online parallels desktop 4.0 for mac system requirements autocad 2010 trial buy office onenote 2003 cheap illustrator cs3 buy windows 7 home premium license download autocad architecture 2008 windows enterprise price download office onenote 2003 buy cs4 master collection buy microsoft project 2003 symantec norton 360 download purchase cs3 software how to buy windows vista product key cheapest windows xp home edition adobe cs4 web premium download norton ghost 12 activation key buy vista business upgrade where to buy encarta 2009 autodesk autosketch 10 download windows 2008 enterprise virtual licensing buy lightroom 1 buy office 2003 download buy microsoft windows 7 home premium microsoft office project professional 2007 price buy photoshop elements 8 buy adobe cs3 design premium windows xp buy uk buy cheap windows 7 ultimate buy windows vista home premium product key adobe indesign cs3 price adobe contribute cs4 for mac ms excel 2007 download buy adobe premiere pro for mac cheap adobe dreamweaver cubase 5 cost ms money 2007 deluxe microsoft office 2003 best price cheap autocad 2009 software dreamweaver mac cs4 adobe indesign for mac autodesk inventor lt download buy cs4 mac microsoft word 2003 product key buy adobe cs4 master collection buy windows xp home windows datacenter licensing purchase photoshop elements 8 adobe after effects download buy adobe photoshop cs3 extended buy excel 2007 download cheapest windows 7 deal buy autosketch 9 download microsoft access 2007 microsoft mappoint 2009 cost purchase powerpoint expression studio price purchase microsoft office for mac adobe pagemaker price download adobe illustrator cs3 dreamweaver cs4 price adobe after effects cs4 mac download buy windows enterprise windows 7 ultimate oem price windows vista business oem iso purchase windows 7 volume license download windows 2008 standard buy office 2003 license windows 7 professional discount microsoft word 2003 download full version adobe fireworks price buy microsoft access 2002 after effects for mac price buy turbotax 2007 dvd moviefactory 6 download windows 7 ultimate pricing buy autocad electrical cheap digital image suite 2006 download microsoft visio 2007 norton ghost 12 product key buy windows 7 oem version autocad architecture oem cheap autocad 2010 steinberg cubase 4 download buy microsoft frontpage download buy microsoft money online autodesk 3ds max price buy windows 7 home premium full windows 7 ultimate licensing adobe photoshop cs4 mac download dreamweaver cs3 full version adobe illustrator cs2 download buy premiere elements 7 windows 7 digital download corel draw 12 mac microsoft money home and business 2009 buy photoshop cs2 download buy windows 2008 server online windows 7 home premium best buy windows 7 ultimate best buy adobe contribute cs4 mac autocad 2010 download microsoft office 2003 full download download cs3 design standard buy norton ghost online download corel draw 13 purchase windows vista download windows 7 cost too much microsoft excel 2007 product key buy microsoft money plus home & business windows 2008 enterprise cost buy windows 7 pro full download adobe fireworks cs3 adobe premiere elements cheap dreamweaver mac oem buy autodesk inventor 2008 purchase vista online buy indesign cs4 buy adobe flash buy visio 2002 buy windows 2008 enterprise adobe flash cs4 for mac microsoft office project professional 2007 download download mappoint 2009 purchase adobe lightroom buy windows 7 license online purchase windows xp pro how to get windows 7 ultimate cheap download microsoft mappoint 2009 buy office 2003 product key windows 7 professional oem version microsoft onenote pricing buy autocad buy sql server 2008 web edition buy windows 7 home premium cheap premiere pro cs3 adobe lightroom for mac buy 3ds max cheap autodesk lustre buy microsoft mappoint europe 2004 adobe photoshop elements 8 price buy autocad inventor 2010 windows xp cheap download buy autodesk maya windows 2008 datacenter cost buy photoshop lightroom 2 buy adobe illustrator mac windows 2003 datacenter licensing buy microsoft office 2003 online adobe photoshop best buy buy corel draw software buy cs4 web premium adobe cs4 master collection for mac adobe after effects demo microsoft onenote price download microsoft expression studio 3 purchase windows xp download after effects price buy vista business online illustrator download cs3 buy microsoft excel online get zonealarm antivirus 8 download adobe photoshop elements 5.0 windows r2 2008 buy windows vista oem windows 7 ultimate price oem buy adobe flash for mac adobe acrobat 9 pro buy autodesk navisworks simulate 2009 buy windows 7 professional 64 bit oem adobe premiere elements 8 price windows xp best buy buy microsoft word 2003 online purchase acrobat professional price of windows 7 home premium norton ghost 12 download adobe illustrator cs3 price microsoft word 2007 product key windows vista 64 bit sale

Make compiz-fusion work with xscreensaver (the quick & dirty way)

The beautiful desktop experience provided by compiz-fusion represents a significant aesthetic contribution to the pleasure of using Linux. Besides, it makes it really easy to impress even the most committed Apple disciple. The same is true for the cool gl screensavers written for xscreensavers. Unfortunately, these two don’t really work together (my computer freezes everytime xscreensaver comes up while running compiz-fusion) and although the screensaver plugin for compiz-fusion shows great potential, the gl collection for xscreensaver is still a bit ahead and has a lot more variety, so I really wanted to make them work together.

Here is what I did:

  1. You can use xscreensaver-command -watch to monitor xscreensaver events, so you can actually run a program when xscreensaver is activated (for example, to disable compiz-fusion), and another one when it is deactivated (to bring compiz-fusion back). I modified the following script available from the xscreensaver man pages and saved it as ~/bin/fixscreensaver:
    #!/usr/bin/perl
    
    # Fixes xscreensaver when compiz is running
    
    my $blanked = 0;
    open (IN, "xscreensaver-command -watch |");
    while () {
      if (m/^(BLANK|LOCK)/) {
        if (!$blanked) {
          system "usemetacity";
          $blanked = 1;
        }
      } elsif (m/^UNBLANK/) {
        system "usecompiz";
        $blanked = 0;
      }
    }
  2. As you can see, the script above calls usemetacity when xscreensaver is activated and usecompiz when it is deactivated. Save the following script as ~/bin/usemetacity:
    #!/bin/bash
    
    #killall gkrellm
    metacity --replace &
    #sleep 1
    #gkrellm &
  3. Now save this one as ~/bin/usecompiz:
    #!/bin/bash
    
    #killall gkrellm
    compiz --replace &
    #sleep 2
    #gkrellm &
    #windowranger
  4. Add ~/bin/fixscreensaver to the list of startup applications (System > Preferences > Sessions > Startup programs) and also make sure that ~/bin/ is in your $PATH environment variable.
  5. Optional: If you use gkrellm, you should uncomment the corresponding lines in the scripts above. Those lines will prevent metacity (the default gnome window manager) and compiz-fusion from changing the position of the gkrellm window, which happens everytime you switch between the two because these window managers use different ways to describe desktop geometry.
  6. Optional: You can also use the usecompiz and usemetacity scripts to manage any other application that misbehaves when metacity or compiz-fusion take over your desktop. In fact, I use the windowranger script below to automatically put windows back into their corresponding viewports since everything gets shoved into the first viewport once you go back into compiz from metacity (thanks for pointing it out darken). You will need wmctrl for this to work properly:
    #!/usr/bin/python
    
    import os, time, wnck, sys
    
    def dec2hex(n):
      #"""return the hexadecimal string representation of integer n"""#
      return "%X" % n
    
    def hex2dec(s):
      #"""return the integer value of a hexadecimal string s"""#
      return int(s, 16)
    
    def MoveWindow(wID, wtitle, xpos, ypos):
    
        time.sleep(0.2)
        os.system('wmctrl -i -r ' + wID + ' -e 0,'+str(xpos)+','+str(ypos)+',-1,-1')
        #time.sleep(0.4)
        #os.system('wmctrl -i -a ' + wID)
        if DEBUG: print "Moved to", xpos, ypos, 'n'
    
    def Place(x, y, wID, wclass, wtitle):
    
      fin,dout = os.popen4('wmctrl -d')   # output desktop geometry
      for line in dout:
        line = line[line.find('VP: ') + 4:len(line)]  # get current viewport offset
        line = line[0:line.find(' ')]
        offset = line.split(',')      # split in x,y viewport offset coordinates
        vpxpos = int(offset[0])       # convert into integer
        vpypos = int(offset[1])       # convert into integer
        absxpos = vpxpos+x            # absolute window position (x)
        absypos = vpypos+y            # absolute window position (y)
        wxpos = absxpos
        wypos = absypos
        while wxpos >= width:
          wxpos = wxpos - width       # relative window position (x)
        while wypos >= height:
          wypos = wypos - height      # relative window position (y)
        if (wxpos >= 0)&(wxpos <= 2): wxpos = 0
        if (wypos >= 0)&(wypos <= 2): wypos = 0
    
      dout.close()                    # close command output
      if DEBUG: print 'Position:', absxpos, 'x', absypos
    
      #Send Firefox to viewport 1
      if wclass.find('Firefox') != -1:
        # Flash fullscreen windows are titled 'Firefox' so we need to ignore them...
        if wtitle != 'Firefox':
          MoveWindow(wID, wtitle, wxpos - vpxpos + vpx1, wypos - vpypos + vpy1)
    
      #Send GYachI to viewport 2
      elif wclass.find('GYachI') != -1:
        MoveWindow(wID, wtitle, wxpos - vpxpos + vpx2, wypos - vpypos + vpy2)
    
      #Send VirtualBox to viewport 5
      elif wclass.find('VirtualBox') != -1:
        MoveWindow(wID, wtitle, wxpos - vpxpos + vpx5, wypos - vpypos + vpy5)
    
      #Send Amarok to viewport 6
      elif wclass.find('Amarokapp') != -1:
        MoveWindow(wID, wtitle, wxpos - vpxpos + vpx6, wypos - vpypos + vpy6)
    
      #Send Azureus to viewport 6
      elif wclass.find('SWT') != -1:
        MoveWindow(wID, wtitle, wxpos - vpxpos + vpx6, wypos - vpypos + vpy6)
    
      #Send Qbittorrent to viewport 6
      elif wclass.find('Qbittorrent') != -1:
        MoveWindow(wID, wtitle, wxpos - vpxpos + vpx6, wypos - vpypos + vpy6)
    
      #Send Pidgin to viewport 7
      elif wclass.find('Pidgin') != -1:
        MoveWindow(wID, wtitle, wxpos - vpxpos + vpx7, wypos - vpypos + vpy7)
    
      #Send Skype to viewport 7
      elif wclass.find('Skype') != -1:
        MoveWindow(wID, wtitle, wxpos - vpxpos + vpx7, wypos - vpypos + vpy7)
    
      #Send Thunderbird to viewport 8
      elif wclass.find('Thunderbird-bin') != -1:
        MoveWindow(wID, wtitle, wxpos - vpxpos + vpx8, wypos - vpypos + vpy8)
    
      #Send all other windows in viewport 1 to viewport 2
      elif (wclass.find('Gnome-panel')==-1)&(wtitle != 'Desktop')&(wclass.find('Gkrellm')==-1)&(wclass.find('Launcher')==-1)&(absxpos < width)&(absypos <= height):
        MoveWindow(wID, wtitle, wxpos - vpxpos + vpx2, wypos - vpypos + vpy2)
    
      else:
        if DEBUG: print 'Ignoredn'
    
    #---------------------------- MAIN -------------------------------------
    s = wnck.screen_get_default()
    width = s.get_width()
    height = s.get_height()
    vpx1 = (width * 0);vpy1 = (height * 0)
    vpx2 = (width * 1);vpy2 = (height * 0)
    vpx3 = (width * 2);vpy3 = (height * 0)
    vpx4 = (width * 3);vpy4 = (height * 0)
    vpx5 = (width * 0);vpy5 = (height * 1)
    vpx6 = (width * 1);vpy6 = (height * 1)
    vpx7 = (width * 2);vpy7 = (height * 1)
    vpx8 = (width * 3);vpy8 = (height * 1)
    DEBUG = False;
    
    for arg in sys.argv:
      if arg=='--debug':
        DEBUG=True;
    
    if DEBUG: print 'Viewport geometry:', width, 'x', height, 'n'
    
    fin,wout = os.popen4('wmctrl -lGx')
    for line in wout:
      wID = line[0:line.find(' ')]                      # get the window ID
      line = line[line.find(' '):len(line)]
      line = line.lstrip()
      wdesk = line[0:line.find(' ')]                    # get the window desktop
      line = line[line.find(' '):len(line)]
      line = line.lstrip()
      wxoffset = line[0:line.find(' ')]                 # get the window x offset
      wxoffset = (int(wxoffset) / 2)
      line = line[line.find(' '):len(line)]
      line = line.lstrip()
      wyoffset = line[0:line.find(' ')]                 # get the window y offset
      wyoffset = (int(wyoffset) / 2) - 24
      line = line[line.find(' '):len(line)]
      line = line.lstrip()
      wwidth = line[0:line.find(' ')]                   # get the window width
      line = line[line.find(' '):len(line)]
      line = line.lstrip()
      wheight = line[0:line.find(' ')]                  # get the window height
      line = line[line.find(' '):len(line)]
      line = line.lstrip()
      wclass = line[0:line.find(' jsilva')]             # get the window class
      line = line[line.find(' jsilva'):len(line)]
      line = line.lstrip()
      whost = line[0:line.find(' ')]                    # get the window host
      line = line[line.find(' '):len(line)]
      line = line.lstrip()
      wtitle = line[0:len(line) - 1]                    # get the window title
      if DEBUG:
        print 'Class:', wclass
        print 'Host:', whost
        print 'Title:', wtitle
      Place(wxoffset,wyoffset,wID,wclass,wtitle)  # place window
    wout.close()
  7. Enjoy!

Posted in GNU | Linux, HowTo, Open Source. Tagged with , , , , , , , , , , .

5 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. darken said

    Hmm.. I don’t know if this is really a solution.. don’t all the windows you have open across all your desktops get put into 1 workspace when compiz is closed? I don’t want to drag windows out into different workspaces everytime I come back to the PC.

  2. Jorge said

    Good point darken! I modified step number 6 above to include a quick fix for this

  3. Anonymous said

    I used a similary script as follows, I like it more since its just one bash script, just prepend with sh and add to your session

    #!/bin/bash
    if [ -f fixscreensaver.out ]; then rm fixscreensaver.out; fi
    xscreensaver-command -watch >> fixscreensaver.out &
    while true; do
    if tail –lines=1 fixscreensaver.out | grep -w UNBLANK; then
    echo ” >> fixscreensaver.out;
    compiz –replace –sm-disable –ignore-desktop-hints ccp –loose-binding &
    fi
    if tail –lines=1 fixscreensaver.out | grep -w BLANK; then
    echo ” >> fixscreensaver.out;
    metacity –replace &
    fi
    sleep .1;
    done;

  4. Anonymous said

    this makes it easier to see
    #!/bin/bash
    if [ -f fixscreensaver.out ]; then rm fixscreensaver.out; fi
    xscreensaver-command -watch >> fixscreensaver.out &
    while true; do
    if tail –lines=1 fixscreensaver.out | grep -w UNBLANK; then
    echo ” >> fixscreensaver.out;
    compiz –replace –sm-disable –ignore-desktop-hints ccp –loose-binding &
    fi
    if tail –lines=1 fixscreensaver.out | grep -w BLANK; then
    echo ” >> fixscreensaver.out;
    metacity –replace &
    fi
    sleep .1;
    done;

  5. Anonymous said

    maybe this will work, textarea isn’t supported
    #!/bin/bash
    if [ -f fixscreensaver.out ]; then rm fixscreensaver.out; fi
    xscreensaver-command -watch >> fixscreensaver.out &
    while true; do
    if tail --lines=1 fixscreensaver.out | grep -w UNBLANK; then
    echo '' >> fixscreensaver.out;
    compiz --replace --sm-disable --ignore-desktop-hints ccp --loose-binding &
    fi
    if tail --lines=1 fixscreensaver.out | grep -w BLANK; then
    echo '' >> fixscreensaver.out;
    metacity --replace &
    fi
    sleep .1;
    done;

Some HTML is OK

(never shared)

or, reply to this post via trackback.