2
# -*- coding: utf-8 -*-
3
# Copyright (C) 2017 Canonical
6
# Marco Trevisan <marco.trevisan@canonical.com>
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.
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
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
21
from gi.repository import Gio, GLib
24
COMPIZ_SCHEMA = "org.compiz"
25
COMPIZ_PROFILE_PATH = "/org/compiz/profiles/unity-lowgfx/plugins/{}/"
27
"ezoom": {"speed": 100.0},
29
"expo": {"expo-animation": 3},
31
"fade": {"fade-mode": 1,
34
"grid": {"animation-duration": 0,
35
"draw-stretched-window": False},
38
"lazy-positioning": True,
39
"increase-border-contrast": True},
42
"increase-border-contrast": True},
44
"opengl": {"texture-filter": 0},
46
"scale": {"skip-animation": True},
48
"unityshell": {"dash-blur-experimental": 0,
49
"override-decoration-theme": True,
52
"active-shadow-radius": 3,
53
"inactive-shadow-radius": 2,
56
"menus-discovery-fadein": 0,
57
"menus-discovery-fadeout": 0,
58
"autohide-animation": 1},
60
"wall": {"slide-duration": 0.0},
62
"showdesktop": {"skip-animation": True},
66
def get_variant_from_python(value):
67
if type(value) == str:
68
return GLib.Variant.new_string(value)
69
elif type(value) == bool:
70
return GLib.Variant.new_boolean(value)
71
elif type(value) == int:
72
return GLib.Variant.new_int32(value)
73
elif type(value) == float:
74
return GLib.Variant.new_double(value)
77
if COMPIZ_SCHEMA not in Gio.Settings.list_schemas():
78
print("No compiz schemas found, no migration needed")
81
for plugin in LOWGFX_OPTIONS:
82
plugin_options = LOWGFX_OPTIONS[plugin]
83
plugin_path = COMPIZ_PROFILE_PATH.format(plugin)
86
plugin_settings = Gio.Settings(
87
schema=COMPIZ_SCHEMA + ".{}".format(plugin), path=plugin_path)
89
for setting in plugin_options:
90
value = get_variant_from_python(plugin_options[setting])
91
plugin_settings.set_value(setting, value)
93
print("Can't update settings for plugin '{}".format(plugin))