summaryrefslogtreecommitdiff
path: root/pywal/sequences.py
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2017-12-27 21:07:26 +1100
committerDylan Araps <dylan.araps@gmail.com>2017-12-27 21:07:26 +1100
commit695ae1ffb22f64f4b26a282a49b08a9ce635c9e6 (patch)
tree8d5841471be7a7ec6ba9bc78784bb5d06420f591 /pywal/sequences.py
parent0e59e34d8ed15480bd61595be1e98b387770676e (diff)
parente68495b0a5f29176e14b0ccb03792a88cc88a296 (diff)
Merge branch 'master' of github.com:dylanaraps/pywal
Diffstat (limited to 'pywal/sequences.py')
-rw-r--r--pywal/sequences.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/pywal/sequences.py b/pywal/sequences.py
index 7b6f4ae..e82ee6e 100644
--- a/pywal/sequences.py
+++ b/pywal/sequences.py
@@ -39,16 +39,12 @@ 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])
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,12 +57,23 @@ def create_sequences(colors, vte):
if OS == "Darwin":
sequences += set_iterm_tab_color(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[1000H # Move the cursor off screen.
+ # \033[8m # Conceal text.
+ # \033]708;#000000\007 # Garbage sequence.
+ # \0338 # Restore cursor position.
+ sequences.append("\0337\033[1000H\033[8m\033]708;%s\007\0338" %
+ 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]*"