Skip to content

Commit

Permalink
add option to manually set theme
Browse files Browse the repository at this point in the history
  • Loading branch information
Tin Lai committed May 9, 2020
1 parent 3f6f997 commit a7db5e6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
11 changes: 11 additions & 0 deletions automathemely/autoth_tools/argmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"

9 changes: 7 additions & 2 deletions automathemely/bin/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ def main():
logging.getLogger().addHandler(automathemely.notifier_handler)

# If any argument is given, pass it/them to the arg manager module
manual_theme_set = None
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:
Expand All @@ -111,6 +113,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
Expand Down

0 comments on commit a7db5e6

Please sign in to comment.