From e536f5f2a96f4f8cf0e8cb86199a870395eca5f3 Mon Sep 17 00:00:00 2001 From: Tin Lai Date: Sat, 9 May 2020 16:13:03 +1000 Subject: [PATCH] add option to manually set theme --- automathemely/autoth_tools/argmanager.py | 11 +++++++++++ automathemely/bin/run.py | 8 ++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/automathemely/autoth_tools/argmanager.py b/automathemely/autoth_tools/argmanager.py index 3a3ba3d..47eac1a 100644 --- a/automathemely/autoth_tools/argmanager.py +++ b/automathemely/autoth_tools/argmanager.py @@ -19,6 +19,10 @@ options.add_argument('-r', '--restart', help='(re)start the scheduler script if it were to not start or stop unexpectedly', action='store_true', default=False) +options.add_argument('--light', + help='manually set current theme to Light', action='store_true', default=False) +options.add_argument('--dark', + help='manually set current theme to Dark', action='store_true', default=False) # For --list arg @@ -119,3 +123,10 @@ def main(us_se): Popen(['pkill', '-f', 'autothscheduler.py']).wait() Popen(['python3', get_bin('autothscheduler.py')], start_new_session=True, stdout=DEVNULL, stderr=DEVNULL) logger.info('Restarted the scheduler') + + # MANUALLY SET THEME + elif args.light: + return "light" + elif args.dark: + return "dark" + diff --git a/automathemely/bin/run.py b/automathemely/bin/run.py index 5bd9a93..2c10cc8 100755 --- a/automathemely/bin/run.py +++ b/automathemely/bin/run.py @@ -83,8 +83,9 @@ def main(): # If any argument is given, pass it/them to the arg manager module if len(sys.argv) > 1: - automathemely.autoth_tools.argmanager.main(user_settings) - return + manual_theme_set = automathemely.autoth_tools.argmanager.main(user_settings) + if manual_theme_set is None: + return # We don't want to proceed until we have given the user the chance to review its settings if first_time_run: @@ -111,6 +112,9 @@ def main(): else: t_color = 'dark' + if manual_theme_set is not None: + t_color = manual_theme_set + logger.info('Switching to {} themes...'.format(t_color)) # Change desktop environment theme