mirror of
https://github.com/dylanaraps/pywal.git
synced 2024-11-25 17:33:09 +01:00
general: Remove duplicate code.
This commit is contained in:
parent
d9a22726cb
commit
0834cd024b
@ -11,6 +11,7 @@ from pywal.settings import CACHE_DIR, __version__
|
|||||||
from pywal import export_colors
|
from pywal import export_colors
|
||||||
from pywal import gen_colors
|
from pywal import gen_colors
|
||||||
from pywal import set_colors
|
from pywal import set_colors
|
||||||
|
from pywal import reload
|
||||||
from pywal import wallpaper
|
from pywal import wallpaper
|
||||||
from pywal import util
|
from pywal import util
|
||||||
|
|
||||||
@ -94,15 +95,15 @@ def process_args(args):
|
|||||||
if not args.n:
|
if not args.n:
|
||||||
wallpaper.set_wallpaper(image)
|
wallpaper.set_wallpaper(image)
|
||||||
|
|
||||||
# Set the colors.
|
|
||||||
set_colors.send_sequences(colors_plain, args.t)
|
|
||||||
export_colors.export_all_templates(colors_plain)
|
|
||||||
|
|
||||||
# -f
|
# -f
|
||||||
elif args.f:
|
elif args.f:
|
||||||
colors_plain = util.read_file_json(args.f)
|
colors_plain = util.read_file_json(args.f)
|
||||||
|
|
||||||
|
# -i or -f
|
||||||
|
if args.i or args.f:
|
||||||
set_colors.send_sequences(colors_plain, args.t)
|
set_colors.send_sequences(colors_plain, args.t)
|
||||||
export_colors.export_all_templates(colors_plain)
|
export_colors.export_all_templates(colors_plain)
|
||||||
|
reload.reload_env()
|
||||||
|
|
||||||
# -o
|
# -o
|
||||||
if args.o:
|
if args.o:
|
||||||
|
27
pywal/reload.py
Normal file
27
pywal/reload.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
"""
|
||||||
|
Reload programs.
|
||||||
|
"""
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
from pywal.settings import CACHE_DIR
|
||||||
|
from pywal import util
|
||||||
|
|
||||||
|
|
||||||
|
def reload_i3():
|
||||||
|
"""Reload i3 colors."""
|
||||||
|
if shutil.which("i3-msg"):
|
||||||
|
util.disown("i3-msg", "reload")
|
||||||
|
|
||||||
|
|
||||||
|
def reload_xrdb():
|
||||||
|
"""Merge the colors into the X db so new terminals use them."""
|
||||||
|
if shutil.which("xrdb"):
|
||||||
|
subprocess.call(["xrdb", "-merge", CACHE_DIR / "colors.Xresources"])
|
||||||
|
|
||||||
|
|
||||||
|
def reload_env():
|
||||||
|
"""Reload environment programs."""
|
||||||
|
reload_i3()
|
||||||
|
reload_xrdb()
|
||||||
|
print("reload: Reloaded environment.")
|
Loading…
Reference in New Issue
Block a user