Permalink
Find file
616fdef Nov 27, 2013
@phanimahesh @jokerdino
executable file 80 lines (71 sloc) 2.73 KB
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Team:
# J Phani Mahesh <phanimahesh@gmail.com>
# Barneedhar (jokerdino) <barneedhar@ubuntu.com>
# Amith KK <amithkumaran@gmail.com>
# Georgi Karavasilev <motorslav@gmail.com>
# Sam Tran <samvtran@gmail.com>
# Sam Hewitt <hewittsamuel@gmail.com>
# Angel Araya <al.arayaq@gmail.com>
#
# Description:
# A One-stop configuration tool for Unity.
#
# Legal Stuff:
#
# This file is a part of Unity Tweak Tool
#
# Unity Tweak Tool is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 3.
#
# Unity Tweak Tool is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, see <https://www.gnu.org/licenses/gpl-3.0.txt>
import argparse
import UnityTweakTool
import os
import gettext
gettext.bindtextdomain('unity-tweak-tool')
_=gettext.gettext
parser = argparse.ArgumentParser()
optgrp = parser.add_mutually_exclusive_group()
optgrp.add_argument('-u', '--unity', help=_('Start in the Unity tab'), action='store_true')
optgrp.add_argument('-w', '--winmng', help=_('Start in the WindowManager tab'), action='store_true')
optgrp.add_argument('-a', '--appearance', help=_('Start in the appearance tab'), action='store_true')
optgrp.add_argument('-s', '--system', help=_('Start in the system tab'), action='store_true')
optgrp.add_argument('--reset-unity', help=_('Reset Unity, wiping all configuration changes.'), action='store_true')
# DBUS crashes if DISPLAY is not set.
# https://errors.ubuntu.com/problem/5ce3e25dca09d233db038f04e57e179dda28ec9b
# Make a safe bet that it is :0.
# If you have multi display/ ssh -X, you can prolly debug if there's an issue.
if "DISPLAY" not in os.environ:
os.environ["DISPLAY"] = ":0"
args=parser.parse_args()
if args.unity:
UnityTweakTool.Application(1)
elif args.winmng:
UnityTweakTool.Application(2)
elif args.appearance:
UnityTweakTool.Application(3)
elif args.system:
UnityTweakTool.Application(4)
elif args.reset_unity:
print(_("""
WARNING: You are about to reset Unity to its default configuration.
This will result in loss of configuration.
It is normal for your desktop to flicker during the process.
Type yes to continue, anything else to exit.
"""))
prompt = input(_("Do you wish to continue?"))
if prompt.lower() == 'yes':
UnityTweakTool.reset_all()
print(_("Please log out and log back in."))
else:
UnityTweakTool.Application()