General: Cleanup

This commit is contained in:
Dylan Araps 2017-06-26 14:41:57 +10:00
parent 5567d576c4
commit 0bf70c105e
5 changed files with 23 additions and 26 deletions

View File

@ -15,9 +15,6 @@ from pywal import wallpaper
from pywal import util from pywal import util
__version__ = "0.1.6"
def get_args(): def get_args():
"""Get the script arguments.""" """Get the script arguments."""
description = "wal - Generate colorschemes on the fly" description = "wal - Generate colorschemes on the fly"
@ -73,11 +70,11 @@ def process_args(args):
# -r # -r
if args.r: if args.r:
export.reload_colors(args.t) set_colors.reload_colors(args.t)
# -v # -v
if args.v: if args.v:
print(f"wal {__version__}") print(f"wal {s.__version__}")
exit(0) exit(0)
# -i # -i

View File

@ -1,8 +1,6 @@
""" """
Export colors in various formats. Export colors in various formats.
""" """
import pathlib
import re
import shutil import shutil
import subprocess import subprocess
@ -17,23 +15,6 @@ def save_colors(colors, export_file, message):
print(f"export: exported {message}.") print(f"export: exported {message}.")
def reload_colors(vte):
"""Reload colors."""
sequence_file = pathlib.Path(s.CACHE_DIR / "sequences")
if sequence_file.is_file():
sequences = "".join(util.read_file(sequence_file))
# If vte mode was used, remove the problem sequence.
if vte:
sequences = re.sub(r"\]708;\#.{6}", "", sequences)
# Make the terminal interpret escape sequences.
print(util.fix_escape(sequences), end="")
exit(0)
def reload_xrdb(export_file): def reload_xrdb(export_file):
"""Merge the colors into the X db so new terminals use them.""" """Merge the colors into the X db so new terminals use them."""
if shutil.which("xrdb"): if shutil.which("xrdb"):

View File

@ -2,6 +2,8 @@
Send sequences to all open terminals. Send sequences to all open terminals.
""" """
import os import os
import pathlib
import re
from pywal import settings as s from pywal import settings as s
from pywal import util from pywal import util
@ -90,3 +92,20 @@ def send_sequences(colors, vte):
[util.save_file(sequences, term) for term in terminals] [util.save_file(sequences, term) for term in terminals]
print("colors: Set terminal colors") print("colors: Set terminal colors")
def reload_colors(vte):
"""Reload colors."""
sequence_file = pathlib.Path(s.CACHE_DIR / "sequences")
if sequence_file.is_file():
sequences = "".join(util.read_file(sequence_file))
# If vte mode was used, remove the problem sequence.
if vte:
sequences = re.sub(r"\]708;\#.{6}", "", sequences)
# Make the terminal interpret escape sequences.
print(util.fix_escape(sequences), end="")
exit(0)

View File

@ -4,7 +4,7 @@ Global variables and classes.
import pathlib import pathlib
__version__ = "0.1.6" __version__ = "0.2.0"
# Internal variables. # Internal variables.

View File

@ -1,6 +1,6 @@
"""wal - setup.py""" """wal - setup.py"""
from setuptools import setup from setuptools import setup
import pywal.__main__ as pywal import pywal.settings as pywal
DESC = ( DESC = (