From 614c1ab44a8527c83ba7777d2796e4d58093186a Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Fri, 11 Jan 2019 07:47:02 +0200 Subject: Aargs: Added --vte to fix artifacts in VTE terminals. --- pywal/__main__.py | 5 ++++- pywal/sequences.py | 12 ++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pywal/__main__.py b/pywal/__main__.py index b5833ea..2e50ca9 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -59,6 +59,9 @@ def get_args(): arg.add_argument("--preview", action="store_true", help="Print the current color palette.") + arg.add_argument("--vte", action="store_true", + help="Fix text-artifacts printed in VTE terminals.") + arg.add_argument("-c", action="store_true", help="Delete all cached colorschemes.") @@ -174,7 +177,7 @@ def parse_args(parser): if not args.n: wallpaper.change(colors_plain["wallpaper"]) - sequences.send(colors_plain, to_send=not args.s) + sequences.send(colors_plain, to_send=not args.s, vte_fix=args.vte) if sys.stdout.isatty(): colors.palette() diff --git a/pywal/sequences.py b/pywal/sequences.py index 18aa6eb..47acb34 100644 --- a/pywal/sequences.py +++ b/pywal/sequences.py @@ -35,7 +35,7 @@ def set_iterm_tab_color(color): "\033]6;1;bg;blue;brightness;%s\a") % (*util.hex_to_rgb(color),) -def create_sequences(colors): +def create_sequences(colors, vte_fix=False): """Create the escape sequences.""" alpha = colors["alpha"] @@ -54,18 +54,22 @@ def create_sequences(colors): set_special(13, colors["special"]["foreground"], "l"), set_special(17, colors["special"]["foreground"], "l"), set_special(19, colors["special"]["background"], "l"), - set_special(708, colors["special"]["background"], "l", alpha), set_color(232, colors["special"]["background"]), set_color(256, colors["special"]["foreground"]) ]) + if not vte_fix: + sequences.extend( + set_special(708, colors["special"]["background"], "l", alpha) + ) + if OS == "Darwin": sequences += set_iterm_tab_color(colors["special"]["background"]) return "".join(sequences) -def send(colors, cache_dir=CACHE_DIR, to_send=True): +def send(colors, cache_dir=CACHE_DIR, to_send=True, vte_fix=False): """Send colors to all open terminals.""" if OS == "Darwin": tty_pattern = "/dev/ttys00[0-9]*" @@ -73,7 +77,7 @@ def send(colors, cache_dir=CACHE_DIR, to_send=True): else: tty_pattern = "/dev/pts/[0-9]*" - sequences = create_sequences(colors) + sequences = create_sequences(colors, vte_fix) # Writing to "/dev/pts/[0-9] lets you send data to open terminals. if to_send: -- cgit v1.2.3