Core Application Code (__main__.py
)¶
Entry point, configuration parser, and main loop
-
KEYLOOKUP
= {'+': 'plus', ',': 'comma', '-': 'minus', '.': 'period'}¶ Used for resolving certain keysyms
-
class
QuickTileApp
(winman, commands, keys, modmask='')[source]¶ The basic Glib application itself.
- Parameters
commands (
CommandRegistry
) – The command registry to use to resolve command names.keys (
Dict
[str
,str
]) – A dict mappingGtk.accelerator_parse()
strings to command names.modmask (
str
) – A modifier mask to prepend to allkeys
.winman (
WindowManager
) – The window manager to invoke commands with so they can act.
-
run
()[source]¶ Initialize keybinding and D-Bus if available, then call
Gtk.main()
.
-
argparser
()[source]¶ argparse.ArgumentParser
definition that is compatible with sphinxcontrib.autoprogram- Return type
-
load_config
(path)[source]¶ Load the config file from the given path, applying fixes as needed. If it does not exist, create it from the configuration defaults.
- Parameters
path – The path to load or initialize.
- Raises
TypeError – Raised if the keys or values in the [keys] section of the configuration file or what they resolve to via
KEYLOOKUP
are notstr
instances.
- Return type
-
main
()[source]¶ setuptools-compatible entry point
- Raises
XInitError – Failed to connect to the X server.
- Return type
None
-
wnck_log_filter
(domain, level, message, userdata=None)[source]¶ A custom function for
GLib.log_set_handler()
which filters out the spurious error about_OB_WM_ACTION_UNDECORATE
being un-handled.- Parameters
domain (
str
) – The logging domain. Should beWnck
.level (
GLib.LogLevelFlags
) – The logging level Should beGLib.LogLevelFlags.LEVEL_WARNING
.message (
str
) – The error messageuserdata (
object
) – Required by the API but unused.
DEFAULTS
{ 'general': { 'ColumnCount': 3,
'ModMask': '<Ctrl><Alt>',
'MovementsWrap': True},
'keys': { '<Shift>KP_1': 'move-to-bottom-left',
'<Shift>KP_2': 'move-to-bottom',
'<Shift>KP_3': 'move-to-bottom-right',
'<Shift>KP_4': 'move-to-left',
'<Shift>KP_5': 'move-to-center',
'<Shift>KP_6': 'move-to-right',
'<Shift>KP_7': 'move-to-top-left',
'<Shift>KP_8': 'move-to-top',
'<Shift>KP_9': 'move-to-top-right',
'C': 'move-to-center',
'H': 'horizontal-maximize',
'KP_0': 'maximize',
'KP_1': 'bottom-left',
'KP_2': 'bottom',
'KP_3': 'bottom-right',
'KP_4': 'left',
'KP_5': 'center',
'KP_6': 'right',
'KP_7': 'top-left',
'KP_8': 'top',
'KP_9': 'top-right',
'KP_Enter': 'monitor-switch',
'V': 'vertical-maximize'}}
Thanks to Thomas Vander Stichele for some of the documentation cleanups during the GTK+ 2.x era.