diff options
| author | dylan <dylan.araps@gmail.com> | 2019-10-01 13:08:42 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-01 13:08:42 +0300 |
| commit | f90940dd9599a3c39654ca7ad485ff6ea9094c99 (patch) | |
| tree | 9513ada1e46e4c6218101895b39160beee10d750 | |
| parent | a84b5ec2ab5c5b2dca1680b43e1dac2040f11a72 (diff) | |
| parent | b6a11f6338daabd33ffbfadc3a4f15e7080214eb (diff) | |
Merge pull request #456 from LoLei/305-symbol-theme
[Enhancement] #305: Add indication next to previous theme when running wal --theme
| -rw-r--r-- | pywal/theme.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/pywal/theme.py b/pywal/theme.py index fcd1dd1..2b14600 100644 --- a/pywal/theme.py +++ b/pywal/theme.py @@ -6,7 +6,7 @@ import os import random import sys -from .settings import CONF_DIR, MODULE_DIR +from .settings import CACHE_DIR, CONF_DIR, MODULE_DIR from . import util @@ -19,15 +19,21 @@ def list_out(): user_themes = [theme.name.replace(".json", "") for theme in list_themes_user()] + last_used_theme = util.read_file(os.path.join( + CACHE_DIR, "last_used_theme"))[0].replace(".json", "") + if user_themes: print("\033[1;32mUser Themes\033[0m:") - print(" -", "\n - ".join(sorted(user_themes))) + print(" -", "\n - ".join(t + " (last used)" if t == last_used_theme + else t for t in sorted(user_themes))) print("\033[1;32mDark Themes\033[0m:") - print(" -", "\n - ".join(sorted(dark_themes))) + print(" -", "\n - ".join(t + " (last used)" if t == last_used_theme else t + for t in sorted(dark_themes))) print("\033[1;32mLight Themes\033[0m:") - print(" -", "\n - ".join(sorted(ligh_themes))) + print(" -", "\n - ".join(t + " (last used)" if t == last_used_theme else t + for t in sorted(ligh_themes))) print("\033[1;32mExtra\033[0m:") print(" - random (select a random dark theme)") @@ -116,6 +122,8 @@ def file(input_file, light=False): if os.path.isfile(theme_file): logging.info("Set theme to \033[1;37m%s\033[0m.", os.path.basename(theme_file)) + util.save_file(os.path.basename(theme_file), + os.path.join(CACHE_DIR, "last_used_theme")) return parse(theme_file) logging.error("No %s colorscheme file found.", bri) |
