From 2e0fa69d086bb3fa5dfb048df8e42627bab90adf Mon Sep 17 00:00:00 2001 From: Chrys Date: Fri, 19 Aug 2016 17:22:08 +0200 Subject: [PATCH] initial promotedtext, cleanups, prepare for consume non fenrirkey shortcuts --- .../commands/onScreenChanged/75000-promote.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/fenrir-package/commands/onScreenChanged/75000-promote.py diff --git a/src/fenrir-package/commands/onScreenChanged/75000-promote.py b/src/fenrir-package/commands/onScreenChanged/75000-promote.py new file mode 100644 index 00000000..7518aed6 --- /dev/null +++ b/src/fenrir-package/commands/onScreenChanged/75000-promote.py @@ -0,0 +1,28 @@ +#!/bin/python +import time + +class command(): + def __init__(self): + pass + def run(self, environment): + if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'promote', 'enabled'): + return environment + if environment['screenData']['newTTY'] != environment['screenData']['oldTTY']: + return environment + if environment['screenData']['newDelta'] == '': + return environment + if int(time.time() - environment['input']['lastInputTime']) < environment['runtime']['settingsManager'].getSettingAsInt(environment, 'promote', 'inactiveTimeoutSec'): + return environment + if len(environment['runtime']['settingsManager'].getSetting(environment, 'promote', 'list')) == 0: + return environment + for promote in environment['runtime']['settingsManager'].getSetting(environment, 'promote', 'list').split(','): + if promote in environment['screenData']['newDelta']: + environment['runtime']['outputManager'].playSoundIcon(environment,'PromotedText') + environment['input']['lastInputTime'] = time.time() + return environment + + return environment + def setCallback(self, callback): + pass + def shutdown(self): + pass