Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def tint2():
"""Reloads tint2 configuration on the fly."""
if shutil.which("tint2") and util.get_pid("tint2"):
subprocess.Popen(["pkill", "-SIGUSR1", "tint2"])
def openbox():
"""Reloads openbox configuration to reload theme"""
if shutil.which("openbox") and util.get_pid("openbox"):
subprocess.Popen(["openbox", "--reconfigure"])
gsettings_theme = subprocess.Popen(
cmd,
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL
).communicate()[0].decode().strip("' \n")
xfsettings_theme = None
if shutil.which("xfconf-query"):
cmd = ["xfconf-query", "-c", "xsettings", "-p", "/Net/ThemeName"]
xfsettings_theme = subprocess.Popen(
cmd,
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL
).communicate()[0].decode().strip("' \n")
if util.get_pid("gsd-settings") and gsettings_theme:
subprocess.Popen(refresh_gsettings.format(gsettings_theme), shell=True)
logging.info("Reloaded %s theme via gsd-settings" % gsettings_theme)
elif util.get_pid("xfsettingsd") and xfsettings_theme:
subprocess.Popen(refresh_xfsettings, shell=True)
logging.info("reloaded %s theme via xfsettingsd" % xfsettings_theme)
# no settings daemon is running.
# So GTK is getting theme info from gtkrc file
# using xsettingd to set the same theme (parsing it from gtkrc)
elif shutil.which("xsettingsd") and os.path.isfile(settings_ini):
gtkrc = configparser.ConfigParser()
gtkrc.read(settings_ini)
if gtkrc["Settings"]:
theme = gtkrc["Settings"].get("gtk-theme-name", "FlatColor")
def dunst():
"""Kills dunst so that notify-send reloads it when called."""
if shutil.which("dunst") and util.get_pid("dunst"):
subprocess.Popen(["killall", "dunst"])
).communicate()[0].decode().strip("' \n")
xfsettings_theme = None
if shutil.which("xfconf-query"):
cmd = ["xfconf-query", "-c", "xsettings", "-p", "/Net/ThemeName"]
xfsettings_theme = subprocess.Popen(
cmd,
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL
).communicate()[0].decode().strip("' \n")
if util.get_pid("gsd-settings") and gsettings_theme:
subprocess.Popen(refresh_gsettings.format(gsettings_theme), shell=True)
logging.info("Reloaded %s theme via gsd-settings" % gsettings_theme)
elif util.get_pid("xfsettingsd") and xfsettings_theme:
subprocess.Popen(refresh_xfsettings, shell=True)
logging.info("reloaded %s theme via xfsettingsd" % xfsettings_theme)
# no settings daemon is running.
# So GTK is getting theme info from gtkrc file
# using xsettingd to set the same theme (parsing it from gtkrc)
elif shutil.which("xsettingsd") and os.path.isfile(settings_ini):
gtkrc = configparser.ConfigParser()
gtkrc.read(settings_ini)
if gtkrc["Settings"]:
theme = gtkrc["Settings"].get("gtk-theme-name", "FlatColor")
fd, path = tempfile.mkstemp()
try:
with os.fdopen(fd, "w+") as tmp: