/usr/lib/python2.7/dist-packages/unity/emulators/compiz.py is in unity-autopilot 7.5.0+18.04.20180413-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | from __future__ import absolute_import
"""Functions that wrap compizconfig to avoid some unpleasantness in that module."""
from __future__ import absolute_import
from autopilot.utilities import Silence
_global_context = None
def get_global_context():
"""Get the compizconfig global context object."""
global _global_context
if _global_context is None:
with Silence():
from compizconfig import Context
_global_context = Context()
return _global_context
def _get_plugin(plugin_name):
"""Get a compizconfig plugin with the specified name.
Raises KeyError of the plugin named does not exist.
"""
ctx = get_global_context()
with Silence():
try:
return ctx.Plugins[plugin_name]
except KeyError:
raise KeyError("Compiz plugin '%s' does not exist." % (plugin_name))
def get_compiz_setting(plugin_name, setting_name):
"""Get a compiz setting object.
*plugin_name* is the name of the plugin (e.g. 'core' or 'unityshell')
*setting_name* is the name of the setting (e.g. 'alt_tab_timeout')
:raises: KeyError if the plugin or setting named does not exist.
:returns: a compiz setting object.
"""
plugin = _get_plugin(plugin_name)
with Silence():
try:
return plugin.Screen[setting_name]
except KeyError:
raise KeyError("Compiz setting '%s' does not exist in plugin '%s'." % (setting_name, plugin_name))
def get_compiz_option(plugin_name, setting_name):
"""Get a compiz setting value.
This is the same as calling:
>>> get_compiz_setting(plugin_name, setting_name).Value
"""
return get_compiz_setting(plugin_name, setting_name).Value
|