コード例 #1
0
def should_send_to_aenea():
    """Utility function for determining whether commands should be sent to Aenea.  Commands will be sent if
    Aenea is enabled and the Aenea global context application (the one capturing text on behalf of Aenea) is
    the foreground window."""

    if config.get("aenea.enabled", False) == True:
        win = dragonfly.Window.get_foreground()

        return aenea.ProxyPlatformContext('linux').matches(
            win.executable, win.title, win.handle)
    else:
        return False
コード例 #2
0
# https://github.com/dictation-toolbox/dragonfly-scripts
#
# Commands for inserting personal details loaded from the config file
#
# Author: Tony Grosinger
#
# Licensed under LGPL

import aenea
import aenea.configuration
from aenea.lax import Function, Text
from aenea import Choice
import dragonfly
from config import get_configuration

vim_context = aenea.ProxyPlatformContext('linux')
generic_grammar = dragonfly.Grammar('generic', context=vim_context)
config = get_configuration()

commands = {}
if "full-name" in config:
    commands['my full name'] = Text("%s" % config["full-name"])
if "last-name" in config:
    commands['my last name'] = Text("%s" % config["last-name"])
if "first-name" in config:
    commands['my first name'] = Text("%s" % config["first-name"])
if "email-address" in config:
    commands['my email'] = Text("%s" % config["email-address"])
if "company-name" in config:
    commands['company name'] = Text("%s" % config["company-name"])
コード例 #3
0
 def __init__(self):
     DynamicContext.__init__(self, None,
                             aenea.ProxyPlatformContext('linux'))
コード例 #4
0
ファイル: _awesome.py プロジェクト: oneyb/aenea-grammars
# This is a command module for Dragonfly. It provides bindings for the Linux
# window manager Awesome. Only active when running via proxy and the server
# reports Linux.

# You may find this useful to disable the Windows key in windows stealing focus
# from the client.
# http://support.microsoft.com/kb/216893#LetMeFixItMyselfAlways

import aenea
import aenea.misc
import aenea.configuration

import dragonfly

awesome_context = aenea.ProxyPlatformContext('linux')

grammar = dragonfly.Grammar('awesome', context=awesome_context)

awesome = 'W'

from aenea.lax import Key

basics_mapping = aenea.configuration.make_grammar_commands('awesome', {
    'termie': Key(awesome + '-enter'),
    '(whim | notion | ion) screen': Key(awesome + 'c-k'),
    '(whim | notion | ion) up': Key(awesome + '-k'),
    '(whim | notion | ion) down': Key(awesome + '-j'),
    '(whim | notion | ion) left': Key(awesome + 's-k'),
    '(whim | notion | ion) right': Key(awesome + 's-j'),
    '(whim | notion | ion) change screen [<n>]': Key(awesome + '-o:%(n)d'),
    '(whim | notion | ion) close client': Key(awesome + 's-c'),
コード例 #5
0
#
# Author: Tony Grosinger
#
# Licensed under LGPL

import aenea
import aenea.configuration
from aenea.lax import Key, Text
import dragonfly
try:
    import aenea.communications
except ImportError:
    print 'Unable to import Aenea client-side modules.'
    raise

terminal_context = aenea.ProxyPlatformContext('linux')
grammar = dragonfly.Grammar('terminal', context=terminal_context)

terminal_mapping = aenea.configuration.make_grammar_commands(
    'terminal',
    {
        # Terminal commands
        # dir is hard to say and recognize. Use something else
        'deer up': Text("cd ..") + Key("enter"),
        'deer list': Text("ls") + Key("enter"),
        'deer list all': Text("ls -lha") + Key("enter"),
        'deer list details': Text("ls -lh") + Key("enter"),
        'deer into': Text("cd "),
        '(terminal|term) clear': Text("clear") + Key("enter"),
        '(terminal|term) left': Key("c-pgup"),
        '(terminal|term) right': Key("c-pgdown"),