Don't wait for keypress if running notification client within systemd daemon

merge-requests/30/head
Bob Mottram 2021-03-14 18:02:32 +00:00
parent 840aca1808
commit 116a696543
3 changed files with 12 additions and 2 deletions

View File

@ -295,6 +295,11 @@ parser.add_argument("--brochMode",
type=str2bool, nargs='?',
const=True, default=False,
help="Enable broch mode")
parser.add_argument("--noKeyPress",
dest='noKeyPress',
type=str2bool, nargs='?',
const=True, default=False,
help="Notification daemon does not wait for keypresses")
parser.add_argument("--noapproval", type=str2bool, nargs='?',
const=True, default=False,
help="Allow followers without approval")
@ -1857,6 +1862,7 @@ if args.notifications:
args.screenreader, args.language,
args.notificationSounds,
args.notificationType,
args.noKeyPress,
args.debug)
sys.exit()

View File

@ -78,7 +78,7 @@ fi
echo '';
echo '[Service]';
echo "WorkingDirectory=${HOME}/.epicyon";
echo "ExecStart=/usr/bin/python3 epicyon.py --notifyType $notificationType --notify $HANDLE --password \"$PASSWORD\"";
echo "ExecStart=/usr/bin/python3 epicyon.py --noKeyPress --notifyType $notificationType --notify $HANDLE --password \"$PASSWORD\"";
echo 'Type=oneshot';
echo 'RemainAfterExit=yes';
echo '';

View File

@ -574,6 +574,7 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
systemLanguage: str,
notificationSounds: bool,
notificationType: str,
noKeyPress: bool,
debug: bool) -> None:
"""Runs the notifications and screen reader client,
which announces new inbox items
@ -772,7 +773,10 @@ def runNotificationsClient(baseDir: str, proxyType: str, httpPrefix: str,
prevSay = speakerJson['say']
# wait for a while, or until a key is pressed
keyPress = _waitForKeypress(30, debug)
if noKeyPress:
time.sleep(10)
else:
keyPress = _waitForKeypress(30, debug)
if keyPress:
if keyPress.startswith('/'):
keyPress = keyPress[1:]