mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-01-25 07:19:27 +01:00
reload: Check pids first.
This commit is contained in:
parent
7e797405c5
commit
f26a8bbb5e
@ -61,25 +61,25 @@ def gtk():
|
||||
|
||||
def i3():
|
||||
"""Reload i3 colors."""
|
||||
if shutil.which("i3-msg"):
|
||||
if shutil.which("i3-msg") and util.get_pid("i3"):
|
||||
util.disown(["i3-msg", "reload"])
|
||||
|
||||
|
||||
def kitty():
|
||||
""" Reload kitty colors. """
|
||||
if shutil.which("kitty"):
|
||||
if shutil.which("kitty") and util.get_pid("kitty"):
|
||||
util.disown(["kitty", "@", "set-colors", "--all"])
|
||||
|
||||
|
||||
def polybar():
|
||||
"""Reload polybar colors."""
|
||||
if shutil.which("polybar"):
|
||||
if shutil.which("polybar") and util.get_pid("polybar"):
|
||||
util.disown(["pkill", "-USR1", "polybar"])
|
||||
|
||||
|
||||
def sway():
|
||||
"""Reload sway colors."""
|
||||
if shutil.which("swaymsg"):
|
||||
if shutil.which("swaymsg") and util.get_pid("sway"):
|
||||
util.disown(["swaymsg", "reload"])
|
||||
|
||||
|
||||
|
@ -168,3 +168,11 @@ def disown(cmd):
|
||||
subprocess.Popen(cmd,
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL)
|
||||
|
||||
|
||||
def get_pid(name):
|
||||
"""Check if process is running by name."""
|
||||
try:
|
||||
subprocess.check_output(["pidof", "-s", name])
|
||||
except subprocess.CalledProcessError:
|
||||
return False
|
||||
|
Loading…
Reference in New Issue
Block a user