Tuesday, April 25, 2006

AIGLX: Turn the Service on and Off with a Right Click

In the last section of http://fedoraproject.org/wiki/RenderingProject/AiglxOnFedora there's a script to turn the AIGLX composition manager ON and OFF in metacity window manager.
The script is based on zenity, and because it does not provide a Question dialog with Yes and No buttons, the mapping is done in the message.

Well, here is my version of the script in Python and PyGTK to avoid zenity caveats.

#! /usr/bin/env python
#----------------------------------------------------------------------
# Copyright (C) 2006 by Diego Torres Milano <diego@pxes.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
# USA
#----------------------------------------------------------------------

import gtk
import gconf

q = gtk.MessageDialog(type=gtk.MESSAGE_QUESTION,
buttons=gtk.BUTTONS_YES_NO)
q.set_markup('Do you want to turn ON the AIGLX Service ?')
gconf.client_get_default().set_bool(
'/apps/metacity/general/compositing_manager',
(q.run() == gtk.RESPONSE_YES))


Save the script in the Nautilus script folder (~/.gnome2/nautilus-scripts) as AIGLX and change the permissions to make it executable by owner. Close Nautilus and right click the Desktop. You should now have a AIGLX menu option in Scripts.
Enjoy it.
Post a Comment