How to use the wpgtk.data.util.get_pid function in wpgtk

To help you get started, we’ve selected a few wpgtk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github deviantfero / wpgtk / wpgtk / data / reload.py View on Github external
def tint2():
    """Reloads tint2 configuration on the fly."""
    if shutil.which("tint2") and util.get_pid("tint2"):
        subprocess.Popen(["pkill", "-SIGUSR1", "tint2"])
github deviantfero / wpgtk / wpgtk / data / reload.py View on Github external
def openbox():
    """Reloads openbox configuration to reload theme"""
    if shutil.which("openbox") and util.get_pid("openbox"):
        subprocess.Popen(["openbox", "--reconfigure"])
github deviantfero / wpgtk / wpgtk / data / reload.py View on Github external
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")
github deviantfero / wpgtk / wpgtk / data / reload.py View on Github external
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"])
github deviantfero / wpgtk / wpgtk / data / reload.py View on Github external
).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: