2
# -*- coding: utf-8 -*-
5
# J Phani Mahesh <phanimahesh@gmail.com>
6
# Barneedhar (jokerdino) <barneedhar@ubuntu.com>
7
# Amith KK <amithkumaran@gmail.com>
8
# Georgi Karavasilev <motorslav@gmail.com>
9
# Sam Tran <samvtran@gmail.com>
10
# Sam Hewitt <hewittsamuel@gmail.com>
11
# Angel Araya <al.arayaq@gmail.com>
14
# A One-stop configuration tool for Unity.
18
# This file is a part of Unity Tweak Tool
20
# Unity Tweak Tool is free software; you can redistribute it and/or modify it under
21
# the terms of the GNU General Public License as published by the Free Software
22
# Foundation; version 3.
24
# Unity Tweak Tool is distributed in the hope that it will be useful, but WITHOUT
25
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
26
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
29
# You should have received a copy of the GNU General Public License along with
30
# this program; if not, see <https://www.gnu.org/licenses/gpl-3.0.txt>
32
from gi.repository import Gio, Gdk
34
def test_schema(schema):
35
if schema in Gio.Settings.list_relocatable_schemas():
37
elif schema in Gio.Settings.list_schemas():
40
raise Exception("Schema %s not installed" % schema)
42
def test_key(schema, key):
43
if key in schema.list_keys():
49
schema = 'org.compiz.'+plugin
50
path = '/org/compiz/profiles/unity/plugins/'+plugin+'/'
53
return Gio.Settings(schema = schema, path = path)
55
print("schema %s not installed" % schema)
57
def unity(child = None):
58
schema = 'com.canonical.Unity'
59
schema = schema+'.'+child if child else schema
62
return Gio.Settings(schema)
64
print("schema %s not installed" % schema)
66
def unity_webapps(child = None):
67
schema = 'com.canonical.unity'
68
schema = schema+'.'+child if child else schema
71
return Gio.Settings(schema)
73
print("schema %s not installed" % schema)
76
schema = 'com.canonical.'+child
79
return Gio.Settings(schema)
81
print("schema %s not installed"% schema)
84
schema = 'org.compiz.'+child
87
return Gio.Settings(schema)
89
print("schema %s not installed" % schema)
92
schema = 'org.gnome.'+child
95
return Gio.Settings(schema)
97
print("schema %s not installed" % schema)
99
def color_to_hash(c,alpha=1):
100
"""Convert a Gdk.Color or Gdk.RGBA object to hex representation, overriding the alpha if asked"""
101
if isinstance(c, Gdk.Color):
102
return "#{:02x}{:02x}{:02x}{:02x}".format(*[round(x*255) for x in [c.red_float, c.green_float, c.blue_float,alpha]])
103
if isinstance(x, Gdk.RGBA):
104
return "#{:02x}{:02x}{:02x}{:02x}".format(*[round(x*255) for x in [c.red, c.green, c.blue, alpha]])
105
# If it is neither a Gdk.Color object nor a Gdk.RGBA object,
106
raise NotImplementedError
108
# GSettings objects go here
110
# Sorted by function type and alphabetical order
112
bluetooth = canonical('indicator.bluetooth')
113
datetime = canonical('indicator.datetime')
114
hud = canonical('indicator.appmenu.hud')
115
power = canonical('indicator.power')
116
notifyosd = canonical('notify-osd')
117
scrollbars= canonical('desktop.interface')
118
session = canonical('indicator.session')
119
sound = canonical('indicator.sound')
121
antialiasing = gnome('settings-daemon.plugins.xsettings')
122
background = gnome('desktop.background')
123
desktop = gnome('nautilus.desktop')
124
interface = gnome('desktop.interface')
125
lockdown = gnome('desktop.lockdown')
126
wm = gnome('desktop.wm.preferences')
127
touch = gnome('settings-daemon.peripherals.touchpad')
129
animation = plugin('animation')
130
core = plugin('core')
131
expo = plugin('expo')
132
grid = plugin('grid')
133
move = plugin('move')
134
opengl = plugin('opengl')
135
resize = plugin('resize')
136
scale = plugin('scale')
137
unityshell = plugin('unityshell')
138
zoom = plugin('ezoom')
140
launcher = unity('Launcher')
141
lenses = unity('Lenses')
142
lens_apps = unity('ApplicationsLens')
143
lens_files = unity('FilesLens')
144
runner = unity('Runner')
145
webapps = unity_webapps('webapps')