reload: Remove -r

This commit is contained in:
Dylan Araps 2017-12-27 17:34:21 +11:00
parent 72a7713ca8
commit 57e6ef173d
5 changed files with 12 additions and 25 deletions

View File

@ -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

View File

@ -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="")

View File

@ -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)

4
pywal/templates/load.sh Normal file
View File

@ -0,0 +1,4 @@
echo -en "{color0.sequences}"
[[ -z "$VTE_VERSION" ]] && \
echo -en "\\033]708;{color0}\\007"

View File

@ -10,6 +10,7 @@ import subprocess
class Color:
"""Color formats."""
alpha_num = 100
sequences = ""
def __init__(self, hex_color):
self.hex_color = hex_color