initial promotedtext, cleanups, prepare for consume non fenrirkey shortcuts
This commit is contained in:
parent
3c720b8b1a
commit
2e0fa69d08
28
src/fenrir-package/commands/onScreenChanged/75000-promote.py
Normal file
28
src/fenrir-package/commands/onScreenChanged/75000-promote.py
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user