Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to manually set theme #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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