Skip to content

Commit

Permalink
Converted the Unity grammar to a dynamic grammar, as not everyone use…
Browse files Browse the repository at this point in the history
…s Ubuntu or Unity.
  • Loading branch information
nirvdrum committed Oct 4, 2015
1 parent ddf3b4e commit d617f30
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions _unity.py → dynamics/unity.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
"""
import lib.config
config = lib.config.get_config()
if config.get("aenea.enabled", False) == True:
print("Loading Unity grammar...")

DYN_MODULE_TYPE = "window_manager"
DYN_MODULE_NAME = "unity"
INCOMPATIBLE_MODULES = []

if config.get("aenea.enabled", False) == True:
from dragonfly import (
Function,
MappingRule,
Expand Down Expand Up @@ -151,6 +154,32 @@ def switch_to_window(text):
grammar = Grammar("Unity desktop grammar", context=aenea.ProxyPlatformContext('linux'))
grammar.add_rule(rules)
grammar.load()
grammar.disable()

def dynamic_enable():
global grammar
if grammar.enabled:
return False
else:
grammar.enable()
return True


def dynamic_disable():
global grammar
if grammar.enabled:
grammar.disable()
return True
else:
return False


def is_enabled():
global grammar
if grammar.enabled:
return True
else:
return False

# Unload function which will be called at unload time.
def unload():
Expand Down

0 comments on commit d617f30

Please sign in to comment.