├── .is-devel-dir ├── debian ├── compat ├── source │ └── format ├── unity-tweak-tool.manpages ├── install ├── source_unity-tweak-tool.py ├── rules ├── control ├── copyright └── changelog ├── MANIFEST.in ├── UnityTweakTool ├── utils │ ├── __init__.py │ └── unityreset.py ├── backends │ ├── __init__.py │ └── gsettings.py ├── config │ ├── __init__.py │ ├── u1sync.py │ ├── logging.py │ ├── ui.py │ └── data.py ├── section │ ├── __init__.py │ ├── spaghetti │ │ ├── __init__.py │ │ ├── values.py │ │ ├── unitytweakconfig.py │ │ ├── gsettings.py │ │ └── theme.py │ ├── dynamic.py │ ├── skeletonpage.py │ ├── overview.py │ ├── appearance.py │ ├── system.py │ └── windowmanager.py ├── elements │ ├── __init__.py │ ├── button.py │ ├── toolbutton.py │ ├── resetbutton.py │ ├── filechooser.py │ ├── option.py │ ├── fontbutton.py │ ├── cbox.py │ ├── spin.py │ ├── scale.py │ ├── radio.py │ ├── switch.py │ ├── checkbox.py │ ├── togglebutton.py │ ├── treeview.py │ └── colorchooser.py ├── about.py └── __init__.py ├── unity-tweak-tool.service ├── data ├── monitor-hotcorners.png ├── monitor-window-snapping.png ├── glib-2.0 │ └── schemas │ │ ├── gschemas.compiled │ │ └── org.frejya.unity-tweak-tool.gschema.xml ├── media │ ├── hicolor │ │ ├── 16x16 │ │ │ └── apps │ │ │ │ └── unity-tweak-tool.png │ │ ├── 22x22 │ │ │ └── apps │ │ │ │ └── unity-tweak-tool.png │ │ ├── 24x24 │ │ │ └── apps │ │ │ │ └── unity-tweak-tool.png │ │ ├── 32x32 │ │ │ └── apps │ │ │ │ └── unity-tweak-tool.png │ │ ├── 48x48 │ │ │ └── apps │ │ │ │ └── unity-tweak-tool.png │ │ ├── 64x64 │ │ │ └── apps │ │ │ │ └── unity-tweak-tool.png │ │ └── 256x256 │ │ │ └── apps │ │ │ └── unity-tweak-tool.png │ └── scalable │ │ ├── unity-tweak-tool-wm-symbolic.svg │ │ ├── unity-tweak-tool-unity-symbolic.svg │ │ ├── unity-tweak-tool-system-symbolic.svg │ │ ├── unity-tweak-tool-overview-symbolic.svg │ │ └── unity-tweak-tool-appearance-symbolic.svg ├── errordialog.ui ├── about.ui └── filechooser-theme.ui ├── notes ├── wizardry.py ├── TODO └── launcher_color.txt ├── .gitignore ├── unity-tweak-tool.desktop.in ├── unity-tweak-tool.1 ├── README.md ├── unity-tweak-tool └── setup.py /.is-devel-dir: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include COPYING 2 | -------------------------------------------------------------------------------- /UnityTweakTool/utils/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /debian/unity-tweak-tool.manpages: -------------------------------------------------------------------------------- 1 | unity-tweak-tool.1 2 | -------------------------------------------------------------------------------- /UnityTweakTool/backends/__init__.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | -------------------------------------------------------------------------------- /UnityTweakTool/config/__init__.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | -------------------------------------------------------------------------------- /UnityTweakTool/section/__init__.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | -------------------------------------------------------------------------------- /UnityTweakTool/elements/__init__.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | 3 | -------------------------------------------------------------------------------- /UnityTweakTool/section/spaghetti/__init__.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | -------------------------------------------------------------------------------- /debian/install: -------------------------------------------------------------------------------- 1 | debian/source_unity-tweak-tool.py usr/share/apport/package-hooks/ 2 | -------------------------------------------------------------------------------- /unity-tweak-tool.service: -------------------------------------------------------------------------------- 1 | [D-BUS Service] 2 | Name=org.freyja.utt 3 | Exec=/usr/bin/unity-tweak-tool 4 | -------------------------------------------------------------------------------- /data/monitor-hotcorners.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freyja-dev/unity-tweak-tool/HEAD/data/monitor-hotcorners.png -------------------------------------------------------------------------------- /data/monitor-window-snapping.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freyja-dev/unity-tweak-tool/HEAD/data/monitor-window-snapping.png -------------------------------------------------------------------------------- /data/glib-2.0/schemas/gschemas.compiled: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freyja-dev/unity-tweak-tool/HEAD/data/glib-2.0/schemas/gschemas.compiled -------------------------------------------------------------------------------- /data/media/hicolor/16x16/apps/unity-tweak-tool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freyja-dev/unity-tweak-tool/HEAD/data/media/hicolor/16x16/apps/unity-tweak-tool.png -------------------------------------------------------------------------------- /data/media/hicolor/22x22/apps/unity-tweak-tool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freyja-dev/unity-tweak-tool/HEAD/data/media/hicolor/22x22/apps/unity-tweak-tool.png -------------------------------------------------------------------------------- /data/media/hicolor/24x24/apps/unity-tweak-tool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freyja-dev/unity-tweak-tool/HEAD/data/media/hicolor/24x24/apps/unity-tweak-tool.png -------------------------------------------------------------------------------- /data/media/hicolor/32x32/apps/unity-tweak-tool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freyja-dev/unity-tweak-tool/HEAD/data/media/hicolor/32x32/apps/unity-tweak-tool.png -------------------------------------------------------------------------------- /data/media/hicolor/48x48/apps/unity-tweak-tool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freyja-dev/unity-tweak-tool/HEAD/data/media/hicolor/48x48/apps/unity-tweak-tool.png -------------------------------------------------------------------------------- /data/media/hicolor/64x64/apps/unity-tweak-tool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freyja-dev/unity-tweak-tool/HEAD/data/media/hicolor/64x64/apps/unity-tweak-tool.png -------------------------------------------------------------------------------- /data/media/hicolor/256x256/apps/unity-tweak-tool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freyja-dev/unity-tweak-tool/HEAD/data/media/hicolor/256x256/apps/unity-tweak-tool.png -------------------------------------------------------------------------------- /notes/wizardry.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/python 2 | 3 | import compizconfig 4 | from gi.repository import Gdk 5 | 6 | screen= Gdk.Screen.get_default() 7 | n = screen.get_number() 8 | context = compizconfig.Context(n) 9 | print context.CurrentProfile.Name 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | 3 | *~ 4 | *.bak 5 | *.orig 6 | 7 | build 8 | 9 | debian/files 10 | debian/unity-tweak-tool.debhelper.log 11 | debian/unity-tweak-tool.postinst.debhelper 12 | debian/unity-tweak-tool.prerm.debhelper 13 | debian/unity-tweak-tool.substvars 14 | debian/unity-tweak-tool 15 | -------------------------------------------------------------------------------- /debian/source_unity-tweak-tool.py: -------------------------------------------------------------------------------- 1 | import os 2 | from os import path 3 | 4 | import apport 5 | from apport.hookutils import * 6 | 7 | 8 | def add_info(report): 9 | if not apport.packaging.is_distro_package(report['Package'].split()[0]): 10 | report['CrashDB'] = '{"impl": "launchpad", "project": "unity-tweak-tool"}' 11 | -------------------------------------------------------------------------------- /data/glib-2.0/schemas/org.frejya.unity-tweak-tool.gschema.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | '' 6 | Summary 7 | Description 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | PYTHON3_VERSIONS = $(shell py3versions -r) 4 | 5 | %: 6 | dh $@ --with python3 7 | 8 | 9 | override_dh_auto_clean: 10 | rm -rf build/ 11 | 12 | override_dh_auto_build: 13 | set -ex; for python in $(PYTHON3_VERSIONS); do \ 14 | $$python setup.py build \ 15 | --executable=/usr/bin/python3; \ 16 | done 17 | 18 | override_dh_auto_install: 19 | set -ex; for python in $(PYTHON3_VERSIONS); do \ 20 | $$python setup.py install \ 21 | --install-layout=deb \ 22 | --root=$(CURDIR)/debian/unity-tweak-tool; \ 23 | done 24 | 25 | -------------------------------------------------------------------------------- /unity-tweak-tool.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | _Name=Unity Tweak Tool 3 | _Comment=Configuration frontend for the Unity desktop environment 4 | Categories=Settings; 5 | Exec=unity-tweak-tool %f 6 | Icon=unity-tweak-tool 7 | GenericName=Unity Tweak Tool 8 | OnlyShowIn=Unity; 9 | StartupNotify=true 10 | Terminal=false 11 | Type=Application 12 | Actions=Unity;WinMng;Appearance;System; 13 | X-Unity-IconBackgroundColor=#ff0025 14 | 15 | [Desktop Action Unity] 16 | _Name=Unity 17 | Exec=unity-tweak-tool -u 18 | OnlyShowIn=Unity; 19 | 20 | [Desktop Action WinMng] 21 | _Name=Window Manager 22 | Exec=unity-tweak-tool -w 23 | OnlyShowIn=Unity; 24 | 25 | [Desktop Action Appearance] 26 | _Name=Appearance 27 | Exec=unity-tweak-tool -a 28 | OnlyShowIn=Unity; 29 | 30 | [Desktop Action System] 31 | _Name=System 32 | Exec=unity-tweak-tool -s 33 | OnlyShowIn=Unity; 34 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: unity-tweak-tool 2 | Section: gnome 3 | Priority: optional 4 | Maintainer: Barneedhar Vigneshwar 5 | Build-Depends: debhelper (>= 9~), python3-all (>= 3.2), python3-distutils-extra (>= 2.10) 6 | Build-Depends-Indep: python (>= 2.6.6-3~) 7 | Standards-Version: 3.9.5 8 | X-Python3-Version: >= 3.2 9 | Homepage: https://github.com/freyja-dev/unity-tweak-tool 10 | 11 | Package: unity-tweak-tool 12 | Architecture: all 13 | Depends: ${python3:Depends}, 14 | gir1.2-glib-2.0, 15 | gir1.2-gtk-3.0, 16 | unity (>= 6.8), 17 | python3-xdg, 18 | python3-cairo, 19 | ${misc:Depends} 20 | Description: configuration tool for the Unity desktop environment 21 | Unity Tweak Tool is a settings manager for the Unity desktop. 22 | It provides users with a fast, simple and easy-to-use interface 23 | with which to access many useful and little known features and settings 24 | of the desktop environment that one may want to configure. 25 | -------------------------------------------------------------------------------- /notes/TODO: -------------------------------------------------------------------------------- 1 | ###Priorities 2 | 3 | 1. Gtk Application and preventing multiple instances 4 | 2. Insensitive checks in Appearance sections 5 | 3. Installation and removable themes in Appearance sections 6 | 4. Prevent crashing upon missing schema / key -- AssertionError 7 | - Mainly Touchpad (Under System Section - Touch - Scrolling and 8 | - Overlay scrollbar (Under System Section - Scrollbars) 9 | 5. [Only on 13.04] Launcher icon size can be set below 32 -- up to 8 pixels. 10 | 6. Prevent same keybindings from being set 11 | 12 | ----------------------- 13 | 14 | ###Wishlist 15 | 16 | * Search 17 | * Ubuntu-one sync (#TODO: Need to write spec for this feature) 18 | * Preset settings 19 | * Apport hook attached with debug logs 20 | * Backup and restore settings 21 | * Auto packaging tests [http://developer.ubuntu.com/packaging/html/auto-pkg-test.html] 22 | * Unit tests 23 | * libcolumbus (python bindings) 24 | * get/\_color() / get_rgba() --> deprecated stuff 25 | -------------------------------------------------------------------------------- /UnityTweakTool/config/u1sync.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | # Any Unity One Sync settings should appear here. 33 | -------------------------------------------------------------------------------- /unity-tweak-tool.1: -------------------------------------------------------------------------------- 1 | .TH unity-tweak-tool "1" "11 February 2013" "" "Unity User's Manual" 2 | 3 | .SH NAME 4 | unity-tweak-tool \- configuration manager for Unity desktop environment 5 | 6 | .SH SYNOPSIS 7 | .B unity-tweak-tool 8 | .RI [ options ] 9 | .br 10 | 11 | .SH DESCRIPTION 12 | The \fBunity-tweak-tool\fP program can be used to tweak Unity desktop environment. Unity Tweak Tool is a one-stop settings manager for Ubuntu Unity. 13 | 14 | .SH OPTIONS 15 | .IP \fB\-u\fP 16 | Starts \fBunity-tweak-tool\fP in Unity section. 17 | 18 | .IP \fB\-w\fP 19 | Starts \fBunity-tweak-tool\fP in Window Manager section. 20 | 21 | .IP \fB\-a\fP 22 | Starts \fBunity-tweak-tool\fP in Appearance section. 23 | 24 | .IP \fB\-s\fP 25 | Starts \fBunity-tweak-tool\fP in System section. 26 | 27 | .IP \fB\--reset-unity\fP 28 | Reset Unity, wiping all changes to configuration. 29 | 30 | .SH BUGS 31 | Please report any bug you may experience to the \fBunity-tweak-tool\fP developers, who can 32 | be reached at \fRhttps://launchpad.net/unity-tweak-tool\fP. 33 | 34 | .SH AUTHOR 35 | \fBunity-tweak-tool\fR was written by Freyja Development Team and this manual page by Barneedhar Vigneshwar . 36 | 37 | Both are released under the GNU General Public License, version 3 or later. 38 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: unity-tweak-tool 3 | Upstream-Contact: Barneedhar Vigneshwar 4 | Source: https://launchpad.net/unity-tweak-tool/+download 5 | 6 | Files: * 7 | Copyright: 2012, Barneedhar Vigneshwar 8 | License: GPL-3+ 9 | 10 | Files: debian/* 11 | Copyright: 2012, Barneedhar Vigneshwar 12 | License: GPL-3+ 13 | 14 | License: GPL-3+ 15 | This program is free software: you can redistribute it and/or modify 16 | it under the terms of the GNU General Public License as published by 17 | the Free Software Foundation, either version 3 of the License, or 18 | (at your option) any later version. 19 | . 20 | This package is distributed in the hope that it will be useful, 21 | but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | GNU General Public License for more details. 24 | . 25 | You should have received a copy of the GNU General Public License 26 | along with this program. If not, see . 27 | . 28 | On Debian systems, the complete text of the GNU General 29 | Public License version 3 can be found in `/usr/share/common-licenses/GPL-3'. 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | unity-tweak-tool 2 | ================ 3 | 4 | Unity Tweak Tool is a configuration tool for the Unity Desktop. 5 | 6 | License: GPLv3 7 | 8 | Unity Tweak Tool can be found at http://launchpad.net/unity-tweak-tool. 9 | 10 | You can get the latest sources from the git repository: 11 | 12 | git clone https://github.com/freyja-dev/unity-tweak-tool.git . 13 | 14 | You can also browse the sources on GitHub: 15 | 16 | https://github.com/freyja-dev/unity-tweak-tool 17 | 18 | 19 | ###Usage: 20 | 21 | 22 | On Ubuntu systems (>12.10) you can install from the Freyja Development PPA: 23 | 24 | sudo add-apt-repository ppa:freyja-dev/unity-tweak-tool-daily 25 | 26 | or, from source folder: 27 | 28 | ./unity-tweak-tool 29 | 30 | Unity Tweak Tool depends on: 31 | 32 | * debhelper (>= 9~) 33 | * python3 (>= 3.2) 34 | * python3-distutils-extra (>= 2.10) 35 | * python (>= 2.6.6-3~) 36 | * gir1.2-glib-2.0 37 | * gir1.2-gtk-3.0 38 | * python3-xdg 39 | 40 | ----------- 41 | 42 | ###Contributing: 43 | 44 | If you want to contribute code, please either send patches or a pull request to GitHub: 45 | 46 | https://github.com/freyja-dev/unity-tweak-tool 47 | 48 | Bugs are managed via Launchpad and can be reported at: 49 | 50 | https://bugs.launchpad.net/unity-tweak-tool 51 | 52 | Translations are managed on launchpad. You can edit / contribute new translations using the web interface at: 53 | 54 | https://translations.launchpad.net/unity-tweak-tool 55 | -------------------------------------------------------------------------------- /notes/launcher_color.txt: -------------------------------------------------------------------------------- 1 | # Author : J Phani Mahesh 2 | 3 | Issue: The launcher background colour is currently superimposed on the chamelonic launcher. The result is an awkward unpredictable mixture. This is a result of implementation in unity. Absolutely nothing can be done about it, unless the unity devs change their mind. 4 | 5 | Details: 6 | Imagine two sheets. One above other. Lower one is chamelonic. Its color is decided by the background. Upper one can be set by you separately. Upper layer can be made transparent by using rgba instead of rgb. Now, you see a resultant color, looking from the top. The launcher transparency setting affects the transparency of the overall color thus formed. 7 | 8 | Solution: 9 | - Do not expose the opacity setting at all. (In the custom Color chooser dialog) 10 | - Chamelonic => top-opacity=0. Then no matter what the choosen color is, the top layer remains transparent and the result is chamelonic launcher. 11 | - Custom => top-opacity=1. Now the top layer is opaque, so the result is the choosen color. 12 | 13 | AdditionalNotes: 14 | Color chooser gives a Gdk.Color object. This has rgb values from 0 to 65535. Gsettings understands 0 to 255. Hence use color.red_float and sister attributes to get value in range 0 to 1, *255, round, convert to hex and use the resultant '#rrggbbaa' string to set gsettings. 15 | 16 | Docs mark get_color() as deprecated. However, get_rgba() needs a RGBA object made beforehand, and hence isn't pythonic. Lets change when color goes unsupported. Added necessary code to accomodate both to the color_to_hex function just in case. 17 | -------------------------------------------------------------------------------- /UnityTweakTool/config/logging.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | # This file should control the logging setup for entire application 33 | 34 | import logging 35 | import xdg.BaseDirectory 36 | import os 37 | 38 | logger=logging.getLogger('UnityTweakTool.config.logging') 39 | 40 | # This makes the directory if missing. 41 | CACHEDIR = xdg.BaseDirectory.save_cache_path('unity-tweak-tool') 42 | LOGFILE = os.path.join(CACHEDIR,'debug.log') 43 | LOGFMT = '%(asctime)s - %(levelname)-8s :: %(name)s - %(funcName)s - %(message)s' 44 | LOGLVL = logging.DEBUG 45 | 46 | -------------------------------------------------------------------------------- /UnityTweakTool/about.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | import os, os.path 33 | 34 | from gi.repository import Gtk, Gio 35 | from UnityTweakTool.config.data import get_data_path 36 | 37 | class About (): 38 | def __init__(self): 39 | '''Handler Initialisations. 40 | Obtain all references here.''' 41 | self.builder = Gtk.Builder() 42 | self.builder.set_translation_domain('unity-tweak-tool') 43 | self.glade = (os.path.join(get_data_path(), 44 | 'about.ui')) 45 | self.builder.add_from_file(self.glade) 46 | self.builder.connect_signals(self) 47 | self.dialog=self.builder.get_object('about_unitytweak') 48 | self.dialog.run() 49 | self.dialog.destroy() 50 | -------------------------------------------------------------------------------- /UnityTweakTool/config/ui.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | class ui(): 33 | def __init__(self, builder): 34 | self.builder = builder 35 | def __getitem__(self, obj): 36 | return self.builder.get_object(obj) 37 | def sensitize(self, list): 38 | for item in list: 39 | self.__getitem__(item).set_sensitive(True) 40 | def unsensitize(self,list): 41 | for item in list: 42 | self.__getitem__(item).set_sensitive(False) 43 | def tooltip(self, list): 44 | for item in list: 45 | tooltip = "Schema / key missing for this widget." 46 | self.unsensitize(list) 47 | self.__getitem__(item).set_tooltip_text(tooltip) 48 | self.__getitem__(item).set_tooltip_markup(tooltip) 49 | -------------------------------------------------------------------------------- /UnityTweakTool/section/dynamic.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | from gi.repository import Gio 33 | 34 | schema_list = Gio.Settings.list_schemas() 35 | 36 | # in Ubuntu >15.04 org.gnome.settings-daemon.peripherals was moved to org.gnome.desktop.peripherals. 37 | # lets check if we're using an older version and fix it if needed 38 | if "org.gnome.desktop.peripherals" not in schema_list: 39 | touchpad_schema = 'settings-daemon' 40 | else: 41 | touchpad_schema = 'desktop' 42 | 43 | 44 | # Desktop feature was removed in nautilus >=3.28. So we use nemo to draw desktop icons. 45 | #See https://bugs.launchpad.net/ubuntu/+source/unity/+bug/1814506 46 | if "org.gnome.nautilus.desktop" not in schema_list: 47 | desktop_schema = 'org.nemo.desktop' 48 | else: 49 | desktop_schema = 'org.gnome.nautilus.desktop' 50 | -------------------------------------------------------------------------------- /data/errordialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | True 6 | False 7 | 5 8 | Schemas missing 9 | True 10 | True 11 | dialog 12 | True 13 | error 14 | ok 15 | The following schema is missing 16 | 17 | 18 | 19 | 20 | False 21 | vertical 22 | 2 23 | 24 | 25 | False 26 | end 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | False 36 | True 37 | end 38 | 0 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /UnityTweakTool/elements/button.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | import logging 33 | logger=logging.getLogger('UnityTweakTool.elements.button') 34 | 35 | class OverviewButton: 36 | def __init__(self,section,page,id,notebook): 37 | self.section=section 38 | self.id=id 39 | self.page=page 40 | self.notebook=notebook 41 | logger.debug('Initialised a button with id {self.id} in section {self.section} and page {self.page}'.format(self=self)) 42 | 43 | def handler(self,*args,**kwargs): 44 | self.notebook.set_current_page(self.section) 45 | self.notebook.get_nth_page(self.section).set_current_page(self.page) 46 | logger.info('Handler for {self.id} executed'.format(self=self)) 47 | 48 | def register(self,handler): 49 | handler['on_%s_clicked'%self.id]=self.handler 50 | logger.debug('Handler for {self.id} registered'.format(self=self)) 51 | -------------------------------------------------------------------------------- /UnityTweakTool/elements/toolbutton.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | import logging 33 | logger=logging.getLogger('UnityTweakTool.elements.toolbutton') 34 | 35 | class OverviewToolButton: 36 | def __init__(self,section,page,id,notebook): 37 | self.section=section 38 | self.id=id 39 | self.page=page 40 | self.notebook=notebook 41 | logger.debug('Initialised a toolbutton with id {self.id} in section {self.section} and page {self.page}'.format(self=self)) 42 | 43 | def handler(self,*args,**kwargs): 44 | self.notebook.set_current_page(self.section) 45 | self.notebook.get_nth_page(self.section).set_current_page(self.page) 46 | logger.info('Handler for {self.id} executed'.format(self=self)) 47 | 48 | def register(self,handler): 49 | handler['on_%s_clicked'%self.id]=self.handler 50 | logger.debug('Handler for {self.id} registered'.format(self=self)) 51 | -------------------------------------------------------------------------------- /UnityTweakTool/elements/resetbutton.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | ''' Definitions for ResetButton element. ''' 33 | from UnityTweakTool.backends import gsettings 34 | 35 | import logging 36 | logger=logging.getLogger('UnityTweakTool.elements.resetbutton') 37 | 38 | class ResetButton: 39 | def __init__(self,controlObj): 40 | ''' Initialise a ResetButton from a controlObj dictionary ''' 41 | self.id = controlObj['id'] 42 | self.tab = controlObj['tab'] 43 | logger.debug('Initialised a ResetButton with id {self.id}'.format(self=self)) 44 | 45 | def register(self,handler): 46 | ''' Register handler on a handler object ''' 47 | handler['on_%s_clicked'% self.id]=self.handler 48 | logger.debug('Handler for {self.id} registered'.format(self=self)) 49 | 50 | def handler(self,*args,**kwargs): 51 | ''' Handle clicked signals ''' 52 | self.tab.reset() 53 | self.tab.refresh() 54 | logger.info('Handler for {self.id} executed'.format(self=self)) 55 | 56 | # The following are required to allow RB to be considered just like any other element 57 | def reset(self): 58 | pass 59 | def refresh(self): 60 | pass 61 | -------------------------------------------------------------------------------- /UnityTweakTool/elements/filechooser.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | ''' Definitions for FileChooser element. ''' 33 | import UnityTweakTool.config.data as data 34 | from gi.repository import Gtk 35 | import os 36 | 37 | import logging 38 | logger=logging.getLogger('UnityTweakTool.elements.filechooser') 39 | 40 | class FileChooser: 41 | def __init__(self,controlObj): 42 | ''' Initialise a FileChooser element from a dictionary''' 43 | self.builder = Gtk.Builder() 44 | self.ui = os.path.join(data.get_data_path(),'filechooser-theme.ui') 45 | self.builder.add_from_file(self.ui) 46 | self.widget=self.builder.get_object('themeselector') 47 | self.builder.connect_signals(self) 48 | def run(self): 49 | self.widget.run() 50 | def on_button_cancel_clicked(self,*args,**kwargs): 51 | logger.info('Theme selection cancelled by user') 52 | self.widget.destroy() 53 | def on_button_install_clicked(self,*args,**kwargs): 54 | logger.debug('Install clicked') 55 | file=self.widget.get_filename() 56 | if file is None: 57 | return 58 | logger.info('Attempting to install %s'%file) 59 | logger.warn('Unimplemented logic') 60 | # TODO : Get file name and do the installation 61 | self.widget.destroy() 62 | 63 | -------------------------------------------------------------------------------- /UnityTweakTool/section/spaghetti/values.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | from . import gsettings 33 | from UnityTweakTool.config.ui import ui 34 | 35 | class values(): 36 | 37 | def get_value(self, type, schema, key, key_list): 38 | if schema is not None: 39 | if gsettings.test_key(schema, key): 40 | attr = 'get_' + type 41 | return getattr(schema, attr)(key) 42 | else: 43 | print('%s key not present.' % key) 44 | self.ui.tooltip(key_list) 45 | else: 46 | print('%s schema not present.' % schema) 47 | 48 | def set_value(self, type, schema, key, setting): 49 | if schema is not None: 50 | if gsettings.test_key(schema, key): 51 | attr = 'set_' + type 52 | return getattr(schema, attr)(key, setting) 53 | else: 54 | print('%s key not present.' % key) 55 | else: 56 | print('%s schema not present.' % schema) 57 | 58 | def reset_value(self, schema, key): 59 | if schema is not None: 60 | if gsettings.test_key(schema, key): 61 | return schema.reset(key) 62 | else: 63 | print('%s key not present.' % key) 64 | else: 65 | print('%s schema not present.' % schema) 66 | -------------------------------------------------------------------------------- /UnityTweakTool/config/data.py: -------------------------------------------------------------------------------- 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- 2 | # 3 | # Team: 4 | # J Phani Mahesh 5 | # Barneedhar (jokerdino) 6 | # Amith KK 7 | # Georgi Karavasilev 8 | # Sam Tran 9 | # Sam Hewitt 10 | # Angel Araya 11 | # 12 | # Description: 13 | # A One-stop configuration tool for Unity. 14 | # 15 | # Legal Stuff: 16 | # 17 | # This file is a part of Unity Tweak Tool 18 | # 19 | # Unity Tweak Tool is free software; you can redistribute it and/or modify it under 20 | # the terms of the GNU General Public License as published by the Free Software 21 | # Foundation; version 3. 22 | # 23 | # Unity Tweak Tool is distributed in the hope that it will be useful, but WITHOUT 24 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 25 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 26 | # details. 27 | # 28 | # You should have received a copy of the GNU General Public License along with 29 | # this program; if not, see 30 | 31 | __all__ = [ 32 | 'project_path_not_found', 33 | 'get_data_file', 34 | 'get_data_path', 35 | ] 36 | 37 | # Where your project will look for your data (for instance, images and ui 38 | # files). By default, this is ../data, relative your trunk layout 39 | __unity_tweak_tool_data_directory__ = '../../data/' 40 | __license__ = 'GPL-3' 41 | __version__ = '0.0.7' 42 | 43 | import os 44 | 45 | from locale import gettext as _ 46 | 47 | class project_path_not_found(Exception): 48 | """Raised when we can't find the project directory.""" 49 | 50 | 51 | def get_data_file(*path_segments): 52 | """Get the full path to a data file. 53 | 54 | Returns the path to a file underneath the data directory (as defined by 55 | `get_data_path`). Equivalent to os.path.join(get_data_path(), 56 | *path_segments). 57 | """ 58 | return os.path.join(get_data_path(), *path_segments) 59 | 60 | 61 | def get_data_path(): 62 | """Retrieve unity-tweak-tool data path""" 63 | 64 | # Get pathname absolute or relative. 65 | path = os.path.join( 66 | os.path.dirname(__file__), __unity_tweak_tool_data_directory__) 67 | 68 | abs_data_path = os.path.abspath(path) 69 | if not os.path.exists(abs_data_path): 70 | raise project_path_not_found 71 | 72 | return abs_data_path 73 | 74 | def get_version(): 75 | return __version__ 76 | -------------------------------------------------------------------------------- /UnityTweakTool/section/skeletonpage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | import os, os.path 33 | import UnityTweakTool.config.data as data 34 | from UnityTweakTool.elements.resetbutton import ResetButton 35 | from gi.repository import Gtk, Gio 36 | 37 | class Section (): 38 | def __init__(self, ui,id): 39 | self.builder = Gtk.Builder() 40 | self.builder.set_translation_domain('unity-tweak-tool') 41 | self.ui = os.path.join(data.get_data_path(),ui) 42 | self.builder.add_from_file(self.ui) 43 | self.page = self.builder.get_object(id) 44 | self.page.unparent() 45 | self.handler={} 46 | def add_page(self,page): 47 | page.register_tab(self.handler) 48 | page.refresh() 49 | def register(self): 50 | self.builder.connect_signals(self.handler) 51 | 52 | class Tab(): 53 | def __init__(self,elements): 54 | self.registered=False 55 | self.elements=elements 56 | 57 | def register_tab(self,handler): 58 | assert self.registered is False 59 | for element in self.elements: 60 | element.register(handler) 61 | self.registered=True 62 | def enable_restore(self,id): 63 | self.elements.append(ResetButton({'id':id,'tab':self})) 64 | def reset(self): 65 | for element in self.elements: 66 | element.reset() 67 | def refresh(self): 68 | for element in self.elements: 69 | element.refresh() 70 | -------------------------------------------------------------------------------- /UnityTweakTool/section/spaghetti/unitytweakconfig.py: -------------------------------------------------------------------------------- 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- 2 | # 3 | # Team: 4 | # J Phani Mahesh 5 | # Barneedhar (jokerdino) 6 | # Amith KK 7 | # Georgi Karavasilev 8 | # Sam Tran 9 | # Sam Hewitt 10 | # Angel Araya 11 | # 12 | # Description: 13 | # A One-stop configuration tool for Unity. 14 | # 15 | # Legal Stuff: 16 | # 17 | # This file is a part of Unity Tweak Tool 18 | # 19 | # Unity Tweak Tool is free software; you can redistribute it and/or modify it under 20 | # the terms of the GNU General Public License as published by the Free Software 21 | # Foundation; version 3. 22 | # 23 | # Unity Tweak Tool is distributed in the hope that it will be useful, but WITHOUT 24 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 25 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 26 | # details. 27 | # 28 | # You should have received a copy of the GNU General Public License along with 29 | # this program; if not, see 30 | 31 | __all__ = [ 32 | 'project_path_not_found', 33 | 'get_data_file', 34 | 'get_data_path', 35 | ] 36 | 37 | # Where your project will look for your data (for instance, images and ui 38 | # files). By default, this is ../data, relative your trunk layout 39 | __unity_tweak_tool_data_directory__ = '../../../data/' 40 | __license__ = 'GPL-3' 41 | __version__ = '0.0.7' 42 | 43 | import os 44 | 45 | from locale import gettext as _ 46 | 47 | class project_path_not_found(Exception): 48 | """Raised when we can't find the project directory.""" 49 | 50 | 51 | def get_data_file(*path_segments): 52 | """Get the full path to a data file. 53 | 54 | Returns the path to a file underneath the data directory (as defined by 55 | `get_data_path`). Equivalent to os.path.join(get_data_path(), 56 | *path_segments). 57 | """ 58 | return os.path.join(get_data_path(), *path_segments) 59 | 60 | 61 | def get_data_path(): 62 | """Retrieve unity-tweak-tool data path""" 63 | 64 | # Get pathname absolute or relative. 65 | path = os.path.join( 66 | os.path.dirname(__file__), __unity_tweak_tool_data_directory__) 67 | 68 | abs_data_path = os.path.abspath(path) 69 | if not os.path.exists(abs_data_path): 70 | raise project_path_not_found 71 | 72 | return abs_data_path 73 | 74 | def get_version(): 75 | return __version__ 76 | -------------------------------------------------------------------------------- /data/about.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | False 6 | 5 7 | False 8 | 70 9 | dialog 10 | Unity Tweak Tool 11 | 0.0.7 12 | Copyright © 2013 Freyja Development team 13 | Unity Tweak Tool is a settings manager intended to be used with Ubuntu Unity. 14 | https://launchpad.net/unity-tweak-tool 15 | Unity Tweak Tool on Launchpad 16 | GPL3 17 | Amith KK <amithkumaran@gmail.com> 18 | Angel Araya <al.arayaq@gmail.com> 19 | Barneedhar (jokerdino) <barneedhar@ubuntu.com> 20 | Georgi Karavasilev <kokoto-java@ubuntu.com> 21 | J Phani Mahesh <phanimahesh@gmail.com> 22 | Sam Hewitt <snwh@ubuntu.com> 23 | Sam Tran <samvtran@gmail.com> 24 | Barneedhar (jokerdino) <barneedhar@ubuntu.com> 25 | Sam Hewitt <hewittsamuel@gmail.com> 26 | /usr/share/icons/hicolor/64x64/apps/unity-tweak-tool.png 27 | gpl-3-0 28 | 29 | 30 | False 31 | vertical 32 | 2 33 | 34 | 35 | False 36 | end 37 | 38 | 39 | False 40 | True 41 | end 42 | 0 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /unity-tweak-tool: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | import argparse 33 | import UnityTweakTool 34 | import os 35 | 36 | import gettext 37 | gettext.bindtextdomain('unity-tweak-tool') 38 | _=gettext.gettext 39 | 40 | 41 | parser = argparse.ArgumentParser() 42 | optgrp = parser.add_mutually_exclusive_group() 43 | 44 | optgrp.add_argument('-u', '--unity', help=_('Start in the Unity tab'), action='store_true') 45 | optgrp.add_argument('-w', '--winmng', help=_('Start in the WindowManager tab'), action='store_true') 46 | optgrp.add_argument('-a', '--appearance', help=_('Start in the appearance tab'), action='store_true') 47 | optgrp.add_argument('-s', '--system', help=_('Start in the system tab'), action='store_true') 48 | optgrp.add_argument('--reset-unity', help=_('Reset Unity, wiping all configuration changes.'), action='store_true') 49 | 50 | 51 | # DBUS crashes if DISPLAY is not set. 52 | # https://errors.ubuntu.com/problem/5ce3e25dca09d233db038f04e57e179dda28ec9b 53 | # Make a safe bet that it is :0. 54 | # If you have multi display/ ssh -X, you can prolly debug if there's an issue. 55 | if "DISPLAY" not in os.environ: 56 | os.environ["DISPLAY"] = ":0" 57 | 58 | args=parser.parse_args() 59 | if args.unity: 60 | UnityTweakTool.Application(1) 61 | elif args.winmng: 62 | UnityTweakTool.Application(2) 63 | elif args.appearance: 64 | UnityTweakTool.Application(3) 65 | elif args.system: 66 | UnityTweakTool.Application(4) 67 | elif args.reset_unity: 68 | print(_(""" 69 | WARNING: You are about to reset Unity to its default configuration. 70 | This will result in loss of configuration. 71 | It is normal for your desktop to flicker during the process. 72 | Type yes to continue, anything else to exit. 73 | """)) 74 | prompt = input(_("Do you wish to continue?")) 75 | if prompt.lower() == 'yes': 76 | UnityTweakTool.reset_all() 77 | print(_("Please log out and log back in.")) 78 | else: 79 | UnityTweakTool.Application() 80 | -------------------------------------------------------------------------------- /UnityTweakTool/elements/option.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | ''' Generic option ''' 33 | from UnityTweakTool.backends import gsettings 34 | 35 | #import logging 36 | #logger=logging.getLogger('UnityTweakTool.elements.option') 37 | 38 | class Option: 39 | ''' Generic class to be used for those options which 40 | are not straightforward to port. Will be removed in due time.''' 41 | def __init__(self,controlObj): 42 | self.handler=controlObj['handler'] 43 | self.reset =controlObj['reset'] 44 | self.handlerid=controlObj['handlerid'] 45 | self.refresh=controlObj['refresh'] 46 | def register(self,handler): 47 | handler[self.handlerid]=self.handler 48 | 49 | class HandlerObject: 50 | def __init__(self,ho): 51 | self.ho=ho 52 | def isHandler(attrname,ho=ho,prefix='on',suffix='reset_clicked'): 53 | return attrname.startswith(prefix) and \ 54 | not attrname.endswith(suffix) and \ 55 | callable(getattr(ho, attrname)) 56 | def isResetHandler(attrname,ho=ho,prefix='on',suffix='reset_clicked'): 57 | return attrname.startswith(prefix) and \ 58 | attrname.endswith(suffix) and \ 59 | callable(getattr(ho, attrname)) 60 | handlers = list(filter(isHandler, dir(ho))) 61 | self.hodict={key:getattr(ho,key) for key in handlers} 62 | reset_handlers = list(filter(isResetHandler,dir(ho))) 63 | self.hodict_reset={key:getattr(ho,key) for key in reset_handlers} 64 | self.register_tab=self.register 65 | def register(self,handler): 66 | handler.update(self.hodict) 67 | for key,val in self.hodict_reset.items(): 68 | if key in handler: 69 | def reset_fix(*args,ported_reset=handler[key],old_reset=val,**kwargs): 70 | old_reset(*args,**kwargs) 71 | ported_reset(*args,**kwargs) 72 | handler[key]=reset_fix 73 | else: 74 | handler[key]=val 75 | def refresh(self): 76 | self.ho.refresh() 77 | def reset(self): 78 | self.ho.reset() 79 | -------------------------------------------------------------------------------- /UnityTweakTool/elements/fontbutton.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | ''' Definitions for FontButton element. ''' 33 | from UnityTweakTool.backends import gsettings 34 | 35 | import logging 36 | logger=logging.getLogger('UnityTweakTool.elements.fontbutton') 37 | 38 | class FontButton: 39 | def __init__(self,controlObj): 40 | ''' Initialise a FontButton element from a dictionary''' 41 | self.id = controlObj['id'] 42 | self.ui = controlObj['builder'].get_object(controlObj['id']) 43 | self.schema = controlObj['schema'] 44 | self.path = controlObj['path'] 45 | self.key = controlObj['key'] 46 | self.type = 'string' 47 | assert gsettings.is_valid( 48 | schema=self.schema, 49 | path=self.path, 50 | key=self.key 51 | ) 52 | logger.debug('Initialised a fontbutton with id {self.id} to control key {self.key} of type {self.type} in schema {self.schema} with path {self.path}'.format(self=self)) 53 | 54 | def register(self,handler): 55 | ''' register handler on a handler object ''' 56 | handler['on_%s_font_set'%self.id]=self.handler 57 | logger.debug('Handler for {self.id} registered'.format(self=self)) 58 | 59 | def refresh(self): 60 | ''' Refresh UI reading from backend ''' 61 | logger.debug('Refreshing UI display for {self.id}'.format(self=self)) 62 | self.ui.set_font_name( 63 | gsettings.get( 64 | schema=self.schema, 65 | path =self.path, 66 | key =self.key, 67 | type =self.type 68 | ) 69 | ) 70 | 71 | def handler(self,*args,**kwargs): 72 | ''' handle toggle signals ''' 73 | gsettings.set( 74 | schema=self.schema, 75 | path=self.path, 76 | key=self.key, 77 | type=self.type, 78 | value=self.ui.get_font_name() 79 | ) 80 | logger.info('Handler for {self.id} executed'.format(self=self)) 81 | 82 | def reset(self): 83 | ''' Reset the controlled key ''' 84 | gsettings.reset(schema=self.schema,path=self.path,key=self.key) 85 | logger.debug('Key {self.key} in schema {self.schema} and path {self.path} reset.'.format(self=self)) 86 | -------------------------------------------------------------------------------- /data/media/scalable/unity-tweak-tool-wm-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 20 | 40 | 47 | 48 | 50 | 51 | 53 | image/svg+xml 54 | 56 | 57 | 58 | 59 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /data/filechooser-theme.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | application/x-gtar 7 | application/zip 8 | application/x-tar 9 | application/x-gzip 10 | application/x-7z-compressed 11 | 12 | 13 | 14 | False 15 | 5 16 | popup 17 | Choose a Theme file to install 18 | GtkFileChooserDialog 19 | True 20 | True 21 | dialog 22 | True 23 | False 24 | ArchiveFilter 25 | 26 | 27 | False 28 | vertical 29 | 2 30 | 31 | 32 | False 33 | end 34 | 35 | 36 | gtk-cancel 37 | True 38 | True 39 | True 40 | True 41 | 42 | 43 | 44 | False 45 | True 46 | 0 47 | 48 | 49 | 50 | 51 | Install Theme 52 | True 53 | True 54 | True 55 | 56 | 57 | 58 | False 59 | True 60 | 1 61 | 62 | 63 | 64 | 65 | False 66 | True 67 | end 68 | 0 69 | 70 | 71 | 72 | 73 | 74 | button_cancel 75 | button_install 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /UnityTweakTool/elements/cbox.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | ''' Definitions for cbox element. ''' 33 | from UnityTweakTool.backends import gsettings 34 | 35 | import logging 36 | logger=logging.getLogger('UnityTweakTool.elements.cbox') 37 | 38 | class ComboBox: 39 | def __init__(self,controlObj): 40 | ''' Initialise a ComboBox element from a dictionary''' 41 | self.id = controlObj['id'] 42 | self.ui = controlObj['builder'].get_object(controlObj['id']) 43 | self.schema = controlObj['schema'] 44 | self.path = controlObj['path'] 45 | self.key = controlObj['key'] 46 | self.type = controlObj['type'] 47 | self.map = controlObj['map'] 48 | self.invmap = dict([ (v,k) for (k,v) in self.map.items() ]) 49 | self.disabled = False 50 | try: 51 | assert gsettings.is_valid( 52 | schema=self.schema, 53 | path=self.path, 54 | key=self.key 55 | ) 56 | except AssertionError as e: 57 | self.disabled = True 58 | logger.debug('Initialised a ComboBox with id {self.id} to control key {self.key} of type {self.type} in schema {self.schema} with path {self.path}'.format(self=self)) 59 | 60 | def register(self,handler): 61 | ''' register handler on a handler object ''' 62 | handler['on_%s_changed'%self.id]=self.handler 63 | logger.debug('Handler for {self.id} registered'.format(self=self)) 64 | 65 | def refresh(self): 66 | ''' Refresh UI reading from backend ''' 67 | logger.debug('Refreshing UI display for {self.id}'.format(self=self)) 68 | if self.disabled: 69 | self.ui.set_active(False) 70 | return 71 | self.ui.set_active( 72 | self.map[ 73 | gsettings.get( 74 | schema=self.schema, 75 | path =self.path, 76 | key =self.key, 77 | type =self.type 78 | ) 79 | ] 80 | ) 81 | 82 | def handler(self,*args,**kwargs): 83 | ''' handle toggle signals ''' 84 | if self.disabled: 85 | return 86 | gsettings.set( 87 | schema=self.schema, 88 | path=self.path, 89 | key=self.key, 90 | type=self.type, 91 | value=self.invmap[self.ui.get_active()] 92 | ) 93 | logger.info('Handler for {self.id} executed'.format(self=self)) 94 | 95 | def reset(self): 96 | ''' Reset the controlled key ''' 97 | if self.disabled: 98 | return 99 | gsettings.reset(schema=self.schema,path=self.path,key=self.key) 100 | logger.debug('Key {self.key} in schema {self.schema} and path {self.path} reset.'.format(self=self)) 101 | -------------------------------------------------------------------------------- /UnityTweakTool/elements/spin.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | ''' Definitions for Spin button element. ''' 33 | from UnityTweakTool.backends import gsettings 34 | 35 | import logging 36 | logger=logging.getLogger('UnityTweakTool.elements.spin') 37 | 38 | class SpinButton: 39 | def __init__(self,controlObj): 40 | ''' Initialise a SpinButton from a controlObj dictionary ''' 41 | self.id = controlObj['id'] 42 | self.ui = controlObj['builder'].get_object(controlObj['id']) 43 | self.schema = controlObj['schema'] 44 | self.path = controlObj['path'] 45 | self.key = controlObj['key'] 46 | self.type = controlObj['type'] 47 | self.min = controlObj['min'] 48 | self.max = controlObj['max'] 49 | self.disabled = False 50 | try: 51 | assert gsettings.is_valid( 52 | schema=self.schema, 53 | path=self.path, 54 | key=self.key 55 | ) 56 | except AssertionError as e: 57 | self.disabled = True 58 | # TODO : set the range mased on the config min-max 59 | # self.ui. 60 | logger.debug('Initialised a spin with id {self.id} to control key {self.key} of type {self.type} in schema {self.schema} with path {self.path}'.format(self=self)) 61 | 62 | 63 | def register(self,handler): 64 | ''' Register handler on a handler object ''' 65 | handler['on_%s_value_changed'% self.id]=self.handler 66 | logger.debug('Handler for {self.id} registered'.format(self=self)) 67 | 68 | def refresh(self): 69 | ''' Refresh the UI querying the backend ''' 70 | logger.debug('Refreshing UI display for {self.id}'.format(self=self)) 71 | if self.disabled: 72 | self.ui.set_sensitive(False) 73 | return 74 | self.ui.set_value( 75 | gsettings.get( 76 | schema= self.schema, 77 | path = self.path, 78 | key = self.key, 79 | type = self.type 80 | ) 81 | ) 82 | 83 | def handler(self,*args,**kwargs): 84 | ''' Handle notify::active signals ''' 85 | if self.disabled: 86 | return 87 | gsettings.set( 88 | schema = self.schema, 89 | path = self.path, 90 | key = self.key, 91 | type = self.type, 92 | value = self.ui.get_value() 93 | ) 94 | logger.info('Handler for {self.id} executed'.format(self=self)) 95 | 96 | def reset(self): 97 | ''' Reset the controlled key ''' 98 | if self.disabled: 99 | return 100 | gsettings.reset(schema=self.schema,path=self.path,key=self.key) 101 | logger.debug('Key {self.key} in schema {self.schema} and path {self.path} reset.'.format(self=self)) 102 | -------------------------------------------------------------------------------- /UnityTweakTool/elements/scale.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | ''' Definitions for Scale element. ''' 33 | from UnityTweakTool.backends import gsettings 34 | 35 | import logging 36 | logger=logging.getLogger('UnityTweakTool.elements.scale') 37 | 38 | class Scale: 39 | def __init__(self,controlObj): 40 | ''' Initialise a scale from a controlObj dictionary ''' 41 | self.id = controlObj['id'] 42 | self.ui = controlObj['builder'].get_object(controlObj['id']) 43 | self.schema = controlObj['schema'] 44 | self.path = controlObj['path'] 45 | self.key = controlObj['key'] 46 | self.type = controlObj['type'] 47 | self.min = controlObj['min'] 48 | self.max = controlObj['max'] 49 | self.ticks = controlObj['ticks'] 50 | self.disabled = False 51 | try: 52 | assert gsettings.is_valid( 53 | schema = self.schema, 54 | path = self.path, 55 | key = self.key 56 | ) 57 | except AssertionError as e: 58 | self.disabled=True 59 | for tick in self.ticks: 60 | self.ui.add_mark(*tick) 61 | # TODO : Set range using min, max 62 | logger.debug('Initialised a scale with id {self.id} to control key {self.key} of type {self.type} in schema {self.schema} with path {self.path}'.format(self=self)) 63 | 64 | 65 | def register(self,handler): 66 | ''' Register handler on a handler object ''' 67 | handler['on_%s_value_changed'% self.id]=self.handler 68 | logger.debug('Handler for {self.id} registered'.format(self=self)) 69 | 70 | def refresh(self): 71 | ''' Refresh the UI querying the backend ''' 72 | logger.debug('Refreshing UI display for {self.id}'.format(self=self)) 73 | if self.disabled: 74 | self.ui.set_sensitive(False) 75 | return 76 | self.ui.set_value( 77 | gsettings.get( 78 | schema=self.schema, 79 | path =self.path, 80 | key =self.key, 81 | type =self.type 82 | ) 83 | ) 84 | 85 | def handler(self,*args,**kwargs): 86 | ''' Handle value_changed signals ''' 87 | if self.disabled: 88 | return 89 | gsettings.set( 90 | schema=self.schema, 91 | path=self.path, 92 | key=self.key, 93 | type=self.type, 94 | value=self.ui.get_value() 95 | ) 96 | logger.info('Handler for {self.id} executed'.format(self=self)) 97 | 98 | def reset(self): 99 | ''' Reset the controlled key ''' 100 | if self.disabled: 101 | return 102 | gsettings.reset(schema=self.schema,path=self.path,key=self.key) 103 | logger.debug('Key {self.key} in schema {self.schema} and path {self.path} reset.'.format(self=self)) 104 | -------------------------------------------------------------------------------- /UnityTweakTool/elements/radio.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | ''' Definitions for Radio element. ''' 33 | from UnityTweakTool.backends import gsettings 34 | 35 | import logging 36 | logger=logging.getLogger('UnityTweakTool.elements.radio') 37 | 38 | class Radio: 39 | def __init__(self,controlObj): 40 | ''' Initialise a Radio from a controlObj dictionary ''' 41 | self.id = controlObj['id'] 42 | self.builder = controlObj['builder'] 43 | self.ui = controlObj['builder'].get_object(controlObj['id']) 44 | self.schema = controlObj['schema'] 45 | self.path = controlObj['path'] 46 | self.key = controlObj['key'] 47 | self.type = controlObj['type'] 48 | self.group = controlObj['group'] 49 | self.value = controlObj['value'] 50 | self.dependants = controlObj['dependants'] 51 | self.active = False 52 | self.disabled = False 53 | try: 54 | assert gsettings.is_valid( 55 | schema=self.schema, 56 | path=self.path, 57 | key=self.key 58 | ) 59 | except AssertionError as e: 60 | self.disabled=True 61 | logger.debug('Initialised a radiobutton with id {self.id} to control key {self.key} of type {self.type} in schema {self.schema} with path {self.path}'.format(self=self)) 62 | 63 | def register(self,handler): 64 | ''' Register handler on a handler object ''' 65 | handler['on_%s_toggled'% self.id]=self.handler 66 | logger.debug('Handler for {self.id} registered'.format(self=self)) 67 | 68 | def refresh(self): 69 | ''' Refresh the UI querying the backend ''' 70 | logger.debug('Refreshing UI display for {self.id}'.format(self=self)) 71 | if self.disabled: 72 | self.ui.set_sensitive(False) 73 | return 74 | self.active=gsettings.get( 75 | schema=self.schema, 76 | path =self.path, 77 | key =self.key, 78 | type =self.type 79 | ) == self.value 80 | self.ui.set_active(self.active) 81 | self.handledependants() 82 | 83 | def handler(self,*args,**kwargs): 84 | ''' Handle toggled signals ''' 85 | if self.disabled: 86 | return 87 | self.active=self.ui.get_active() 88 | if self.active: 89 | gsettings.set( 90 | schema=self.schema, 91 | path=self.path, 92 | key=self.key, 93 | type=self.type, 94 | value=self.value 95 | ) 96 | self.handledependants() 97 | logger.info('Handler for {self.id} executed'.format(self=self)) 98 | 99 | def reset(self): 100 | ''' Reset the controlled key ''' 101 | if self.disabled: 102 | return 103 | gsettings.reset(schema=self.schema,path=self.path,key=self.key) 104 | logger.debug('Key {self.key} in schema {self.schema} and path {self.path} reset.'.format(self=self)) 105 | 106 | def handledependants(self): 107 | status = False if self.disabled else self.active 108 | for element in self.dependants: 109 | self.builder.get_object(element).set_sensitive(status) 110 | -------------------------------------------------------------------------------- /UnityTweakTool/elements/switch.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | ''' Definitions for Switch element. ''' 33 | from UnityTweakTool.backends import gsettings 34 | 35 | import logging 36 | logger=logging.getLogger('UnityTweakTool.elements.switch') 37 | 38 | class Switch: 39 | def __init__(self,controlObj): 40 | ''' Initialise a switch from a controlObj dictionary ''' 41 | self.id = controlObj['id'] 42 | self.builder = controlObj['builder'] 43 | self.ui = controlObj['builder'].get_object(controlObj['id']) 44 | self.schema = controlObj['schema'] 45 | self.path = controlObj['path'] 46 | self.key = controlObj['key'] 47 | self.type = controlObj['type'] 48 | self.map = controlObj['map'] 49 | self.invmap = dict([ (v,k) for (k,v) in self.map.items() ]) 50 | self.dependants = controlObj['dependants'] 51 | self.disabled = False 52 | try: 53 | assert gsettings.is_valid( 54 | schema=self.schema, 55 | path=self.path, 56 | key=self.key 57 | ) 58 | except AssertionError as e: 59 | self.disabled = True 60 | logger.debug('Initialised a switch with id {self.id} to control key {self.key} of type {self.type} in schema {self.schema} with path {self.path}'.format(self=self)) 61 | 62 | def register(self,handler): 63 | ''' Register handler on a handler object ''' 64 | handler['on_%s_active_notify'% self.id]=self.handler 65 | logger.debug('Handler for {self.id} registered'.format(self=self)) 66 | 67 | def refresh(self): 68 | ''' Refresh the UI querying the backend ''' 69 | logger.debug('Refreshing UI display for {self.id}'.format(self=self)) 70 | if self.disabled: 71 | self.ui.set_sensitive(False) 72 | return 73 | self.active=self.map[ 74 | gsettings.get( 75 | schema=self.schema, 76 | path =self.path, 77 | key =self.key, 78 | type =self.type 79 | ) 80 | ] 81 | self.ui.set_active(self.active) 82 | self.handledependants() 83 | 84 | def handler(self,*args,**kwargs): 85 | ''' Handle notify::active signals ''' 86 | if self.disabled: 87 | return 88 | self.active=self.ui.get_active() 89 | gsettings.set( 90 | schema=self.schema, 91 | path=self.path, 92 | key=self.key, 93 | type=self.type, 94 | value=self.invmap[self.active] 95 | ) 96 | self.handledependants() 97 | logger.info('Handler for {self.id} executed'.format(self=self)) 98 | 99 | def reset(self): 100 | ''' Reset the controlled key ''' 101 | if self.disabled: 102 | return 103 | gsettings.reset(schema=self.schema,path=self.path,key=self.key) 104 | logger.debug('Key {self.key} in schema {self.schema} and path {self.path} reset.'.format(self=self)) 105 | 106 | def handledependants(self): 107 | status = False if self.disabled else self.active 108 | for element in self.dependants: 109 | self.builder.get_object(element).set_sensitive(status) 110 | -------------------------------------------------------------------------------- /UnityTweakTool/elements/checkbox.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | ''' Definitions for Checkbox element. ''' 33 | from UnityTweakTool.backends import gsettings 34 | 35 | import logging 36 | logger=logging.getLogger('UnityTweakTool.elements.checkbox') 37 | 38 | class CheckBox: 39 | def __init__(self,controlObj): 40 | ''' Initialise a Checkbox element from a dictionary''' 41 | self.id = controlObj['id'] 42 | self.builder = controlObj['builder'] 43 | self.ui = controlObj['builder'].get_object(controlObj['id']) 44 | self.schema = controlObj['schema'] 45 | self.path = controlObj['path'] 46 | self.key = controlObj['key'] 47 | self.type = controlObj['type'] 48 | self.map = controlObj['map'] 49 | self.invmap = dict([ (v,k) for (k,v) in self.map.items() ]) 50 | self.dependants = controlObj['dependants'] 51 | self.active = False 52 | self.disabled = False 53 | try: 54 | assert gsettings.is_valid( 55 | schema=self.schema, 56 | path=self.path, 57 | key=self.key 58 | ) 59 | except AssertionError as e: 60 | self.disabled = True 61 | logger.debug('Initialised a checkbox with id {self.id} to control key {self.key} of type {self.type} in schema {self.schema} with path {self.path}'.format(self=self)) 62 | 63 | def register(self,handler): 64 | ''' register handler on a handler object ''' 65 | handler['on_%s_toggled'%self.id]=self.handler 66 | logger.debug('Handler for {self.id} registered'.format(self=self)) 67 | 68 | def refresh(self): 69 | ''' Refresh UI reading from backend ''' 70 | logger.debug('Refreshing UI display for {self.id}'.format(self=self)) 71 | if self.disabled: 72 | self.ui.set_sensitive(False) 73 | return 74 | self.active=self.map[ 75 | gsettings.get( 76 | schema=self.schema, 77 | path =self.path, 78 | key =self.key, 79 | type =self.type 80 | ) 81 | ] 82 | self.ui.set_active(self.active) 83 | self.handledependants() 84 | 85 | def handler(self,*args,**kwargs): 86 | ''' handle toggle signals ''' 87 | if self.disabled: 88 | return 89 | self.active=self.ui.get_active() 90 | gsettings.set( 91 | schema=self.schema, 92 | path=self.path, 93 | key=self.key, 94 | type=self.type, 95 | value=self.invmap[self.active] 96 | ) 97 | self.handledependants() 98 | logger.info('Handler for {self.id} executed'.format(self=self)) 99 | 100 | def reset(self): 101 | ''' Reset the controlled key ''' 102 | if self.disabled: 103 | return 104 | gsettings.reset(schema=self.schema,path=self.path,key=self.key) 105 | logger.debug('Key {self.key} in schema {self.schema} and path {self.path} reset.'.format(self=self)) 106 | 107 | def handledependants(self): 108 | status=False if self.disabled else self.active 109 | for element in self.dependants: 110 | self.builder.get_object(element).set_sensitive(status) 111 | -------------------------------------------------------------------------------- /UnityTweakTool/elements/togglebutton.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | ''' Definitions for ToggleButton element. ''' 33 | from UnityTweakTool.backends import gsettings 34 | 35 | import logging 36 | logger=logging.getLogger('UnityTweakTool.elements.togglebutton') 37 | 38 | class ToggleButton: 39 | def __init__(self,controlObj): 40 | ''' Initialise a Toggle Button element from a dictionary''' 41 | self.id = controlObj['id'] 42 | self.builder = controlObj['builder'] 43 | self.ui = controlObj['builder'].get_object(controlObj['id']) 44 | self.schema = controlObj['schema'] 45 | self.path = controlObj['path'] 46 | self.key = controlObj['key'] 47 | self.type = controlObj['type'] 48 | self.map = controlObj['map'] 49 | self.invmap = dict([ (v,k) for (k,v) in self.map.items() ]) 50 | self.dependants = controlObj['dependants'] 51 | self.active = False 52 | self.disabled = False 53 | try: 54 | assert gsettings.is_valid( 55 | schema=self.schema, 56 | path=self.path, 57 | key=self.key 58 | ) 59 | except AssertionError as e: 60 | self.disabled = True 61 | logger.debug('Initialised a toggle button with id {self.id} to control key {self.key} of type {self.type} in schema {self.schema} with path {self.path}'.format(self=self)) 62 | 63 | def register(self,handler): 64 | ''' register handler on a handler object ''' 65 | handler['on_%s_toggled'%self.id]=self.handler 66 | logger.debug('Handler for {self.id} registered'.format(self=self)) 67 | 68 | def refresh(self): 69 | ''' Refresh UI reading from backend ''' 70 | logger.debug('Refreshing UI display for {self.id}'.format(self=self)) 71 | if self.disabled: 72 | self.ui.set_sensitive(False) 73 | return 74 | self.active=self.map[ 75 | gsettings.get( 76 | schema=self.schema, 77 | path =self.path, 78 | key =self.key, 79 | type =self.type 80 | ) 81 | ] 82 | self.ui.set_active(self.active) 83 | self.handledependants() 84 | 85 | def handler(self,*args,**kwargs): 86 | ''' handle toggle signals ''' 87 | if self.disabled: 88 | return 89 | self.active=self.ui.get_active() 90 | gsettings.set( 91 | schema=self.schema, 92 | path=self.path, 93 | key=self.key, 94 | type=self.type, 95 | value=self.invmap[self.active] 96 | ) 97 | self.handledependants() 98 | logger.info('Handler for {self.id} executed'.format(self=self)) 99 | 100 | def reset(self): 101 | ''' Reset the controlled key ''' 102 | if self.disabled: 103 | return 104 | gsettings.reset(schema=self.schema,path=self.path,key=self.key) 105 | logger.debug('Key {self.key} in schema {self.schema} and path {self.path} reset.'.format(self=self)) 106 | 107 | def handledependants(self): 108 | status=False if self.disabled else self.active 109 | for element in self.dependants: 110 | self.builder.get_object(element).set_sensitive(status) 111 | -------------------------------------------------------------------------------- /UnityTweakTool/elements/treeview.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | ''' Definitions for Treeview element. ''' 33 | from UnityTweakTool.backends import gsettings 34 | 35 | import logging 36 | logger=logging.getLogger('UnityTweakTool.elements.treeview') 37 | 38 | class TreeView: 39 | def __init__(self,controlObj): 40 | ''' Initialise a Treeview element from a dictionary''' 41 | self.id = controlObj['id'] 42 | self.ui = controlObj['builder'].get_object(controlObj['id']) 43 | self.schema = controlObj['schema'] 44 | self.path = controlObj['path'] 45 | self.key = controlObj['key'] 46 | self.type = controlObj['type'] 47 | self.map = controlObj['map'] 48 | self.invmap = dict([ (v,k) for (k,v) in self.map.items() ]) 49 | assert gsettings.is_valid( 50 | schema=self.schema, 51 | path=self.path, 52 | key=self.key 53 | ) 54 | logger.debug('Initialised a treeview with id {self.id} to control key {self.key} of type {self.type} in schema {self.schema} with path {self.path}'.format(self=self)) 55 | 56 | def register(self,handler): 57 | ''' register handler on a handler object ''' 58 | self.treeselection.register(handler) 59 | logger.debug('Handler for {self.id} registered'.format(self=self)) 60 | 61 | def refresh(self): 62 | ''' Refresh UI reading from backend ''' 63 | logger.debug('Refreshing UI display for {self.id}'.format(self=self)) 64 | self.ui.set_active( 65 | self.map[ 66 | gsettings.get( 67 | schema=self.schema, 68 | path =self.path, 69 | key =self.key, 70 | type =self.type 71 | ) 72 | ] 73 | ) 74 | 75 | def handler(self,*args,**kwargs): 76 | ''' handle treeselection changed signals ''' 77 | logger.info('Handler for {self.id} executed'.format(self=self)) 78 | 79 | def reset(self): 80 | ''' Reset the controlled key ''' 81 | gsettings.reset(schema=self.schema,path=self.path,key=self.key) 82 | logger.debug('Key {self.key} in schema {self.schema} and path {self.path} reset.'.format(self=self)) 83 | 84 | class TreeSelection: 85 | def __init__(self,controlObj): 86 | self.id=controlObj['id'] 87 | logger.debug('Initialised a Treeselection with id {self.id}'.format(self=self)) 88 | 89 | def register(self,handler): 90 | handler['on_%s_changed']=self.handler 91 | logger.debug('Handler for {self.id} registered'.format(self=self)) 92 | 93 | def handler(self,*args,**kwargs): 94 | ''' handle treeselection changed signals ''' 95 | store,iter=self.ui.get_selected() 96 | gsettings.set( 97 | schema=self.schema, 98 | path=self.path, 99 | key=self.key, 100 | type=self.type, 101 | value=self.invmap[self.ui.get_active()] 102 | ) 103 | logger.info('Handler for {self.id} executed'.format(self=self)) 104 | 105 | def reset(self): 106 | ''' Reset the controlled key ''' 107 | gsettings.reset(schema=self.schema,path=self.path,key=self.key) 108 | logger.debug('Key {self.key} in schema {self.schema} and path {self.path} reset.'.format(self=self)) 109 | -------------------------------------------------------------------------------- /data/media/scalable/unity-tweak-tool-unity-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 20 | 40 | 47 | 48 | 50 | 51 | 53 | image/svg+xml 54 | 56 | 57 | 58 | 59 | 60 | 65 | 69 | 75 | 76 | 85 | 93 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /UnityTweakTool/elements/colorchooser.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | ''' Definitions for ColorChooser element. ''' 33 | from UnityTweakTool.backends import gsettings 34 | from gi.repository import Gdk 35 | 36 | import logging 37 | logger=logging.getLogger('UnityTweakTool.elements.colorchooser') 38 | 39 | class ColorChooser: 40 | def __init__(self,controlObj): 41 | ''' Initialise a ColorChooser element from a dictionary''' 42 | self.id = controlObj['id'] 43 | self.ui = controlObj['builder'].get_object(controlObj['id']) 44 | self.schema = controlObj['schema'] 45 | self.path = controlObj['path'] 46 | self.key = controlObj['key'] 47 | self.type = 'string' 48 | self.disabled = False 49 | try: 50 | assert gsettings.is_valid( 51 | schema=self.schema, 52 | path=self.path, 53 | key=self.key 54 | ) 55 | except AssertionError as e: 56 | self.disabled = True 57 | self.color=Gdk.RGBA() 58 | logger.debug('Initialised a colorchooser with id {self.id} to control key {self.key} of type {self.type} in schema {self.schema} with path {self.path}'.format(self=self)) 59 | 60 | def register(self,handler): 61 | ''' register handler on a handler object ''' 62 | handler['on_%s_color_set'%self.id]=self.handler 63 | logger.debug('Handler for {self.id} registered'.format(self=self)) 64 | 65 | def refresh(self): 66 | ''' Refresh UI reading from backend ''' 67 | logger.debug('Refreshing UI display for {self.id}'.format(self=self)) 68 | if self.disabled: 69 | self.ui.set_sensitive(False) 70 | return 71 | color = gsettings.get( 72 | schema=self.schema, 73 | path =self.path, 74 | key =self.key, 75 | type =self.type 76 | ) 77 | components =( 78 | int(color[1:3],16), 79 | int(color[3:5],16), 80 | int(color[5:7],16), 81 | int(color[7:9],16)/255 82 | ) 83 | colorspec='rgba(%s,%s,%s,%f)'%components 84 | valid = Gdk.RGBA.parse(self.color,colorspec) 85 | if valid: 86 | self.ui.set_rgba(self.color) 87 | 88 | def get_color(self): 89 | logger.debug('Getting color for {self.id}'.format(self=self)) 90 | # This try catch is a fix for LP 1165627 91 | try: 92 | self.color = self.ui.get_rgba() 93 | except TypeError: 94 | self.ui.get_rgba(self.color) 95 | return '#{:02x}{:02x}{:02x}{:02x}'.format(*[round(x*255) for x in [self.color.red, self.color.green, self.color.blue, self.color.alpha]]) 96 | 97 | def handler(self,*args,**kwargs): 98 | ''' handle toggle signals ''' 99 | if self.disabled: 100 | return 101 | gsettings.set( 102 | schema=self.schema, 103 | path=self.path, 104 | key=self.key, 105 | type=self.type, 106 | value=self.get_color() 107 | ) 108 | logger.info('Handler for {self.id} executed'.format(self=self)) 109 | 110 | def reset(self): 111 | ''' Reset the controlled key ''' 112 | if self.disabled: 113 | return 114 | gsettings.reset(schema=self.schema,path=self.path,key=self.key) 115 | logger.debug('Key {self.key} in schema {self.schema} and path {self.path} reset.'.format(self=self)) 116 | -------------------------------------------------------------------------------- /UnityTweakTool/section/overview.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | from UnityTweakTool.section.skeletonpage import Section,Tab,Gtk 33 | from UnityTweakTool.elements.button import OverviewButton 34 | 35 | class Overview(Tab,Section): 36 | def __init__(self,notebook): 37 | Section.__init__(self,ui='overview.ui',id='box_overview') 38 | self.sections={ 39 | 1:{ 0:'b_unity-launcher', 40 | 1:'b_unity-search', 41 | 2:'b_unity-panel', 42 | 3:'b_unity-switcher', 43 | 4:'b_unity-additional'}, 44 | 2:{ 0:'b_wm-general', 45 | 1:'b_wm-workspaces', 46 | 2:'b_wm-window-spread', 47 | 3:'b_wm-window-snapping', 48 | 4:'b_wm-hotcorners', 49 | 5:'b_wm-additional'}, 50 | 3:{ 0:'b_appearance-theme', 51 | 1:'b_appearance-icons', 52 | 2:'b_appearance-cursors', 53 | 3:'b_appearance-fonts'}, 54 | 4:{ 0:'b_system-desktop-icons', 55 | 1:'b_system-security', 56 | 2:'b_system-scrolling'} 57 | } 58 | 59 | Tab.__init__(self,[OverviewButton( 60 | section=section,page=page,id=id,notebook=notebook) 61 | for section,set in self.sections.items() 62 | for page,id in set.items() 63 | ] 64 | ) 65 | 66 | self.register_tab(self.handler) 67 | self.register() 68 | 69 | # Symbolic icons 70 | self.icons = Gtk.IconTheme.get_default() 71 | self.style_context = self.builder.get_object('overview_window').get_style_context() 72 | self.style_context.connect('changed', self.on_style_context_change) 73 | 74 | def on_style_context_change(self, *args): 75 | try: 76 | self.symbolic_color = self.style_context.get_color(Gtk.StateFlags.ACTIVE) 77 | 78 | appearance_symbolic_icon = self.icons.lookup_icon('unity-tweak-tool-appearance-symbolic', 24, Gtk.IconLookupFlags.FORCE_SIZE) 79 | if appearance_symbolic_icon: 80 | appearance_symbolic_icon_pixbuf, was_sym = appearance_symbolic_icon.load_symbolic(self.symbolic_color, None, None, None) 81 | self.builder.get_object('i_appearance-title').set_from_pixbuf(appearance_symbolic_icon_pixbuf) 82 | 83 | unity_symbolic_icon = self.icons.lookup_icon('unity-tweak-tool-unity-symbolic', 24, Gtk.IconLookupFlags.FORCE_SIZE) 84 | if unity_symbolic_icon: 85 | unity_symbolic_icon_pixbuf, was_sym = unity_symbolic_icon.load_symbolic(self.symbolic_color, None, None, None) 86 | self.builder.get_object('i_unity-title').set_from_pixbuf(unity_symbolic_icon_pixbuf) 87 | 88 | system_symbolic_icon = self.icons.lookup_icon('unity-tweak-tool-system-symbolic', 24, Gtk.IconLookupFlags.FORCE_SIZE) 89 | if system_symbolic_icon: 90 | system_symbolic_icon_pixbuf, was_sym = system_symbolic_icon.load_symbolic(self.symbolic_color, None, None, None) 91 | self.builder.get_object('i_system-title').set_from_pixbuf(system_symbolic_icon_pixbuf) 92 | 93 | wm_symbolic_icon = self.icons.lookup_icon('unity-tweak-tool-wm-symbolic', 24, Gtk.IconLookupFlags.FORCE_SIZE) 94 | if wm_symbolic_icon: 95 | wm_symbolic_icon_pixbuf, was_sym = wm_symbolic_icon.load_symbolic(self.symbolic_color, None, None, None) 96 | self.builder.get_object('i_wm-title').set_from_pixbuf(wm_symbolic_icon_pixbuf) 97 | except Exception: 98 | pass 99 | # XXX : Temporary fix to prevent random attributeerrors. 100 | 101 | -------------------------------------------------------------------------------- /data/media/scalable/unity-tweak-tool-system-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 20 | 40 | 47 | 48 | 50 | 51 | 53 | image/svg+xml 54 | 56 | 57 | 58 | 59 | 60 | 65 | 73 | 81 | 86 | 91 | 96 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /UnityTweakTool/section/spaghetti/gsettings.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | import sys,os 33 | from gi.repository import Gio, Gdk,Gtk 34 | import UnityTweakTool.config.data as data 35 | import UnityTweakTool.section.dynamic as dynamic 36 | 37 | 38 | def test_schema(schema): 39 | if schema in Gio.Settings.list_relocatable_schemas(): 40 | pass 41 | elif schema in Gio.Settings.list_schemas(): 42 | pass 43 | else: 44 | print("Error: schema %s not installed" % schema) 45 | builder=Gtk.Builder() 46 | builder.set_translation_domain('unity-tweak-tool') 47 | ui = os.path.join(data.get_data_path(),'errordialog.ui') 48 | builder.add_from_file(ui) 49 | dialog = builder.get_object('errordialog') 50 | message = schema + "\n\nIn order to work properly, Unity Tweak Tool recommends you install the necessary packages" 51 | dialog.format_secondary_text(message) 52 | dialog.run() 53 | sys.exit() 54 | 55 | def test_key(schema, key): 56 | if key in schema.list_keys(): 57 | return True 58 | else: 59 | return False 60 | 61 | def plugin(plugin): 62 | schema = 'org.compiz.'+plugin 63 | path = '/org/compiz/profiles/unity/plugins/'+plugin+'/' 64 | test_schema(schema) 65 | return Gio.Settings(schema = schema, path = path) 66 | 67 | def unity(child = None): 68 | schema = 'com.canonical.Unity' 69 | schema = schema+'.'+child if child else schema 70 | test_schema(schema) 71 | return Gio.Settings(schema) 72 | 73 | def canonical(child): 74 | schema = 'com.canonical.'+child 75 | test_schema(schema) 76 | return Gio.Settings(schema) 77 | 78 | def compiz(child): 79 | schema = 'org.compiz.'+child 80 | test_schema(schema) 81 | return Gio.Settings(schema) 82 | 83 | def gnome(child): 84 | schema = 'org.gnome.'+child 85 | test_schema(schema) 86 | return Gio.Settings(schema) 87 | 88 | def color_to_hash(c,alpha=1): 89 | """Convert a Gdk.Color or Gdk.RGBA object to hex representation, overriding the alpha if asked""" 90 | if isinstance(c, Gdk.Color): 91 | return "#{:02x}{:02x}{:02x}{:02x}".format(*[round(x*255) for x in [c.red_float, c.green_float, c.blue_float,alpha]]) 92 | if isinstance(x, Gdk.RGBA): 93 | return "#{:02x}{:02x}{:02x}{:02x}".format(*[round(x*255) for x in [c.red, c.green, c.blue, alpha]]) 94 | # If it is neither a Gdk.Color object nor a Gdk.RGBA object, 95 | raise NotImplementedError 96 | 97 | # GSettings objects go here 98 | 99 | # Sorted by function type and alphabetical order 100 | 101 | bluetooth = canonical('indicator.bluetooth') 102 | datetime = canonical('indicator.datetime') 103 | hud = canonical('indicator.appmenu.hud') 104 | power = canonical('indicator.power') 105 | notifyosd = canonical('notify-osd') 106 | session = canonical('indicator.session') 107 | sound = canonical('indicator.sound') 108 | 109 | antialiasing = gnome('settings-daemon.plugins.xsettings') 110 | background = gnome('desktop.background') 111 | desktop = gnome('nautilus.desktop') 112 | interface = gnome('desktop.interface') 113 | lockdown = gnome('desktop.lockdown') 114 | wm = gnome('desktop.wm.preferences') 115 | touch = gnome(dynamic.touchpad_schema + '.peripherals.touchpad') 116 | 117 | animation = plugin('animation') 118 | core = plugin('core') 119 | expo = plugin('expo') 120 | grid = plugin('grid') 121 | move = plugin('move') 122 | opengl = plugin('opengl') 123 | resize = plugin('resize') 124 | scale = plugin('scale') 125 | unityshell = plugin('unityshell') 126 | zoom = plugin('ezoom') 127 | 128 | launcher = unity('Launcher') 129 | lenses = unity('Lenses') 130 | lens_apps = unity('ApplicationsLens') 131 | lens_files = unity('FilesLens') 132 | runner = unity('Runner') 133 | -------------------------------------------------------------------------------- /UnityTweakTool/backends/gsettings.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | '''This file contains the bindings to Gio.Settings''' 33 | from gi.repository import Gio 34 | import logging 35 | 36 | logger=logging.getLogger('UnityTweakTool.backends.gsettings') 37 | 38 | all_schemas = frozenset( 39 | Gio.Settings.list_schemas() 40 | ) 41 | all_relocatable_schemas = frozenset( 42 | Gio.Settings.list_relocatable_schemas() 43 | ) 44 | 45 | GSettings = dict() 46 | 47 | 48 | def is_valid(*,schema,path=None,key=None): 49 | ''' 50 | Check if the given schema,path,key,type combination is valid. All arguments are keyword-only. path is used to instantiate Gio.Settings only if schema is relocatable. Relocatable schemas are expected to be accompanied by path. 51 | ''' 52 | logger.debug('Checking if schema %s with path %s has key %s',schema,path,key) 53 | if schema in all_schemas: 54 | logger.debug('Ignoring path for static schema') 55 | if key is not None: 56 | try: 57 | _gs=GSettings[schema] 58 | except KeyError as e: 59 | _gs=Gio.Settings(schema) 60 | return key in _gs.list_keys() 61 | else: 62 | return True 63 | if schema in all_relocatable_schemas: 64 | if key is not None: 65 | assert path is not None, 'Relocatable schemas must be accompanied with path' 66 | try: 67 | _gs=GSettings[schema] 68 | except KeyError as e: 69 | _gs=Gio.Settings(schema,path) 70 | return key in _gs.list_keys() 71 | else: 72 | return True 73 | 74 | # get_ and set_ are available for the following in Gio.Settings 75 | VALID_TYPES=frozenset([ 76 | 'boolean', 77 | 'int', 78 | 'uint', 79 | 'double', 80 | 'string', 81 | 'strv', 82 | 'enum', 83 | 'flags' 84 | ]) 85 | 86 | def get(*,schema,key,type,path=None): 87 | ''' 88 | Getter that calls appropriate function on Gio.Settings depending on type. The schema,path,key,type combination is expected to be valid. Uses cache wherever possible. 89 | ''' 90 | logger.debug('Attempting to get key %s of type %s from schema %s with path %s',key,type,schema,path) 91 | _gskey=schema+(':'+path if path is not None else '') 92 | try: 93 | _gs=GSettings[_gskey] 94 | logger.debug('Using cached Settings object for %s',_gskey) 95 | except KeyError as e: 96 | logger.debug('Cache miss for Settings object %s',_gskey) 97 | _gs=Gio.Settings(schema,path) 98 | GSettings[_gskey]=_gs 99 | return _gs.__getattribute__('get_'+type)(key) 100 | 101 | def set(*,schema,key,type,path=None,value): 102 | ''' 103 | Setter that calls appropriate function on Gio.Settings depending on the type. The schema,path,key,type combination is expected to be valid, and the value must be of the proper type. Uses cache wherever possible. 104 | ''' 105 | logger.debug('Attempting to set key %s of type %s from schema %s with path %s to value %s',key,type,schema,path,value) 106 | _gskey=schema+(':'+path if path is not None else '') 107 | try: 108 | _gs=GSettings[_gskey] 109 | logger.debug('Using cached Settings object for %s',_gskey) 110 | except KeyError as e: 111 | logger.debug('Cache miss for Settings object %s',_gskey) 112 | _gs=Gio.Settings(schema,path) 113 | GSettings[_gskey]=_gs 114 | # TODO : check if value is legal, if possible. 115 | return _gs.__getattribute__('set_'+type)(key,value) 116 | 117 | def reset(*,schema,key,path=None): 118 | ''' Reset the given key. schema,path,key combination is expected to be valid. ''' 119 | logger.debug('Attempting to reset key %s from schema %s with path %s',key,schema,path) 120 | _gskey=schema+(':'+path if path is not None else '') 121 | try: 122 | _gs=GSettings[_gskey] 123 | logger.debug('Using cached Settings object for %s',_gskey) 124 | except KeyError as e: 125 | logger.debug('Cache miss for Settings object %s',_gskey) 126 | _gs=Gio.Settings(schema,path) 127 | GSettings[_gskey]=_gs 128 | _gs.reset(key) 129 | 130 | -------------------------------------------------------------------------------- /UnityTweakTool/section/appearance.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | 33 | from UnityTweakTool.section.skeletonpage import Section,Tab 34 | from UnityTweakTool.elements.fontbutton import FontButton 35 | from UnityTweakTool.elements.cbox import ComboBox 36 | from UnityTweakTool.elements.spin import SpinButton 37 | from UnityTweakTool.elements.radio import Radio 38 | from UnityTweakTool.elements.checkbox import CheckBox 39 | from UnityTweakTool.section.spaghetti.theme import Themesettings as SpaghettiThemeSettings 40 | from UnityTweakTool.elements.option import Option,HandlerObject 41 | 42 | from collections import defaultdict 43 | 44 | Appearance =Section(ui='appearance.ui',id='nb_themesettings') 45 | 46 | #=============== THEME ========================== 47 | 48 | #=============== ICONS ========================== 49 | 50 | #=============== CURSOR ========================= 51 | 52 | #=============== FONTS ========================== 53 | 54 | font_default= FontButton({ 55 | 'id' : 'font_default', 56 | 'builder' : Appearance.builder, 57 | 'schema' : 'org.gnome.desktop.interface', 58 | 'path' : None, 59 | 'key' : 'font-name', 60 | 'type' : 'string' 61 | }) 62 | 63 | font_document= FontButton({ 64 | 'id' : 'font_document', 65 | 'builder' : Appearance.builder, 66 | 'schema' : 'org.gnome.desktop.interface', 67 | 'path' : None, 68 | 'key' : 'document-font-name', 69 | 'type' : 'string' 70 | }) 71 | 72 | font_monospace= FontButton({ 73 | 'id' : 'font_monospace', 74 | 'builder' : Appearance.builder, 75 | 'schema' : 'org.gnome.desktop.interface', 76 | 'path' : None, 77 | 'key' : 'monospace-font-name', 78 | 'type' : 'string' 79 | }) 80 | 81 | font_window_title= FontButton({ 82 | 'id' : 'font_window_title', 83 | 'builder' : Appearance.builder, 84 | 'schema' : 'org.gnome.desktop.wm.preferences', 85 | 'path' : None, 86 | 'key' : 'titlebar-font', 87 | 'type' : 'string' 88 | }) 89 | 90 | cbox_antialiasing=ComboBox({ 91 | 'id' : 'cbox_antialiasing', 92 | 'builder' : Appearance.builder, 93 | 'schema' : 'org.gnome.settings-daemon.plugins.xsettings', 94 | 'path' : None, 95 | 'key' : 'antialiasing', 96 | 'type' : 'string', 97 | 'map' : {'none':0,'grayscale':1,'rgba':2} 98 | }) 99 | 100 | cbox_hinting=ComboBox({ 101 | 'id' : 'cbox_hinting', 102 | 'builder' : Appearance.builder, 103 | 'schema' : 'org.gnome.settings-daemon.plugins.xsettings', 104 | 'path' : None, 105 | 'key' : 'hinting', 106 | 'type' : 'string', 107 | 'map' : {'none':0,'slight':1,'medium':2,'full':3} 108 | }) 109 | 110 | spin_textscaling=SpinButton({ 111 | 'id' : 'spin_textscaling', 112 | 'builder': Appearance.builder, 113 | 'schema' : 'org.gnome.desktop.interface', 114 | 'path' : None, 115 | 'key' : 'text-scaling-factor', 116 | 'type' : 'double', 117 | 'min' : 0.50, 118 | 'max' : 3.00 119 | }) 120 | 121 | Fonts=Tab([font_default, 122 | font_document, 123 | font_monospace, 124 | font_window_title, 125 | cbox_antialiasing, 126 | cbox_hinting, 127 | spin_textscaling]) 128 | 129 | #========== WINDOW CONTROLS ===================== 130 | 131 | radio_left=Radio({ 132 | 'id' : 'radio_left', 133 | 'builder' : Appearance.builder, 134 | 'schema' : 'org.gnome.desktop.wm.preferences', 135 | 'path' : None, 136 | 'key' : 'button-layout', 137 | 'type' : 'string', 138 | 'group' : 'radio_left', 139 | 'value' : 'close,minimize,maximize:', 140 | 'dependants': [] 141 | }) 142 | 143 | radio_right=Radio({ 144 | 'id' : 'radio_right', 145 | 'builder' : Appearance.builder, 146 | 'schema' : 'org.gnome.desktop.wm.preferences', 147 | 'path' : None, 148 | 'key' : 'button-layout', 149 | 'type' : 'string', 150 | 'group' : 'radio_right', 151 | 'value' : ':minimize,maximize,close', 152 | 'dependants': [] 153 | }) 154 | 155 | 156 | WindowControls=Tab([radio_left, 157 | radio_right]) 158 | 159 | # Pass in the id of restore defaults button to enable it. 160 | Fonts.enable_restore('b_theme_font_reset') 161 | WindowControls.enable_restore('b_window_control_reset') 162 | 163 | # Each page must be added using add_page 164 | Appearance.add_page(Fonts) 165 | # XXX : Disabled since the implementation is inadequate 166 | # Appearance.add_page(WindowControls) 167 | 168 | themesettings=HandlerObject(SpaghettiThemeSettings(Appearance.builder)) 169 | Appearance.add_page(themesettings) 170 | 171 | # After all pages are added, the section needs to be registered to start listening for events 172 | Appearance.register() 173 | -------------------------------------------------------------------------------- /UnityTweakTool/utils/unityreset.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Authors: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # 9 | # Description: 10 | # Python wrapper to reset unity. 11 | # Born at http://chat.stackexchange.com/rooms/6118/unity-reconfiguration 12 | # 13 | # Legal Stuff: 14 | # 15 | # This program is free software; you can redistribute it and/or modify it under 16 | # the terms of the GNU General Public License as published by the Free Software 17 | # Foundation; version 3. 18 | # 19 | # This program is distributed in the hope that it will be useful, but WITHOUTa 20 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 21 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 22 | # details. 23 | # 24 | # You should have received a copy of the GNU General Public License along with 25 | # this program; if not, write to the Free Software Foundation, Inc., 26 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 27 | 28 | import subprocess 29 | from gi.repository import Gio 30 | import re 31 | 32 | import gettext 33 | gettext.bindtextdomain('unity-tweak-tool') 34 | _=gettext.gettext 35 | 36 | class UnityReset(): 37 | allSchemas=Gio.Settings.list_schemas() 38 | allRelocatableSchemas=Gio.Settings.list_relocatable_schemas() 39 | 40 | def __init__(self,refresh=True): 41 | print(_("Initialising Unity reset")) 42 | print(_("Killing Unity and Compiz")) 43 | subprocess.call(["killall","unity-panel-service"]) 44 | subprocess.call(["pkill","-9","compiz"]) 45 | print(_("Resetting compiz plugins")) 46 | self.resetPlugins() 47 | print(_("Resetting more compiz plugins")) 48 | self.resetCompizChildren() 49 | print(_("Resetting Unity settings")) 50 | self.resetUnityChildren() 51 | print(_("Reset complete. Reloading unity")) 52 | if refresh: 53 | subprocess.call("unity") 54 | 55 | def resetAllKeys(self,schema,path=None,check=False): 56 | """Reset all keys in given Schema.""" 57 | if check and (schema not in self.allSchemas) and (schema not in self.allRelocatableSchemas): 58 | print("Ignoring missing Schema %s"%schema) 59 | return 60 | gsettings=Gio.Settings(schema=schema,path=path) 61 | for key in gsettings.list_keys(): 62 | gsettings.reset(key) 63 | if gsettings.get_has_unapplied(): 64 | gsettings.apply() 65 | #gsettings.sync() 66 | print("Schema %s successfully reset"%schema) 67 | 68 | def resetPlugins(self): 69 | """Reset Compiz Plugins""" 70 | compizPluginRe=re.compile(r'(?Porg.compiz.)') 71 | for schema in self.allRelocatableSchemas: 72 | if compizPluginRe.match(schema): 73 | plugin=compizPluginRe.sub('',schema) 74 | path="/org/compiz/profiles/unity/plugins/"+plugin+"/" 75 | self.resetAllKeys(schema=schema,path=path) 76 | 77 | def resetCompizChildren(self): 78 | """Reset keys in non-relocatable schemas of Compiz""" 79 | compizSchema='org.compiz' 80 | compizChildRe=re.compile(compizSchema) 81 | for schema in self.allSchemas: 82 | if compizChildRe.match(schema): 83 | self.resetAllKeys(schema) 84 | 85 | def resetUnityChildren(self): 86 | """Reset keys in child schemas of Unity""" 87 | unitySchema='com.canonical.Unity' 88 | blacklists=['com.canonical.Unity.Launcher','com.canonical.Unity.webapps','com.canonical.Unity.Lenses'] 89 | unityChildRe=re.compile(unitySchema) 90 | for schema in self.allSchemas: 91 | if (schema not in blacklists) and (unityChildRe.match(schema)): 92 | self.resetAllKeys(schema) 93 | 94 | @staticmethod 95 | def getAllKeys(schema,path=None,check=False): 96 | """Snapshot current settings in a given schema""" 97 | if check and (schema not in UnityReset.allSchemas) and (schema not in UnityReset.allRelocatableSchemas): 98 | print("Ignoring missing Schema %s"%schema) 99 | return 100 | snapshot=dict() 101 | gsettings=Gio.Settings(schema=schema,path=path) 102 | for key in gsettings.list_keys(): 103 | snapshot[key]=gsettings.get_value(key) 104 | return snapshot 105 | 106 | @staticmethod 107 | def snapshotCompizPlugins(): 108 | """Snapshot compiz plugins""" 109 | snapshot=dict() 110 | compizPluginRe=re.compile(r'(?Porg.compiz.)') 111 | for schema in UnityReset.allRelocatableSchemas: 112 | if compizPluginRe.match(schema): 113 | plugin=compizPluginRe.sub('',schema) 114 | schema='org.compiz.'+plugin 115 | path="/org/compiz/profiles/unity/plugins/"+plugin+"/" 116 | snapshot[schema]=UnityReset.getAllKeys(schema=schema,path=path) 117 | return snapshot 118 | 119 | @staticmethod 120 | def snapshotCompizChildren(): 121 | """Snapshot keys in child schemas of Compiz""" 122 | snapshot=dict() 123 | compizSchema='org.compiz' 124 | compizChildRe=re.compile(compizSchema) 125 | for schema in UnityReset.allSchemas: 126 | if compizChildRe.match(schema): 127 | snapshot[schema]=UnityReset.getAllKeys(schema) 128 | return snapshot 129 | 130 | 131 | @staticmethod 132 | def snapshotUnityChildren(): 133 | """Snapshot keys in child schemas of Unity""" 134 | snapshot=dict() 135 | unitySchema='com.canonical.Unity' 136 | blacklists=['com.canonical.Unity.Launcher','com.canonical.Unity.webapps','com.canonical.Unity.Lenses'] 137 | unityChildRe=re.compile(unitySchema) 138 | for schema in UnityReset.allSchemas: 139 | if (schema not in blacklists) and (unityChildRe.match(schema)): 140 | snapshot[schema]=UnityReset.getAllKeys(schema) 141 | return snapshot 142 | 143 | 144 | if __name__=='__main__': 145 | UnityReset() 146 | 147 | -------------------------------------------------------------------------------- /data/media/scalable/unity-tweak-tool-overview-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 20 | 41 | 48 | 49 | 51 | 52 | 54 | image/svg+xml 55 | 57 | 58 | 59 | 60 | 61 | 66 | 72 | 78 | 84 | 90 | 96 | 102 | 108 | 114 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | unity-tweak-tool (0.0.7ubuntu4) artful; urgency=medium 2 | 3 | * Actually remove unity-webapps-common from the deps. 4 | 5 | -- Steve Langasek Thu, 24 Aug 2017 14:15:21 -0700 6 | 7 | unity-tweak-tool (0.0.7ubuntu3) artful; urgency=medium 8 | 9 | * Drop unity-webapps-common, which is being removed from artful. 10 | LP: #1712874. 11 | 12 | -- Steve Langasek Thu, 24 Aug 2017 11:29:43 -0700 13 | 14 | unity-tweak-tool (0.0.7ubuntu2) xenial; urgency=medium 15 | 16 | * po/fi.po: Update to latest from Launchpad as requested by 17 | Jiri Grönroos. 18 | 19 | -- Timo Jyrinki Tue, 12 Apr 2016 15:52:54 +0300 20 | 21 | unity-tweak-tool (0.0.7ubuntu1) xenial; urgency=low 22 | 23 | * Release 0.0.7 to Ubuntu. (LP: #1562049) 24 | 25 | -- Freyja Development Mon, 28 Mar 2016 04:36:38 +0000 26 | 27 | unity-tweak-tool (0.0.7) xenial; urgency=medium 28 | 29 | [ Andrew Starr-Bochicchio ] 30 | * debian/rules: Some minor style tweaks. 31 | * debian/control: 32 | - Bump Standards-Version to 3.9.5 33 | - Build depend on python3-all to fix FTBFS (LP: #1282274). 34 | [ J Phani Mahesh] 35 | * New upstream release 36 | - Update Translations from Launchpad 37 | * UnityTweakTool/section/spaghetti/compiz.py: 38 | - Fix crash on start (LP: #1281132). 39 | 40 | [ Barneedhar Vigneshwar] 41 | * UnityTweakTool/section/system.py 42 | - Fixed missing schema- org.gnome.settings-daemon.peripherals (LP: #1490154) 43 | 44 | [ Seth Johnson ] 45 | * UnityTweakTool/section/unity.py 46 | - Added support for moving the launcher to the bottom of the screen 47 | * UnityTweakTool/section/windowmanager.py 48 | - Add raise on click feature 49 | * Rebuilt pot files 50 | * setup.py 51 | - Fix missing header icons (LP: 1467211) 52 | * New upstream release (closes LP: #1562049) 53 | 54 | -- Seth Johnson Sun, 27 Mar 2016 21:22:06 -0700 55 | 56 | unity-tweak-tool (0.0.6ubuntu3) wily; urgency=medium 57 | 58 | * Fix the schema used for touchpad settings to match the current GNOME 59 | as present in Ubuntu 15.10. LP: #1490154. 60 | 61 | -- Steve Langasek Thu, 17 Sep 2015 14:55:21 -0700 62 | 63 | unity-tweak-tool (0.0.6ubuntu2) utopic; urgency=medium 64 | 65 | * Backport upstream commit adding support for minimizing 66 | single window applications when clicking their icon on 67 | the launcher (LP: #1298487). 68 | 69 | -- Andrew Starr-Bochicchio Thu, 27 Mar 2014 12:39:22 -0400 70 | 71 | unity-tweak-tool (0.0.6ubuntu1) trusty; urgency=medium 72 | 73 | * debian/patches/lp1281132.patch: Backport upstream commit 74 | that fixes crash (LP: #1281132). This patch is applied 75 | directly since this is a native package, but a copy was 76 | kept in debian/ to be clear about what has been applied. 77 | * debian/rules: Some minor style tweaks. 78 | * debian/control: 79 | - Bump Standards-Version to 3.9.5 80 | - Build depend on python3-all to fix FTBFS (LP: #1282274). 81 | 82 | -- Andrew Starr-Bochicchio Thu, 20 Feb 2014 23:41:09 -0500 83 | 84 | unity-tweak-tool (0.0.6) saucy; urgency=high 85 | 86 | [ Barneedhar Vigneshwar] 87 | * New upstream bug-fix only release (LP: #1235752) 88 | - Trigger new build of pot files 89 | * UnityTweakTool/section/spaghetti/unity.py 90 | - unity-tweak-tool crashed with signal 5 in g_settings_get_value() (LP: #1235432) 91 | 92 | [ J Phani Mahesh] 93 | * UnityTweakTool/__init__.py 94 | - Fix NameError: name '_formatter' is not defined (LP: #1232515) 95 | 96 | -- Barneedhar Vigneshwar Sat, 05 Oct 2013 22:45:24 +0530 97 | 98 | unity-tweak-tool (0.0.5) saucy; urgency=low 99 | 100 | [ J Phani Mahesh ] 101 | * New upstream release (LP: #1226059) 102 | - New application icon 103 | - Show error dialog when schemas are missing instead of crashing 104 | - Trigger new build of pot files 105 | * UnityTweakTool/section/unity.py 106 | - Fix Show recently used and more suggestions in dash search (LP: #1166294) 107 | - Fix Launcher reveal sensitivity scale update issues (LP: #1168863) 108 | * UnityTweakTool/elements/colorchooser.py 109 | - Fix TypeError in get_rgba() (LP: #1165627) 110 | - Fix segmentation fault on selecting custom launcher (LP: #1190398) 111 | * UnityTweakTool/elements/option.py 112 | - Fix "Restore defaults" button (LP: #1186634) 113 | * UnityTweakTool/__init__.py 114 | - Fix unity-tweak-tool crashed with dbus.exceptions.DBusException in 115 | call_blocking() (LP: #1168738) 116 | - Fix FileNotFoundError (LP: #1225463) 117 | - Fix dbus.exceptions.DBusException (LP: #1170571) 118 | * data/unity.ui 119 | - Remove Panel transparency switch (LP: #1168836) 120 | - Remove Launcher transparency switch (LP: #1168834) 121 | 122 | [ Barneedhar Vigneshwar ] 123 | * UnityTweakTool/section/unity.py 124 | - Fix 'Can't set background blur to static' (LP: #1167343) 125 | - Fix non-working Launcher only on primary desktop (LP: #1173977) 126 | * UnityTweakTool/section/sphagetti/compiz.py 127 | - Fix TypeError in color_to_hash() (LP: #1166884) 128 | 129 | -- Barneedhar Vigneshwar Mon, 16 Sep 2013 19:34:38 +0530 130 | 131 | unity-tweak-tool (0.0.4) raring; urgency=medium 132 | 133 | [ Barneedhar Vigneshwar ] 134 | * New upstream release (LP: #1165141) 135 | * data/windowmanager.ui 136 | - Fix missing signal in the auto-raise switch (LP: #1160782) 137 | * UnityTweakTool/section/sphagetti/theme.py 138 | - Fix KeyError when fetching window themes (LP: #1146122) 139 | * UnityTweakTool/section/unity.py 140 | - Fix show-desktop switch (LP: #1156266) 141 | - Fix 'switch between workspace' switch (LP: #1156236) 142 | 143 | [ J Phani Mahesh ] 144 | * debian/source_unity-tweak-tool.py 145 | - Update Apport hook to file crash bugs against the package by default 146 | * setup.py 147 | - Install translated pot files 148 | * unity-tweak-tool 149 | - Fixed and renamed -r parameter to --reset-unity in the wrapper 150 | * UnityTweakTool/__init__.py 151 | - Prevent multiple instances using dbus 152 | * UnityTweakTool/elements/radio.py 153 | - Fix AssertionError in __init__() (LP: #1156201) 154 | - Fix AssertionError due to missing overlay-scrollbar package (LP: #1156337) 155 | * UnityTweakTool/section/sphagetti/compiz.py 156 | - Fix resetting transparency values (LP: #1099067) 157 | * UnityTweakTool/section/sphagetti/unity.py 158 | - Fix AttributeError in refresh(): 'NoneType' object has no attribute 'get_boolean' (LP: #1155331) 159 | 160 | [Sam Hewitt] 161 | * debian/control 162 | - Added dependency on python3-cairo (LP: #1156789) 163 | * UnityTweakTool/section/sphagetti/unity.py 164 | - Fixed unresponsive 'battery-life' switch (LP: #1129262) 165 | 166 | -- Barneedhar Vigneshwar Fri, 05 Apr 2013 23:05:49 +0530 167 | 168 | unity-tweak-tool (0.0.3) raring; urgency=low 169 | 170 | * New upstream release 171 | * Closes needs-packaging bug (LP: #1126433) 172 | 173 | -- Barneedhar Vigneshwar Fri, 15 Feb 2013 20:33:41 +0530 174 | 175 | unity-tweak-tool (0.0.2) raring; urgency=low 176 | 177 | * New upstream release 178 | 179 | -- Barneedhar Vigneshwar Fri, 11 Jan 2013 14:30:53 +0530 180 | 181 | unity-tweak-tool (0.0.1) raring; urgency=low 182 | 183 | * Initial release. 184 | 185 | -- Barneedhar Vigneshwar Sun, 24 Dec 2012 16:48:06 +0530 186 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | import os 33 | import sys 34 | import glob 35 | from subprocess import call 36 | 37 | try: 38 | import DistUtilsExtra.auto 39 | except ImportError: 40 | print('To build unity-tweak-tool you need python3-distutils-extra (https://launchpad.net/python-distutils-extra)',file=sys.stderr) 41 | sys.exit(1) 42 | assert DistUtilsExtra.auto.__version__ >= '2.18', 'needs DistUtilsExtra.auto >= 2.18' 43 | 44 | def update_config_old(libdir, values = {}): 45 | 46 | filename = os.path.join(libdir, 'UnityTweakTool/section/spaghetti/unitytweakconfig.py') 47 | oldvalues = {} 48 | try: 49 | fin = open(filename, 'r') 50 | fout = open(filename + '.new', 'w') 51 | 52 | for line in fin: 53 | fields = line.split(' = ') # Separate variable from value 54 | if fields[0] in values: 55 | oldvalues[fields[0]] = fields[1].strip() 56 | line = "%s = %s\n" % (fields[0], values[fields[0]]) 57 | fout.write(line) 58 | 59 | fout.flush() 60 | fout.close() 61 | fin.close() 62 | os.rename(fout.name, fin.name) 63 | except IOError as e: 64 | print ("ERROR: Can't find %s" % filename) 65 | sys.exit(1) 66 | return oldvalues 67 | 68 | def update_config_new(libdir, values = {}): 69 | 70 | filename = os.path.join(libdir, 'UnityTweakTool/config/data.py') 71 | oldvalues = {} 72 | try: 73 | fin = open(filename, 'r') 74 | fout = open(filename + '.new', 'w') 75 | 76 | for line in fin: 77 | fields = line.split(' = ') # Separate variable from value 78 | if fields[0] in values: 79 | oldvalues[fields[0]] = fields[1].strip() 80 | line = "%s = %s\n" % (fields[0], values[fields[0]]) 81 | fout.write(line) 82 | 83 | fout.flush() 84 | fout.close() 85 | fin.close() 86 | os.rename(fout.name, fin.name) 87 | except IOError as e: 88 | print ("ERROR: Can't find %s" % filename) 89 | sys.exit(1) 90 | return oldvalues 91 | 92 | def update_config(libdir,values={}): 93 | update_config_new(libdir,values) 94 | update_config_old(libdir,values) 95 | 96 | def move_desktop_open(root, target_data, prefix): 97 | 98 | old_desktop_path = os.path.normpath(root + target_data + 99 | '/share/applications') 100 | old_desktop_file = old_desktop_path + '/unity-tweak-tool.desktop' 101 | desktop_path = os.path.normpath(root + prefix + '/share/applications') 102 | desktop_file = desktop_path + '/unity-tweak-tool.desktop' 103 | 104 | if not os.path.exists(old_desktop_file): 105 | print ("ERROR: Can't find", old_desktop_file) 106 | sys.exit(1) 107 | elif target_data != prefix + '/': 108 | # This is an /opt install, so rename desktop file to use extras- 109 | desktop_file = desktop_path + '/extras-unity-tweak-tool.desktop' 110 | try: 111 | os.makedirs(desktop_path) 112 | os.rename(old_desktop_file, desktop_file) 113 | os.rmdir(old_desktop_path) 114 | except OSError as e: 115 | print ("ERROR: Can't rename", old_desktop_file, ":", e) 116 | sys.exit(1) 117 | 118 | return desktop_file 119 | 120 | def compile_schemas(root, target_data): 121 | if target_data == '/usr/': 122 | return # /usr paths dirgon't need this, they will be handled by dpkg 123 | schemadir = os.path.normpath(root + target_data + 'share/glib-2.0/schemas') 124 | if (os.path.isdir(schemadir) and 125 | os.path.isopen('/usr/bin/glib-compile-schemas')): 126 | os.system('/usr/bin/glib-compile-schemas "%s"' % schemadir) 127 | 128 | ## Translations. Adapted from pyroom setup.py ## 129 | 130 | PO_DIR = 'po' 131 | MO_DIR = os.path.join('build', 'po') 132 | 133 | for po in glob.glob(os.path.join(PO_DIR, '*.po')): 134 | lang = os.path.basename(po[:-3]) 135 | mo = os.path.join(MO_DIR, lang, 'unity-tweak-tool.mo') 136 | target_dir = os.path.dirname(mo) 137 | if not os.path.isdir(target_dir): 138 | os.makedirs(target_dir) 139 | try: 140 | return_code = call(['msgfmt', '-o', mo, po]) 141 | except OSError: 142 | print('Translation not available, please install gettext') 143 | break 144 | if return_code: 145 | raise Warning('Error when building locales') 146 | 147 | 148 | class InstallAndUpdateDataDirectory(DistUtilsExtra.auto.install_auto): 149 | def run(self): 150 | DistUtilsExtra.auto.install_auto.run(self) 151 | 152 | target_data = '/' + os.path.relpath(self.install_data, self.root) + '/' 153 | target_pkgdata = target_data + 'share/unity-tweak-tool/' 154 | target_scripts = '/' + os.path.relpath(self.install_scripts, self.root) + '/' 155 | 156 | values = {'__unity_tweak_tool_data_directory__': "'%s'" % (target_pkgdata), 157 | '__version__': "'%s'" % self.distribution.get_version()} 158 | update_config(self.install_lib, values) 159 | 160 | desktop_file = move_desktop_open(self.root, target_data, self.prefix) 161 | compile_schemas(self.root, target_data) 162 | 163 | 164 | ################################################################################## 165 | data_files=[ 166 | ('share/dbus-1/services', ['unity-tweak-tool.service']), 167 | ('share/icons/gnome/scalable/apps/', glob.glob("data/media/scalable/*svg")), 168 | ('share/pixmaps/', glob.glob("data/media/scalable/*svg")), 169 | ('share/icons/hicolor/16x16/apps/', glob.glob("data/media/hicolor/16x16/apps/*.png")), 170 | ('share/icons/hicolor/24x24/apps/', glob.glob("data/media/hicolor/24x24/apps/*.png")), 171 | ('share/icons/hicolor/32x32/apps/', glob.glob("data/media/hicolor/32x32/apps/*.png")), 172 | ('share/icons/hicolor/48x48/apps/', glob.glob("data/media/hicolor/48x48/apps/*.png")), 173 | ('share/icons/hicolor/64x64/apps/', glob.glob("data/media/hicolor/64x64/apps/*.png")), 174 | ('share/icons/hicolor/256x256/apps/', glob.glob("data/media/hicolor/256x256/apps/*.png")), 175 | ] 176 | 177 | def find_mo_files(): 178 | data_files = [] 179 | for mo in glob.glob(os.path.join(MO_DIR, '*', 'unity-tweak-tool.mo')): 180 | lang = os.path.basename(os.path.dirname(mo)) 181 | dest = os.path.join('share', 'locale', lang, 'LC_MESSAGES') 182 | data_files.append((dest, [mo])) 183 | return data_files 184 | 185 | data_files.extend(find_mo_files()) 186 | 187 | DistUtilsExtra.auto.setup( 188 | name='unity-tweak-tool', 189 | version='0.0.7', 190 | license='GPL-3', 191 | author='Freyja Development Team', 192 | #author_email='email@ubuntu.com', 193 | description='A One-stop configuration tool for Unity', 194 | url='https://launchpad.net/unity-tweak-tool', 195 | data_files=data_files, 196 | cmdclass={'install': InstallAndUpdateDataDirectory} 197 | ) 198 | -------------------------------------------------------------------------------- /UnityTweakTool/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | # List of all subpackages that can be imported using 33 | # from UnityTweakTool import * 34 | __all__=['backends','config','elements'] 35 | 36 | import os 37 | import sys 38 | import logging 39 | import dbus, dbus.service 40 | 41 | import gi 42 | gi.require_version('Gtk', '3.0') 43 | from gi.repository import Gtk 44 | 45 | from dbus.mainloop.glib import DBusGMainLoop 46 | from UnityTweakTool.config.logging import LOGFILE,LOGFMT,LOGLVL,CACHEDIR 47 | 48 | DBusGMainLoop(set_as_default=True) 49 | 50 | logger=logging.getLogger('UnityTweakTool') 51 | logger.setLevel(LOGLVL) 52 | 53 | try: 54 | _fh=logging.FileHandler(LOGFILE) 55 | _fh.setLevel(LOGLVL) 56 | 57 | _formatter=logging.Formatter(LOGFMT) 58 | 59 | _fh.setFormatter(_formatter) 60 | logger.addHandler(_fh) 61 | del _fh 62 | del _formatter 63 | except Exception: 64 | print('Unable to open {LOGFILE} for writing.'.format(LOGFILE=LOGFILE),file=sys.stderr) 65 | 66 | 67 | ########################################################################## 68 | LOCKFILE=os.path.join(CACHEDIR,"pid.lockfile") 69 | 70 | class Application(dbus.service.Object): 71 | def __init__(self,pageid=-1): 72 | if not os.path.exists(CACHEDIR): 73 | os.makedirs(CACHEDIR) 74 | try: 75 | if os.access(LOCKFILE,os.R_OK): 76 | with open(LOCKFILE) as pidfile: 77 | old_pid = pidfile.read() 78 | OLD_CMDLINE="/proc/%s/cmdline" % old_pid 79 | if os.access(OLD_CMDLINE,os.R_OK): 80 | with open(OLD_CMDLINE) as cmd_old_file: 81 | cmd_old=cmd_old_file.read() 82 | executable_name=cmd_old.split('\x00')[1] 83 | if os.path.basename(executable_name) == 'unity-tweak-tool': 84 | print("""\033[01;32m 85 | Another instance of Unity Tweak Tool seems to be running with 86 | process id {pid}. Switching to the already existing window. 87 | 88 | If you believe there is no other instance running, remove the 89 | file {LOCKFILE} and try again. 90 | \033[00m""".format(pid=old_pid,LOCKFILE=LOCKFILE)) 91 | self.call_running_instance(pageid) 92 | sys.exit(1) 93 | except: 94 | # Most probably the process doesn't exist. remove and proceed 95 | pass 96 | 97 | try: 98 | with open(LOCKFILE, "w") as pidfile: 99 | pidfile.write("%s" % os.getpid()) 100 | except: 101 | # Not a fatal error to not write the pid. 102 | # XXX: Should an error be logged? Dialog shown? 103 | pass 104 | 105 | 106 | self.register_dbus_session() 107 | self.run(pageid) 108 | 109 | def run(self,pageid): 110 | from UnityTweakTool.config.data import get_data_path 111 | self.builder=Gtk.Builder() 112 | self.builder.set_translation_domain('unity-tweak-tool') 113 | self.ui=os.path.join(get_data_path(),'unitytweak.ui') 114 | self.builder.add_from_file(self.ui) 115 | self.notebook=self.builder.get_object('nb_unitytweak') 116 | self.connectpages() 117 | self.connecthandlers() 118 | # from gi.repository import Unity 119 | # self.launcher = Unity.LauncherEntry.get_for_desktop_id("unity-tweak-tool.desktop") 120 | self.window=self.builder.get_object('unitytweak_main') 121 | self.window.show_all() 122 | self.window.connect('delete-event',self.quit) 123 | if pageid is not None: 124 | self.switch_to_page(pageid) 125 | Gtk.main() 126 | 127 | def connectpages(self): 128 | from UnityTweakTool.section.overview import Overview 129 | from UnityTweakTool.section.unity import Unity 130 | from UnityTweakTool.section.windowmanager import WindowManager 131 | from UnityTweakTool.section.system import System 132 | from UnityTweakTool.section.appearance import Appearance 133 | sections=[Overview(self.notebook),Unity,WindowManager,Appearance,System] 134 | for section in sections: 135 | id=self.notebook.append_page(section.page,None) 136 | assert id is not -1 137 | 138 | def connecthandlers(self): 139 | handler={} 140 | def show_overview(*args,**kwargs): 141 | self.notebook.set_current_page(0) 142 | handler['on_b_overview_clicked']=show_overview 143 | 144 | appmenu={ 145 | 'unity_launcher' :(1,0), 146 | 'unity_dash' :(1,1), 147 | 'unity_panel' :(1,2), 148 | 'unity_switcher' :(1,3), 149 | 'unity_additional' :(1,4), 150 | 151 | 'compiz_general' :(2,0), 152 | 'compiz_workspace' :(2,1), 153 | 'compiz_windows_spread' :(2,2), 154 | 'compiz_windows_snapping':(2,3), 155 | 'compiz_hotcorners' :(2,4), 156 | 'compiz_additional' :(2,5), 157 | 158 | 'theme_system' :(3,0), 159 | 'theme_icon' :(3,1), 160 | 'theme_cursor' :(3,2), 161 | 'theme_fonts' :(3,3), 162 | 163 | 'desktop_icons' :(4,0), 164 | 'system_security' :(4,1), 165 | 'scrolling' :(4,2) 166 | } 167 | 168 | def gen_appmenu_handler(loc): 169 | def appmenu_handler(*args): 170 | self.notebook.set_current_page(loc[0]) 171 | self.notebook.get_nth_page(loc[0]).set_current_page(loc[1]) 172 | return appmenu_handler 173 | 174 | for item,location in appmenu.items(): 175 | handler['on_menuitem_%s_activate'%item]=gen_appmenu_handler(location) 176 | 177 | handler['on_menuimage_quit_activate']=self.quit 178 | 179 | from UnityTweakTool.about import About 180 | handler['on_menuimage_about_activate']=lambda *args: About() 181 | self.builder.connect_signals(handler) 182 | 183 | 184 | 185 | def register_dbus_session(self): 186 | bus_name = dbus.service.BusName('org.freyja.utt', bus=dbus.SessionBus()) 187 | dbus.service.Object.__init__(self, bus_name, '/org/freyja/utt') 188 | 189 | def call_running_instance(self, pageid): 190 | bus = dbus.SessionBus() 191 | service = bus.get_object('org.freyja.utt', '/org/freyja/utt') 192 | service.get_dbus_method('switch_to_page', 'org.freyja.utt')(pageid) 193 | 194 | @dbus.service.method('org.freyja.utt', in_signature='i') 195 | def switch_to_page(self, pageid): 196 | if not pageid == -1: 197 | self.notebook.set_current_page(pageid) 198 | self.window.present() 199 | 200 | def quit(self,*args): 201 | try: 202 | os.remove(LOCKFILE) 203 | except: 204 | pass 205 | Gtk.main_quit() 206 | 207 | def reset_all(): 208 | import UnityTweakTool.utils.unityreset as unityreset 209 | unityreset.UnityReset() 210 | -------------------------------------------------------------------------------- /UnityTweakTool/section/system.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | 33 | from UnityTweakTool.section.skeletonpage import Section,Tab 34 | from UnityTweakTool.elements.switch import Switch 35 | from UnityTweakTool.elements.checkbox import CheckBox 36 | from UnityTweakTool.elements.cbox import ComboBox 37 | from UnityTweakTool.elements.radio import Radio 38 | from UnityTweakTool.elements.togglebutton import ToggleButton 39 | import UnityTweakTool.section.dynamic as dynamic 40 | 41 | 42 | System=Section(ui='system.ui',id='nb_desktop_settings') 43 | 44 | tb_home_folder= ToggleButton({ 45 | 'id' : 'tb_home_folder', 46 | 'builder' : System.builder, 47 | 'schema' : dynamic.desktop_schema, 48 | 'path' : None, 49 | 'key' : 'home-icon-visible', 50 | 'type' : 'boolean', 51 | 'map' : {True:True,False:False}, 52 | 'dependants': [] 53 | }) 54 | 55 | tb_network= ToggleButton({ 56 | 'id' : 'tb_network', 57 | 'builder' : System.builder, 58 | 'schema' : dynamic.desktop_schema, 59 | 'path' : None, 60 | 'key' : 'network-icon-visible', 61 | 'type' : 'boolean', 62 | 'map' : {True:True,False:False}, 63 | 'dependants': [] 64 | }) 65 | 66 | tb_trash= ToggleButton({ 67 | 'id' : 'tb_trash', 68 | 'builder' : System.builder, 69 | 'schema' : dynamic.desktop_schema, 70 | 'path' : None, 71 | 'key' : 'trash-icon-visible', 72 | 'type' : 'boolean', 73 | 'map' : {True:True,False:False}, 74 | 'dependants': [] 75 | }) 76 | 77 | tb_devices= ToggleButton({ 78 | 'id' : 'tb_devices', 79 | 'builder' : System.builder, 80 | 'schema' : dynamic.desktop_schema, 81 | 'path' : None, 82 | 'key' : 'volumes-visible', 83 | 'type' : 'boolean', 84 | 'map' : {True:True,False:False}, 85 | 'dependants': [] 86 | }) 87 | 88 | DesktopIcons=Tab([ tb_home_folder, 89 | tb_network, 90 | tb_trash, 91 | tb_devices]) 92 | 93 | check_security_lock_screen= CheckBox({ 94 | 'id' : 'check_security_lock_screen', 95 | 'builder' : System.builder, 96 | 'schema' : 'org.gnome.desktop.lockdown', 97 | 'path' : None, 98 | 'key' : 'disable-lock-screen', 99 | 'type' : 'boolean', 100 | 'map' : {True:True,False:False}, 101 | 'dependants': [] 102 | }) 103 | 104 | check_security_logout= CheckBox({ 105 | 'id' : 'check_security_logout', 106 | 'builder' : System.builder, 107 | 'schema' : 'org.gnome.desktop.lockdown', 108 | 'path' : None, 109 | 'key' : 'disable-log-out', 110 | 'type' : 'boolean', 111 | 'map' : {True:True,False:False}, 112 | 'dependants': [] 113 | }) 114 | 115 | check_security_user_switching= CheckBox({ 116 | 'id' : 'check_security_user_switching', 117 | 'builder' : System.builder, 118 | 'schema' : 'org.gnome.desktop.lockdown', 119 | 'path' : None, 120 | 'key' : 'disable-user-switching', 121 | 'type' : 'boolean', 122 | 'map' : {True:True,False:False}, 123 | 'dependants': [] 124 | }) 125 | 126 | # TODO: This check should tweak 'disable-print-setup' key too. 127 | 128 | check_security_printing= CheckBox({ 129 | 'id' : 'check_security_printing', 130 | 'builder' : System.builder, 131 | 'schema' : 'org.gnome.desktop.lockdown', 132 | 'path' : None, 133 | 'key' : 'disable-printing', 134 | 'type' : 'boolean', 135 | 'map' : {True:True,False:False}, 136 | 'dependants': [] 137 | }) 138 | 139 | SecurityIcons=Tab([check_security_lock_screen, 140 | check_security_logout, 141 | check_security_user_switching, 142 | check_security_printing]) 143 | 144 | radio_overlay_scrollbars=Radio({ 145 | 'id' : 'radio_overlay_scrollbars', 146 | 'builder' : System.builder, 147 | 'schema' : 'com.canonical.desktop.interface', 148 | 'path' : None, 149 | 'key' : 'scrollbar-mode', 150 | 'type' : 'string', 151 | 'group' : 'radio_legacy_scrollbars', 152 | 'value' : 'overlay-auto', 153 | 'dependants': ['l_overlay_scrollbar_mode', 154 | 'cbox_overlay_scrollbar_mode'] 155 | }) 156 | 157 | # TODO: Look at overlay-auto 158 | 159 | cbox_overlay_scrollbar_mode=ComboBox({ 160 | 'id' : 'cbox_overlay_scrollbar_mode', 161 | 'builder' : System.builder, 162 | 'schema' : 'com.canonical.desktop.interface', 163 | 'path' : None, 164 | 'key' : 'scrollbar-mode', 165 | 'type' : 'string', 166 | 'map' : {'overlay-auto':0,'overlay-pointer':1,'overlay-touch':2,'normal':0} 167 | }) 168 | 169 | radio_legacy_scrollbars=Radio({ 170 | 'id' : 'radio_legacy_scrollbars', 171 | 'builder' : System.builder, 172 | 'schema' : 'com.canonical.desktop.interface', 173 | 'path' : None, 174 | 'key' : 'scrollbar-mode', 175 | 'type' : 'string', 176 | 'group' : 'radio_legacy_scrollbars', 177 | 'value' : 'normal', 178 | 'dependants': [] 179 | }) 180 | 181 | check_horizontal_scrolling= CheckBox({ 182 | 'id' : 'check_horizontal_scrolling', 183 | 'builder' : System.builder, 184 | 'schema' : 'org.gnome.' + dynamic.touchpad_schema + '.peripherals.touchpad', 185 | 'path' : None, 186 | 'key' : 'horiz-scroll-enabled', 187 | 'type' : 'boolean', 188 | 'map' : {True:True,False:False}, 189 | 'dependants': [] 190 | }) 191 | 192 | radio_edge=Radio({ 193 | 'id' : 'radio_edge', 194 | 'builder' : System.builder, 195 | 'schema' : 'org.gnome.' + dynamic.touchpad_schema + '.peripherals.touchpad', 196 | 'path' : None, 197 | 'key' : 'scroll-method', 198 | 'type' : 'string', 199 | 'group' : 'radio_two_finger', 200 | 'value' : 'edge-scrolling', 201 | 'dependants': [] 202 | }) 203 | 204 | radio_two_finger=Radio({ 205 | 'id' : 'radio_two_finger', 206 | 'builder' : System.builder, 207 | 'schema' : 'org.gnome.' + dynamic.touchpad_schema + '.peripherals.touchpad', 208 | 'path' : None, 209 | 'key' : 'scroll-method', 210 | 'type' : 'string', 211 | 'group' : 'radio_two_finger', 212 | 'value' : 'two-finger-scrolling', 213 | 'dependants': [] 214 | }) 215 | 216 | ScrollingIcons=Tab([radio_overlay_scrollbars, 217 | cbox_overlay_scrollbar_mode, 218 | radio_legacy_scrollbars, 219 | radio_edge, 220 | radio_two_finger, 221 | check_horizontal_scrolling]) 222 | 223 | # Pass in the id of restore defaults button to enable it. 224 | DesktopIcons.enable_restore('b_desktop_settings_icons_reset') 225 | SecurityIcons.enable_restore('b_desktop_settings_security_reset') 226 | ScrollingIcons.enable_restore('b_settings_scrolling_reset') 227 | 228 | # Each page must be added using add_page 229 | System.add_page(DesktopIcons) 230 | System.add_page(SecurityIcons) 231 | System.add_page(ScrollingIcons) 232 | 233 | # After all pages are added, the section needs to be registered to start listening for events 234 | System.register() 235 | -------------------------------------------------------------------------------- /UnityTweakTool/section/windowmanager.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | 33 | from UnityTweakTool.section.skeletonpage import Section, Tab 34 | from UnityTweakTool.elements.cbox import ComboBox 35 | from UnityTweakTool.elements.checkbox import CheckBox 36 | from UnityTweakTool.elements.spin import SpinButton 37 | from UnityTweakTool.elements.switch import Switch 38 | 39 | from UnityTweakTool.section.spaghetti.compiz import Compizsettings as SpaghettiCompizSettings 40 | from UnityTweakTool.elements.option import Option,HandlerObject 41 | 42 | from collections import defaultdict 43 | 44 | 45 | WindowManager=Section(ui='windowmanager.ui',id='nb_compizsettings') 46 | 47 | #=============== GENERAL ========================== 48 | 49 | #sw_compiz_zoom= Switch({ 50 | # 'id' : 'sw_compiz_zoom', 51 | # 'builder' : WindowManager.builder, 52 | # 'schema' : 'org.compiz.ezoom', 53 | # 'path' : '/org/compiz/profiles/unity/plugins/ezoom/', 54 | # 'key' : 'integration-allowed', 55 | # 'type' : 'boolean', 56 | # 'map' : {True:True,False:False}, 57 | # 'dependants': [] 58 | #}) 59 | 60 | cbox_opengl=ComboBox({ 61 | 'id' : 'cbox_opengl', 62 | 'builder' : WindowManager.builder, 63 | 'schema' : 'org.compiz.opengl', 64 | 'path' : '/org/compiz/profiles/unity/plugins/opengl/', 65 | 'key' : 'texture-filter', 66 | 'type' : 'int', 67 | 'map' : {0:0,1:1,2:2} 68 | }) 69 | 70 | 71 | # TODO: 72 | # TypeError: unhashable type: 'list' 73 | 74 | # cbox_minimize_animation=ComboBox({ 75 | # 'id' : 'cbox_minimize_animation', 76 | # 'builder' : WindowManager.builder, 77 | # 'schema' : 'org.compiz.animation', 78 | # 'path' : '/org/compiz/profiles/unity/plugins/animation/', 79 | # 'key' : 'minimize-effects', 80 | # 'type' : 'strv', 81 | # 'map' : {'animation:None':0, 82 | # 'animation:Random':1, 83 | # 'animation:Curved Fold':2, 84 | # 'animation:Fade':3, 85 | # 'animation:Glide 1':4, 86 | # 'animation:Glide 2':5, 87 | # 'animation:Horizontal Folds':6, 88 | # 'animation:Magic Lamp':7, 89 | # 'animation:Magic Lamp Wavy':8, 90 | # 'animation:Sidekick':9, 91 | # 'animation:Zoom':10} 92 | # }) 93 | 94 | # TODO: 95 | # TypeError: unhashable type: 'list' 96 | 97 | # cbox_unminimize_animation=ComboBox({ 98 | # 'id' : 'cbox_unminimize_animation', 99 | # 'builder' : WindowManager.builder, 100 | # 'schema' : 'org.compiz.animation', 101 | # 'path' : '/org/compiz/profiles/unity/plugins/animation/', 102 | # 'key' : 'unminimize-effects', 103 | # 'type' : 'strv', 104 | # 'map' : {'animation:None':0, 105 | # 'animation:Random':1, 106 | # 'animation:Curved Fold':2, 107 | # 'animation:Fade':3, 108 | # 'animation:Glide 1':4, 109 | # 'animation:Glide 2':5, 110 | # 'animation:Horizontal Folds':6, 111 | # 'animation:Magic Lamp':7, 112 | # 'animation:Magic Lamp Wavy':8, 113 | # 'animation:Sidekick':9, 114 | # 'animation:Zoom':10} 115 | # }) 116 | 117 | 118 | # TODO 119 | # sw_compiz_zoom 120 | # list_compiz_general_zoom_accelerators 121 | # cbox_minimize_animation 122 | # cbox_unminimize_animation 123 | # list_compiz_general_keys_accelerators 124 | 125 | GeneralIcons=Tab([cbox_opengl]) #, 126 | # cbox_minimize_animation, 127 | # cbox_unminimize_animation]) 128 | 129 | 130 | #=============== WORKSPACE SETTINGS ========================== 131 | 132 | spin_horizontal_desktop=SpinButton({ 133 | 'id' : 'spin_horizontal_desktop', 134 | 'builder': WindowManager.builder, 135 | 'schema' : 'org.compiz.core', 136 | 'path' : '/org/compiz/profiles/unity/plugins/core/', 137 | 'key' : 'hsize', 138 | 'type' : 'int', 139 | 'min' : 1, 140 | 'max' : 25 141 | }) 142 | 143 | spin_vertical_desktop=SpinButton({ 144 | 'id' : 'spin_vertical_desktop', 145 | 'builder': WindowManager.builder, 146 | 'schema' : 'org.compiz.core', 147 | 'path' : '/org/compiz/profiles/unity/plugins/core/', 148 | 'key' : 'vsize', 149 | 'type' : 'int', 150 | 'min' : 1, 151 | 'max' : 25 152 | }) 153 | 154 | # TODO: 155 | 156 | # sw_workspace_switcher 157 | # color_desk_outline 158 | # list_compiz_workspace_accelerators 159 | 160 | 161 | WorkspaceSettingsIcons=Tab([spin_horizontal_desktop, 162 | spin_vertical_desktop]) 163 | 164 | #=============== WINDOW SPREAD ========================== 165 | 166 | spin_compiz_spacing=SpinButton({ 167 | 'id' : 'spin_compiz_spacing', 168 | 'builder': WindowManager.builder, 169 | 'schema' : 'org.compiz.scale', 170 | 'path' : '/org/compiz/profiles/unity/plugins/scale/', 171 | 'key' : 'spacing', 172 | 'type' : 'int', 173 | 'min' : 0, 174 | 'max' : 250 175 | }) 176 | 177 | check_overlay_emblem= CheckBox({ 178 | 'id' : 'check_overlay_emblem', 179 | 'builder' : WindowManager.builder, 180 | 'schema' : 'org.compiz.scale', 181 | 'path' : '/org/compiz/profiles/unity/plugins/scale/', 182 | 'key' : 'overlay-icon', 183 | 'type' : 'int', 184 | 'map' : defaultdict(lambda:True,{1:True,0:False}), 185 | 'dependants': [] 186 | }) 187 | 188 | check_click_desktop= CheckBox({ 189 | 'id' : 'check_click_desktop', 190 | 'builder' : WindowManager.builder, 191 | 'schema' : 'org.compiz.scale', 192 | 'path' : '/org/compiz/profiles/unity/plugins/scale/', 193 | 'key' : 'show-desktop', 194 | 'type' : 'boolean', 195 | 'map' : {True:True,False:False}, 196 | 'dependants': [] 197 | }) 198 | 199 | 200 | # TODO: 201 | 202 | # sw_windows_spread 203 | # list_compiz_windows_spread_accelerators 204 | 205 | WindowSpreadIcons=Tab([spin_compiz_spacing, 206 | check_overlay_emblem, 207 | check_click_desktop]) 208 | 209 | #=============== WINDOW SNAPPING ========================== 210 | 211 | # TODO: 212 | 213 | # sw_window_snapping 214 | # color_fill_color 215 | # color_outline_color 216 | # window snapping -- comboboxes 217 | 218 | 219 | #WindowSnappingIcons=Tab([]) 220 | 221 | #=============== HOTCORNERS ========================== 222 | 223 | # TODO: 224 | 225 | # switch_hotcorners 226 | # hotcorner comboboxes 227 | 228 | 229 | #=============== ADDITIONAL ========================== 230 | 231 | 232 | switch_auto_raise= Switch({ 233 | 'id' : 'switch_auto_raise', 234 | 'builder' : WindowManager.builder, 235 | 'schema' : 'org.gnome.desktop.wm.preferences', 236 | 'path' : None, 237 | 'key' : 'auto-raise', 238 | 'type' : 'boolean', 239 | 'map' : {True:True,False:False}, 240 | 'dependants': [] 241 | }) 242 | 243 | switch_raise_on_click= Switch({ 244 | 'id' : 'switch_raise_on_click', 245 | 'builder' : WindowManager.builder, 246 | 'schema' : 'org.gnome.desktop.wm.preferences', 247 | 'path' : None, 248 | 'key' : 'raise-on-click', 249 | 'type' : 'boolean', 250 | 'map' : {True:True,False:False}, 251 | 'dependants': [] 252 | }) 253 | 254 | 255 | cbox_focus_mode=ComboBox({ 256 | 'id' : 'cbox_focus_mode', 257 | 'builder' : WindowManager.builder, 258 | 'schema' : 'org.gnome.desktop.wm.preferences', 259 | 'path' : None, 260 | 'key' : 'focus-mode', 261 | 'type' : 'enum', 262 | 'map' : {0:0,1:1,2:2} 263 | }) 264 | 265 | cbox_double_click=ComboBox({ 266 | 'id' : 'cbox_double_click', 267 | 'builder' : WindowManager.builder, 268 | 'schema' : 'org.gnome.desktop.wm.preferences', 269 | 'path' : None, 270 | 'key' : 'focus-mode', 271 | 'type' : 'enum', 272 | 'map' : {0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7} 273 | }) 274 | 275 | cbox_middle_click=ComboBox({ 276 | 'id' : 'cbox_middle_click', 277 | 'builder' : WindowManager.builder, 278 | 'schema' : 'org.gnome.desktop.wm.preferences', 279 | 'path' : None, 280 | 'key' : 'focus-mode', 281 | 'type' : 'enum', 282 | 'map' : {0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7} 283 | }) 284 | 285 | cbox_right_click=ComboBox({ 286 | 'id' : 'cbox_right_click', 287 | 'builder' : WindowManager.builder, 288 | 'schema' : 'org.gnome.desktop.wm.preferences', 289 | 'path' : None, 290 | 'key' : 'focus-mode', 291 | 'type' : 'enum', 292 | 'map' : {0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7} 293 | }) 294 | 295 | # TODO: 296 | 297 | # scale_auto_raise_delay 298 | # colorbutton_resize_outline 299 | # colorbutton_resize_fill 300 | 301 | 302 | AdditionalIcons=Tab([switch_auto_raise, 303 | switch_raise_on_click, 304 | cbox_focus_mode, 305 | cbox_double_click, 306 | cbox_middle_click, 307 | cbox_right_click]) 308 | 309 | 310 | # Pass in the id of restore defaults button to enable it. 311 | GeneralIcons.enable_restore('b_compiz_general_reset') 312 | WorkspaceSettingsIcons.enable_restore('b_compiz_workspace_reset') 313 | WindowSpreadIcons.enable_restore('b_compiz_windows_spread_reset') 314 | #WindowSnappingIcons.enable_restore('') 315 | AdditionalIcons.enable_restore('b_wm_additional_reset') 316 | 317 | ## Each page must be added using add_page 318 | WindowManager.add_page(GeneralIcons) 319 | WindowManager.add_page(WorkspaceSettingsIcons) 320 | WindowManager.add_page(WindowSpreadIcons) 321 | #WindowManager.add_page(WindowSnappingIcons) 322 | WindowManager.add_page(AdditionalIcons) 323 | 324 | # XXX : Spaghetti bridge 325 | wmsettings=HandlerObject(SpaghettiCompizSettings(WindowManager.builder)) 326 | WindowManager.add_page(wmsettings) 327 | 328 | # After all pages are added, the section needs to be registered to start listening for events 329 | WindowManager.register() 330 | -------------------------------------------------------------------------------- /UnityTweakTool/section/spaghetti/theme.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # Team: 5 | # J Phani Mahesh 6 | # Barneedhar (jokerdino) 7 | # Amith KK 8 | # Georgi Karavasilev 9 | # Sam Tran 10 | # Sam Hewitt 11 | # Angel Araya 12 | # 13 | # Description: 14 | # A One-stop configuration tool for Unity. 15 | # 16 | # Legal Stuff: 17 | # 18 | # This file is a part of Unity Tweak Tool 19 | # 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. 23 | # 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 27 | # details. 28 | # 29 | # You should have received a copy of the GNU General Public License along with 30 | # this program; if not, see 31 | 32 | import os, os.path 33 | 34 | from gi.repository import Gtk, Gio 35 | 36 | from UnityTweakTool.config.ui import ui 37 | from . import unitytweakconfig 38 | from . import gsettings 39 | 40 | class Themesettings (): 41 | def __init__(self, builder): 42 | self.ui=ui(builder) 43 | self.gtkthemestore=Gtk.ListStore(str,str) 44 | self.windowthemestore=self.gtkthemestore 45 | self.ui['tree_gtk_theme'].set_model(self.gtkthemestore) 46 | self.ui['tree_window_theme'].set_model(self.windowthemestore) 47 | 48 | # Get all themes 49 | systhdir='/usr/share/themes' 50 | systemthemes=[(theme.capitalize(),os.path.join(systhdir,theme)) for theme in os.listdir(systhdir) if os.path.isdir(os.path.join(systhdir,theme))] 51 | try: 52 | uthdir=os.path.expanduser('~/.themes') 53 | userthemes=[(theme.capitalize(),os.path.join(uthdir,theme)) for theme in os.listdir(uthdir) if os.path.isdir(os.path.join(uthdir,theme))] 54 | except OSError as e: 55 | userthemes=[] 56 | allthemes=systemthemes+userthemes 57 | allthemes.sort() 58 | required=['gtk-2.0','gtk-3.0'] 59 | self.gtkthemes={} 60 | self.windowthemes={} 61 | for theme in allthemes: 62 | if all([os.path.isdir(os.path.join(theme[1],req)) for req in required]): 63 | iter=self.gtkthemestore.append(theme) 64 | themename=os.path.split(theme[1])[1] 65 | self.gtkthemes[themename]={'iter':iter,'path':theme[1]} 66 | self.windowthemes[themename]={'iter':iter,'path':theme[1]} 67 | 68 | self.iconthemestore=Gtk.ListStore(str,str) 69 | self.cursorthemestore=Gtk.ListStore(str,str) 70 | self.ui['tree_icon_theme'].set_model(self.iconthemestore) 71 | self.ui['tree_cursor_theme'].set_model(self.cursorthemestore) 72 | 73 | sysithdir='/usr/share/icons' 74 | systemiconthemes= [(theme.capitalize(),os.path.join(sysithdir,theme)) for theme in os.listdir(sysithdir) if os.path.isdir(os.path.join(sysithdir,theme))] 75 | to_be_hidden=[('Loginicons','/usr/share/icons/LoginIcons'),('Unity-webapps-applications','/usr/share/icons/unity-webapps-applications')] 76 | for item in to_be_hidden: 77 | try: 78 | systemiconthemes.remove(item) 79 | except ValueError as e: 80 | pass 81 | try: 82 | uithdir=os.path.expanduser('~/.icons') 83 | usericonthemes=[(theme.capitalize(),os.path.join(uithdir,theme)) for theme in os.listdir(uithdir) if os.path.isdir(os.path.join(uithdir,theme))] 84 | except OSError as e: 85 | usericonthemes=[] 86 | allithemes=systemiconthemes+usericonthemes 87 | allithemes.sort() 88 | self.iconthemes={} 89 | self.cursorthemes={} 90 | for theme in allithemes: 91 | iter=self.iconthemestore.append(theme) 92 | themename=os.path.split(theme[1])[1] 93 | self.iconthemes[themename]={'iter':iter,'path':theme[1]} 94 | if os.path.isdir(os.path.join(theme[1],'cursors')): 95 | iter=self.cursorthemestore.append(theme) 96 | self.cursorthemes[themename]={'iter':iter,'path':theme[1]} 97 | 98 | self.matchthemes=True 99 | 100 | #=====================================================================# 101 | # Helpers # 102 | #=====================================================================# 103 | 104 | 105 | def refresh(self): 106 | 107 | # System theme 108 | gtkthemesel=self.ui['tree_gtk_theme'].get_selection() 109 | gtktheme=gsettings.gnome('desktop.interface').get_string('gtk-theme') 110 | 111 | # FIXME: Workaround to fix LP bug: #1098845 112 | try: 113 | gtkthemesel.select_iter(self.gtkthemes[gtktheme]['iter']) 114 | 115 | # TODO: This except part should do something more. 116 | except KeyError: 117 | gtkthemesel.unselect_all() 118 | 119 | # Window theme 120 | windowthemesel=self.ui['tree_window_theme'].get_selection() 121 | windowtheme=gsettings.gnome('desktop.wm.preferences').get_string('theme') 122 | 123 | # FIXME: Workaround to fix LP bug: #1146122 124 | try: 125 | windowthemesel.select_iter(self.windowthemes[windowtheme]['iter']) 126 | 127 | # TODO: This except part should do a lot more. 128 | except KeyError: 129 | windowthemesel.unselect_all() 130 | 131 | # Icon theme 132 | iconthemesel=self.ui['tree_icon_theme'].get_selection() 133 | icontheme=gsettings.gnome('desktop.interface').get_string('icon-theme') 134 | 135 | # FIXME: Workaround to fix potential bug 136 | try: 137 | iconthemesel.select_iter(self.iconthemes[icontheme]['iter']) 138 | 139 | except KeyError: 140 | iconthemesel.unselect_all() 141 | 142 | # Cursor theme 143 | cursorthemesel=self.ui['tree_cursor_theme'].get_selection() 144 | cursortheme=gsettings.gnome('desktop.interface').get_string('cursor-theme') 145 | 146 | # FIXME: Workaround to fix LP bug: #1097227 147 | 148 | try: 149 | cursorthemesel.select_iter(self.cursorthemes[cursortheme]['iter']) 150 | # TODO: except part should make sure the selection is deselected. 151 | except KeyError: 152 | cursorthemesel.unselect_all() 153 | 154 | # Cursor size 155 | self.ui['check_cursor_size'].set_active(True if gsettings.interface.get_int('cursor-size') is 48 else False) 156 | 157 | # ===== Fonts ===== # 158 | 159 | # Fonts 160 | self.ui['font_default'].set_font_name(gsettings.interface.get_string('font-name')) 161 | self.ui['font_document'].set_font_name(gsettings.interface.get_string('document-font-name')) 162 | self.ui['font_monospace'].set_font_name(gsettings.interface.get_string('monospace-font-name')) 163 | self.ui['font_window_title'].set_font_name(gsettings.wm.get_string('titlebar-font')) 164 | 165 | # Antialiasing 166 | if gsettings.antialiasing.get_string('antialiasing') == 'none': 167 | self.ui['cbox_antialiasing'].set_active(0) 168 | elif gsettings.antialiasing.get_string('antialiasing') == 'grayscale': 169 | self.ui['cbox_antialiasing'].set_active(1) 170 | elif gsettings.antialiasing.get_string('antialiasing') == 'rgba': 171 | self.ui['cbox_antialiasing'].set_active(2) 172 | 173 | # Hinting 174 | if gsettings.antialiasing.get_string('hinting') == 'none': 175 | self.ui['cbox_hinting'].set_active(0) 176 | elif gsettings.antialiasing.get_string('hinting') == 'slight': 177 | self.ui['cbox_hinting'].set_active(1) 178 | elif gsettings.antialiasing.get_string('hinting') == 'medium': 179 | self.ui['cbox_hinting'].set_active(2) 180 | elif gsettings.antialiasing.get_string('hinting') == 'full': 181 | self.ui['cbox_hinting'].set_active(3) 182 | 183 | # Scaling 184 | self.ui['spin_textscaling'].set_value(gsettings.interface.get_double('text-scaling-factor')) 185 | 186 | 187 | #-----BEGIN: Theme settings------ 188 | 189 | # These check for nonetype and return since for some bizzare reason Gtk.quit destroys 190 | # the selection object and then calls these callbacks. This is a temporary fix to LP:1096964 191 | 192 | # System Theme 193 | def on_treeselection_gtk_theme_changed(self,udata=None): 194 | gtktreesel = self.ui['tree_gtk_theme'].get_selection() 195 | if gtktreesel is None: 196 | return 197 | gtkthemestore,iter = gtktreesel.get_selected() 198 | if self.matchthemes: 199 | self.ui['treeselection_window_theme'].select_iter(iter) 200 | themepath=gtkthemestore.get_value(iter,1) 201 | theme=os.path.split(themepath)[1] 202 | gsettings.interface.set_string('gtk-theme',theme) 203 | 204 | def on_treeselection_window_theme_changed(self,udata=None): 205 | windowtreesel = self.ui['tree_window_theme'].get_selection() 206 | if windowtreesel is None: 207 | return 208 | windowthemestore,iter = windowtreesel.get_selected() 209 | if self.matchthemes: 210 | self.ui['treeselection_gtk_theme'].select_iter(iter) 211 | themepath=windowthemestore.get_value(iter,1) 212 | theme=os.path.split(themepath)[1] 213 | gsettings.wm.set_string('theme',theme) 214 | 215 | # Icon theme 216 | def on_tree_icon_theme_cursor_changed(self,udata=None): 217 | icontreesel = self.ui['tree_icon_theme'].get_selection() 218 | if icontreesel is None: 219 | return 220 | iconthemestore,iter = icontreesel.get_selected() 221 | themepath=iconthemestore.get_value(iter,1) 222 | theme=os.path.split(themepath)[1] 223 | gsettings.interface.set_string('icon-theme',theme) 224 | 225 | def on_check_show_incomplete_toggled(self,udata=None): 226 | # TODO 227 | print('To do') 228 | 229 | def on_b_theme_system_reset_clicked(self, widget): 230 | gsettings.interface.reset('gtk-theme') 231 | gsettings.wm.reset('theme') 232 | self.refresh() 233 | 234 | #----- End: Theme settings------ 235 | 236 | #----- Begin: Icon settings-------- 237 | 238 | def on_b_theme_icon_reset_clicked(self, widget): 239 | gsettings.interface.reset('icon-theme') 240 | self.refresh() 241 | 242 | #----- End: Icon settings------ 243 | 244 | #----- Begin: Cursor settings-------- 245 | 246 | # Cursor 247 | def on_tree_cursor_theme_cursor_changed(self,udata=None): 248 | cursortreesel= self.ui['tree_cursor_theme'].get_selection() 249 | if cursortreesel is None: 250 | return 251 | cursorthemestore,iter = cursortreesel.get_selected() 252 | themepath=cursorthemestore.get_value(iter,1) 253 | theme=os.path.split(themepath)[1] 254 | gsettings.interface.set_string('cursor-theme',theme) 255 | 256 | # Cursor Size 257 | def on_check_cursor_size_toggled(self, widget, udata = None): 258 | if self.ui['check_cursor_size'].get_active() == True : 259 | gsettings.interface.set_int('cursor-size', 48) 260 | else: 261 | gsettings.interface.set_int('cursor-size', 24) 262 | 263 | def on_b_theme_cursor_reset_clicked(self, widget): 264 | gsettings.interface.reset('cursor-theme') 265 | gsettings.interface.reset('cursor-size') 266 | self.refresh() 267 | 268 | #----- End: Cursor settings------ 269 | -------------------------------------------------------------------------------- /data/media/scalable/unity-tweak-tool-appearance-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 24 | 25 | 27 | image/svg+xml 28 | 30 | 31 | 32 | 33 | 34 | 36 | 38 | 42 | 46 | 50 | 51 | 53 | 57 | 61 | 62 | 64 | 68 | 72 | 73 | 75 | 79 | 83 | 84 | 86 | 90 | 94 | 95 | 103 | 105 | 109 | 113 | 117 | 118 | 126 | 133 | 135 | 139 | 143 | 144 | 151 | 153 | 157 | 161 | 165 | 169 | 173 | 174 | 181 | 188 | 195 | 202 | 204 | 208 | 212 | 213 | 220 | 227 | 234 | 241 | 248 | 255 | 259 | 260 | 280 | 287 | 288 | 296 | 304 | 312 | 320 | 328 | 336 | 344 | 352 | 360 | 361 | --------------------------------------------------------------------------------