diff options
| author | Dylan Araps <dylan.araps@gmail.com> | 2017-12-27 17:34:21 +1100 |
|---|---|---|
| committer | Dylan Araps <dylan.araps@gmail.com> | 2017-12-27 17:34:21 +1100 |
| commit | 57e6ef173d4fccb90cacf50a00ddb4dd54ebe963 (patch) | |
| tree | 4ee2f77d40cb9ccaddf570b4d45a7f7ce4923722 /pywal | |
| parent | 72a7713ca8415f22198ff6abdb60b9ab44f4e974 (diff) | |
reload: Remove -r
Diffstat (limited to 'pywal')
| -rw-r--r-- | pywal/__main__.py | 7 | ||||
| -rw-r--r-- | pywal/reload.py | 14 | ||||
| -rw-r--r-- | pywal/sequences.py | 11 | ||||
| -rw-r--r-- | pywal/templates/load.sh | 4 | ||||
| -rw-r--r-- | pywal/util.py | 1 |
5 files changed, 12 insertions, 25 deletions
diff --git a/pywal/__main__.py b/pywal/__main__.py index e7f2aef..f5264f3 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -55,9 +55,6 @@ def get_args(args): help="Quiet mode, don\"t print anything and \ don't display notifications.") - arg.add_argument("-r", action="store_true", - help="Reload current colorscheme.") - arg.add_argument("-R", action="store_true", help="Restore previous colorscheme.") @@ -97,10 +94,6 @@ def process_args(args): scheme_dir = os.path.join(CACHE_DIR, "schemes") shutil.rmtree(scheme_dir, ignore_errors=True) - if args.r: - reload.colors(args.t) - sys.exit(0) - if args.a: util.Color.alpha_num = args.a diff --git a/pywal/reload.py b/pywal/reload.py index 7937e8f..4d3f69e 100644 --- a/pywal/reload.py +++ b/pywal/reload.py @@ -65,17 +65,3 @@ def env(xrdb_file=None): sway() polybar() print("reload: Reloaded environment.") - - -def colors(vte, cache_dir=CACHE_DIR): - """Reload the current scheme.""" - sequence_file = os.path.join(cache_dir, "sequences") - - if os.path.isfile(sequence_file): - sequences = "".join(util.read_file(sequence_file)) - - # If vte mode was used, remove the unsupported sequence. - if vte: - sequences = re.sub(r"\]708;(\[.{0,3}\])?\#.{6}", "", sequences) - - print(sequences, end="") diff --git a/pywal/sequences.py b/pywal/sequences.py index 7b6f4ae..34c2b03 100644 --- a/pywal/sequences.py +++ b/pywal/sequences.py @@ -45,10 +45,6 @@ def create_sequences(colors, vte): sequences = [set_color(index, colors["colors"]["color%s" % index]) for index in range(16)] - # This escape sequence doesn"t work in VTE terminals. - if not vte: - sequences.append(set_special(708, colors["special"]["background"])) - # Special colors. # Source: https://goo.gl/KcoQgP # 10 = foreground, 11 = background, 12 = cursor foregound @@ -61,6 +57,13 @@ def create_sequences(colors, vte): if OS == "Darwin": sequences += set_iterm_tab_color(colors["special"]["background"]) + # Send sequences to object. + util.Color.sequences = "".join(sequences) + + # This escape sequence doesn"t work in VTE terminals. + if not vte: + sequences.append(set_special(708, colors["special"]["background"])) + return "".join(sequences) diff --git a/pywal/templates/load.sh b/pywal/templates/load.sh new file mode 100644 index 0000000..6e4848f --- /dev/null +++ b/pywal/templates/load.sh @@ -0,0 +1,4 @@ +echo -en "{color0.sequences}" + +[[ -z "$VTE_VERSION" ]] && \ + echo -en "\\033]708;{color0}\\007" diff --git a/pywal/util.py b/pywal/util.py index 37df3a8..cef5a63 100644 --- a/pywal/util.py +++ b/pywal/util.py @@ -10,6 +10,7 @@ import subprocess class Color: """Color formats.""" alpha_num = 100 + sequences = "" def __init__(self, hex_color): self.hex_color = hex_color |
