From 57e6ef173d4fccb90cacf50a00ddb4dd54ebe963 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 27 Dec 2017 17:34:21 +1100 Subject: reload: Remove -r --- pywal/__main__.py | 7 ------- pywal/reload.py | 14 -------------- pywal/sequences.py | 11 +++++++---- pywal/templates/load.sh | 4 ++++ pywal/util.py | 1 + 5 files changed, 12 insertions(+), 25 deletions(-) create mode 100644 pywal/templates/load.sh 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 -- cgit v1.2.3 From c0db2e92f1565f2e68b17463c6dd2841ecd7e5ea Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 27 Dec 2017 17:43:47 +1100 Subject: general: Remove -t --- pywal/__main__.py | 6 +----- pywal/sequences.py | 9 ++++----- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/pywal/__main__.py b/pywal/__main__.py index f5264f3..069b6ce 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -58,10 +58,6 @@ def get_args(args): arg.add_argument("-R", action="store_true", help="Restore previous colorscheme.") - arg.add_argument("-t", action="store_true", - help="Fix artifacts in VTE Terminals. \ - (Termite, xfce4-terminal)") - arg.add_argument("-v", action="store_true", help="Print \"wal\" version.") @@ -118,7 +114,7 @@ def process_args(args): colors_plain["colors"]["color0"] = args.b if args.i or args.f: - sequences.send(colors_plain, args.t) + sequences.send(colors_plain) if not args.n: wallpaper.change(colors_plain["wallpaper"]) diff --git a/pywal/sequences.py b/pywal/sequences.py index 34c2b03..32595d7 100644 --- a/pywal/sequences.py +++ b/pywal/sequences.py @@ -39,7 +39,7 @@ def set_iterm_tab_color(color): """ % (red, green, blue) -def create_sequences(colors, vte): +def create_sequences(colors): """Create the escape sequences.""" # Colors 0-15. sequences = [set_color(index, colors["colors"]["color%s" % index]) @@ -61,15 +61,14 @@ def create_sequences(colors, vte): 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"])) + sequences.append(set_special(708, colors["special"]["background"])) return "".join(sequences) -def send(colors, vte, cache_dir=CACHE_DIR): +def send(colors, cache_dir=CACHE_DIR): """Send colors to all open terminals.""" - sequences = create_sequences(colors, vte) + sequences = create_sequences(colors) if OS == "Darwin": tty_pattern = "/dev/ttys00[0-9]*" -- cgit v1.2.3 From f52953ca6c191deffdb6f91824017dd9c7db5366 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 27 Dec 2017 19:44:22 +1100 Subject: sequences: This is it, my magnum opus --- pywal/sequences.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pywal/sequences.py b/pywal/sequences.py index 32595d7..61c981b 100644 --- a/pywal/sequences.py +++ b/pywal/sequences.py @@ -60,8 +60,14 @@ def create_sequences(colors): # Send sequences to object. util.Color.sequences = "".join(sequences) - # This escape sequence doesn"t work in VTE terminals. - sequences.append(set_special(708, colors["special"]["background"])) + # This escape sequence doesn't work in VTE terminals and their parsing of + # unknown sequences is garbage so we need to use some escape sequence + # M A G I C to hide the output. + # \0337 # Save cursor position. + # \033[8m # Conceal text. + # \033]708;#000000\007 # Garbage sequence. + # \0338 i # Restore cursor position. + sequences.append(f"\0337\033[8m\033]708;{colors['special']['background']}\007\0338") return "".join(sequences) -- cgit v1.2.3 From d0c6798d9e696d2f48fe4e05617f2cdde3b6d88b Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 27 Dec 2017 19:45:36 +1100 Subject: sequences: cya later --- pywal/sequences.py | 3 --- pywal/templates/load.sh | 4 ---- pywal/util.py | 1 - 3 files changed, 8 deletions(-) delete mode 100644 pywal/templates/load.sh diff --git a/pywal/sequences.py b/pywal/sequences.py index 61c981b..a5a0f44 100644 --- a/pywal/sequences.py +++ b/pywal/sequences.py @@ -57,9 +57,6 @@ def create_sequences(colors): 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 and their parsing of # unknown sequences is garbage so we need to use some escape sequence # M A G I C to hide the output. diff --git a/pywal/templates/load.sh b/pywal/templates/load.sh deleted file mode 100644 index 6e4848f..0000000 --- a/pywal/templates/load.sh +++ /dev/null @@ -1,4 +0,0 @@ -echo -en "{color0.sequences}" - -[[ -z "$VTE_VERSION" ]] && \ - echo -en "\\033]708;{color0}\\007" diff --git a/pywal/util.py b/pywal/util.py index cef5a63..37df3a8 100644 --- a/pywal/util.py +++ b/pywal/util.py @@ -10,7 +10,6 @@ import subprocess class Color: """Color formats.""" alpha_num = 100 - sequences = "" def __init__(self, hex_color): self.hex_color = hex_color -- cgit v1.2.3 From 69ad38997d3e490292c8ffffccefc96c2a62a8ce Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 27 Dec 2017 20:07:58 +1100 Subject: sequences: This is it, my magnum opus --- pywal/sequences.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pywal/sequences.py b/pywal/sequences.py index a5a0f44..21553d6 100644 --- a/pywal/sequences.py +++ b/pywal/sequences.py @@ -64,7 +64,7 @@ def create_sequences(colors): # \033[8m # Conceal text. # \033]708;#000000\007 # Garbage sequence. # \0338 i # Restore cursor position. - sequences.append(f"\0337\033[8m\033]708;{colors['special']['background']}\007\0338") + sequences.append(f"\0337\033[1000H\033[8m\033]708;{colors['special']['background']}\007\0338") return "".join(sequences) -- cgit v1.2.3 From c236c7e0372580bcc74fa01988c1486db5e622b4 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 27 Dec 2017 20:08:53 +1100 Subject: sequences: This is it, my magnum opus --- pywal/sequences.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pywal/sequences.py b/pywal/sequences.py index 21553d6..2729c84 100644 --- a/pywal/sequences.py +++ b/pywal/sequences.py @@ -61,9 +61,10 @@ def create_sequences(colors): # unknown sequences is garbage so we need to use some escape sequence # M A G I C to hide the output. # \0337 # Save cursor position. + # \033[1000H # Move the cursor off screen. # \033[8m # Conceal text. # \033]708;#000000\007 # Garbage sequence. - # \0338 i # Restore cursor position. + # \0338 # Restore cursor position. sequences.append(f"\0337\033[1000H\033[8m\033]708;{colors['special']['background']}\007\0338") return "".join(sequences) -- cgit v1.2.3 From eab7458771d6b8d680f1e4da8819dd699e83acf7 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 27 Dec 2017 20:18:22 +1100 Subject: general: Add message about deprecation. --- pywal/__main__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pywal/__main__.py b/pywal/__main__.py index 069b6ce..4698851 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -55,6 +55,9 @@ def get_args(args): help="Quiet mode, don\"t print anything and \ don't display notifications.") + arg.add_argument("-r", action="store_true", + help="Deprecated: Use (cat ~/.cache/wal/sequences &) instead.") + arg.add_argument("-R", action="store_true", help="Restore previous colorscheme.") @@ -83,6 +86,10 @@ def process_args(args): print("wal", __version__) sys.exit(0) + if args.r: + print("Deprecated: Use (cat ~/.cache/wal/sequences &) instead.") + sys.exit(1) + if args.q: sys.stdout = sys.stderr = open(os.devnull, "w") -- cgit v1.2.3 From ba84790b7ab9d59594162f23ed2cb81d9d03532a Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 27 Dec 2017 20:19:20 +1100 Subject: general: Add message about deprecation. --- pywal/__main__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pywal/__main__.py b/pywal/__main__.py index 4698851..ffa8cb1 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -61,6 +61,9 @@ def get_args(args): arg.add_argument("-R", action="store_true", help="Restore previous colorscheme.") + arg.add_argument("-t", action="store_false", + help="Deprecated: Does nothing and is no longer needed.") + arg.add_argument("-v", action="store_true", help="Print \"wal\" version.") -- cgit v1.2.3 From 78582215a08301ff47e14b2722561a5044ac18b9 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 27 Dec 2017 20:29:25 +1100 Subject: general: fix linting --- pywal/__main__.py | 3 ++- pywal/reload.py | 1 - pywal/sequences.py | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pywal/__main__.py b/pywal/__main__.py index ffa8cb1..ed6e069 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -56,7 +56,8 @@ def get_args(args): don't display notifications.") arg.add_argument("-r", action="store_true", - help="Deprecated: Use (cat ~/.cache/wal/sequences &) instead.") + help="Deprecated: Use \ + (cat ~/.cache/wal/sequences &) instead.") arg.add_argument("-R", action="store_true", help="Restore previous colorscheme.") diff --git a/pywal/reload.py b/pywal/reload.py index 4d3f69e..f66cc96 100644 --- a/pywal/reload.py +++ b/pywal/reload.py @@ -2,7 +2,6 @@ Reload programs. """ import os -import re import shutil import subprocess diff --git a/pywal/sequences.py b/pywal/sequences.py index 2729c84..1043e60 100644 --- a/pywal/sequences.py +++ b/pywal/sequences.py @@ -65,7 +65,8 @@ def create_sequences(colors): # \033[8m # Conceal text. # \033]708;#000000\007 # Garbage sequence. # \0338 # Restore cursor position. - sequences.append(f"\0337\033[1000H\033[8m\033]708;{colors['special']['background']}\007\0338") + sequences.append(f"\0337\033[1000H\033[8m\033]708;%s\007\0338" % + colors['special']['background']) return "".join(sequences) -- cgit v1.2.3 From c3589442625a48066345f45f09ff353818694ac8 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 27 Dec 2017 20:49:37 +1100 Subject: general: fix linting --- pywal/sequences.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pywal/sequences.py b/pywal/sequences.py index 1043e60..e82ee6e 100644 --- a/pywal/sequences.py +++ b/pywal/sequences.py @@ -65,7 +65,7 @@ def create_sequences(colors): # \033[8m # Conceal text. # \033]708;#000000\007 # Garbage sequence. # \0338 # Restore cursor position. - sequences.append(f"\0337\033[1000H\033[8m\033]708;%s\007\0338" % + sequences.append("\0337\033[1000H\033[8m\033]708;%s\007\0338" % colors['special']['background']) return "".join(sequences) -- cgit v1.2.3