~compiz-team/compiz/compiz.fix_1077866

3248.1.71 by Didier Roche
* debian/config, debian/compiz-gnome.migrations,
1
#!/usr/bin/python
2
# -*- coding: utf-8 -*-
3
# Copyright (C) 2012 Canonical
4
#
5
# Authors:
6
#  Didier Roche <didrocks@ubuntu.com>
7
#
8
# This program is free software; you can redistribute it and/or modify it under
9
# the terms of the GNU General Public License as published by the Free Software
10
# Foundation; version 3.
11
#
12
# This program is distributed in the hope that it will be useful, but WITHOUTa
13
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
15
# details.
16
#
17
# You should have received a copy of the GNU General Public License along with
18
# this program; if not, write to the Free Software Foundation, Inc.,
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
21
from gi.repository import Gio
22
import os
23
24
gsettings=Gio.Settings(schema="org.compiz.core", path="/org/compiz/profiles/Default/plugins/core/")
25
plugins_list = gsettings.get_strv("active-plugins")
26
27
# Remove unityshell the default profile if present (case of new install and first session startup)
28
try:
29
    plugins_list.remove('unityshell')
30
except ValueError:
31
    pass
32
try:
33
    plugins_list.remove('unitymtgrabhandles')
34
except ValueError:
35
    pass
3248.1.72 by Didier Roche
fix as gsettings directly doesn't work
36
# gsettings doesn't work directly, the key is somewhat reverted. Work one level under then: dconf!
37
#gsettings.set_strv("active-plugins", plugins_list)
38
from subprocess import Popen, PIPE, STDOUT
39
p = Popen(['dconf', 'load', '/org/compiz/profiles/Default/plugins/core/'], stdout=PIPE, stdin=PIPE, stderr=STDOUT)
40
p.communicate(input="[/]\nactive-plugins=%s" % plugins_list)
3248.1.71 by Didier Roche
* debian/config, debian/compiz-gnome.migrations,
41
42
# remove the eventually existing local config file which can prevent the default profile to use gsettings for quantal users before this fix
43
try:
44
    os.remove(os.path.join(os.path.expanduser('~'), '.config', 'compiz-1', 'compizconfig', 'config'))
45
except OSError:
46
    pass
47