mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-06-21 18:11:29 +02:00
General: Move duplicate code to a function.
This commit is contained in:
parent
5481829a12
commit
5531402369
19
wal
19
wal
@ -119,10 +119,7 @@ def process_args(args):
|
|||||||
|
|
||||||
# -o
|
# -o
|
||||||
if args.o:
|
if args.o:
|
||||||
subprocess.Popen(["nohup", args.o],
|
disown(args.o)
|
||||||
stdout=subprocess.DEVNULL,
|
|
||||||
stderr=subprocess.DEVNULL,
|
|
||||||
preexec_fn=os.setpgrp)
|
|
||||||
|
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
@ -475,10 +472,7 @@ def reload_xrdb(export_file):
|
|||||||
def reload_i3():
|
def reload_i3():
|
||||||
"""Reload i3 colors."""
|
"""Reload i3 colors."""
|
||||||
if shutil.which("i3-msg"):
|
if shutil.which("i3-msg"):
|
||||||
subprocess.Popen(["i3-msg", "reload"],
|
disown("i3-msg", "reload")
|
||||||
stdout=subprocess.DEVNULL,
|
|
||||||
stderr=subprocess.DEVNULL,
|
|
||||||
preexec_fn=os.setpgrp)
|
|
||||||
|
|
||||||
|
|
||||||
def export_colors(colors):
|
def export_colors(colors):
|
||||||
@ -570,6 +564,15 @@ def notify(msg):
|
|||||||
preexec_fn=os.setpgrp)
|
preexec_fn=os.setpgrp)
|
||||||
|
|
||||||
|
|
||||||
|
def disown(*cmd):
|
||||||
|
"""Call a system command in the background,
|
||||||
|
disown it and hide it's output."""
|
||||||
|
subprocess.Popen(["nohup"] + list(cmd),
|
||||||
|
stdout=subprocess.DEVNULL,
|
||||||
|
stderr=subprocess.DEVNULL,
|
||||||
|
preexec_fn=os.setpgrp)
|
||||||
|
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user