mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-02-15 17:59:48 +01:00
util: Add new msg function.
This commit is contained in:
parent
950b7e892a
commit
3d1f11b1bd
@ -69,9 +69,7 @@ def get_colors(img, cache_dir, color_count, quiet):
|
|||||||
print("colors: Found cached colorscheme.")
|
print("colors: Found cached colorscheme.")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print("colors: Generating a colorscheme...")
|
util.msg("wal: Generating a colorscheme...", quiet)
|
||||||
if not quiet:
|
|
||||||
util.disown("notify-send", "wal: Generating a colorscheme...")
|
|
||||||
|
|
||||||
# Generate the colors.
|
# Generate the colors.
|
||||||
colors = gen_colors(img, color_count)
|
colors = gen_colors(img, color_count)
|
||||||
@ -79,10 +77,7 @@ def get_colors(img, cache_dir, color_count, quiet):
|
|||||||
|
|
||||||
# Cache the colorscheme.
|
# Cache the colorscheme.
|
||||||
util.save_file_json(colors, cache_file)
|
util.save_file_json(colors, cache_file)
|
||||||
|
util.msg("wal: Generation complete.", quiet)
|
||||||
print("colors: Generated colorscheme")
|
|
||||||
if not quiet:
|
|
||||||
util.disown("notify-send", "wal: Generation complete.")
|
|
||||||
|
|
||||||
return colors
|
return colors
|
||||||
|
|
||||||
|
@ -98,3 +98,12 @@ def disown(*cmd):
|
|||||||
stdout=subprocess.DEVNULL,
|
stdout=subprocess.DEVNULL,
|
||||||
stderr=subprocess.DEVNULL,
|
stderr=subprocess.DEVNULL,
|
||||||
preexec_fn=os.setpgrp)
|
preexec_fn=os.setpgrp)
|
||||||
|
|
||||||
|
|
||||||
|
def msg(input_msg, quiet):
|
||||||
|
"""Print to the terminal and a libnotify
|
||||||
|
notification."""
|
||||||
|
if not quiet:
|
||||||
|
disown("notify-send", input_msg)
|
||||||
|
|
||||||
|
print(input_msg)
|
||||||
|
Loading…
Reference in New Issue
Block a user