mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-01-10 07:58:12 +01:00
misc: changes.
This commit is contained in:
parent
55503fbc60
commit
30ea15b0e2
@ -13,13 +13,11 @@ from . import util
|
|||||||
|
|
||||||
def imagemagick(color_count, img, magick_command):
|
def imagemagick(color_count, img, magick_command):
|
||||||
"""Call Imagemagick to generate a scheme."""
|
"""Call Imagemagick to generate a scheme."""
|
||||||
colors = subprocess.run([*magick_command, img,
|
flags = ["-resize", "25%", "-colors", str(color_count),
|
||||||
"-resize", "25%", "+dither",
|
"-unique-colors", "txt:-"]
|
||||||
"-colors", str(color_count),
|
|
||||||
"-unique-colors", "txt:-"],
|
|
||||||
stdout=subprocess.PIPE)
|
|
||||||
|
|
||||||
return colors.stdout.splitlines()
|
return subprocess.check_output([*magick_command,
|
||||||
|
img, *flags]).splitlines()
|
||||||
|
|
||||||
|
|
||||||
def has_im():
|
def has_im():
|
||||||
|
@ -53,11 +53,13 @@ def every(colors, output_dir=CACHE_DIR):
|
|||||||
template_dir_user = os.path.join(CONF_DIR, "templates")
|
template_dir_user = os.path.join(CONF_DIR, "templates")
|
||||||
util.create_dir(template_dir_user)
|
util.create_dir(template_dir_user)
|
||||||
|
|
||||||
|
join = os.path.join # Minor optimization.
|
||||||
|
|
||||||
for file in os.scandir(template_dir):
|
for file in os.scandir(template_dir):
|
||||||
template(colors, file.path, os.path.join(output_dir, file.name))
|
template(colors, file.path, join(output_dir, file.name))
|
||||||
|
|
||||||
for file in os.scandir(template_dir_user):
|
for file in os.scandir(template_dir_user):
|
||||||
template(colors, file.path, os.path.join(output_dir, file.name))
|
template(colors, file.path, join(output_dir, file.name))
|
||||||
|
|
||||||
print("export: Exported all files.")
|
print("export: Exported all files.")
|
||||||
print("export: Exported all user files.")
|
print("export: Exported all user files.")
|
||||||
|
@ -18,9 +18,7 @@ def xrdb(xrdb_files=None):
|
|||||||
|
|
||||||
if shutil.which("xrdb") and OS != "Darwin":
|
if shutil.which("xrdb") and OS != "Darwin":
|
||||||
for file in xrdb_files:
|
for file in xrdb_files:
|
||||||
subprocess.Popen(["xrdb", "-merge", "-nocpp", file],
|
subprocess.run(["xrdb", "-merge", "-nocpp", file])
|
||||||
stdout=subprocess.DEVNULL,
|
|
||||||
stderr=subprocess.DEVNULL).wait()
|
|
||||||
|
|
||||||
|
|
||||||
def gtk():
|
def gtk():
|
||||||
|
@ -73,14 +73,14 @@ def create_sequences(colors):
|
|||||||
|
|
||||||
def send(colors, cache_dir=CACHE_DIR):
|
def send(colors, cache_dir=CACHE_DIR):
|
||||||
"""Send colors to all open terminals."""
|
"""Send colors to all open terminals."""
|
||||||
sequences = create_sequences(colors)
|
|
||||||
|
|
||||||
if OS == "Darwin":
|
if OS == "Darwin":
|
||||||
tty_pattern = "/dev/ttys00[0-9]*"
|
tty_pattern = "/dev/ttys00[0-9]*"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
tty_pattern = "/dev/pts/[0-9]*"
|
tty_pattern = "/dev/pts/[0-9]*"
|
||||||
|
|
||||||
|
sequences = create_sequences(colors)
|
||||||
|
|
||||||
# Writing to "/dev/pts/[0-9] lets you send data to open terminals.
|
# Writing to "/dev/pts/[0-9] lets you send data to open terminals.
|
||||||
for term in glob.glob(tty_pattern):
|
for term in glob.glob(tty_pattern):
|
||||||
util.save_file(sequences, term)
|
util.save_file(sequences, term)
|
||||||
|
Loading…
Reference in New Issue
Block a user