diff --git a/budgie-wswitcher/budgie_wswitcher.py b/budgie-wswitcher/budgie_wswitcher.py index 516e02a5..db935e07 100644 --- a/budgie-wswitcher/budgie_wswitcher.py +++ b/budgie-wswitcher/budgie_wswitcher.py @@ -1,5 +1,4 @@ import gi.repository - gi.require_version('Budgie', '1.0') from gi.repository import Budgie, GObject, Gtk import subprocess @@ -20,6 +19,7 @@ program. If not, see . """ +user = os.environ["USER"] plugin_path = os.path.dirname(os.path.abspath(__file__)) panelrunner = os.path.join(plugin_path, "wswitcher_panelrunner") backgrounder = os.path.join(plugin_path, "wswitcher_run") @@ -42,7 +42,7 @@ def check_runs(pname): # get the pid of a proc try: pid = subprocess.check_output([ - "pgrep", "-f", pname, + "pgrep", "-f", "-u", user, pname, ]).decode("utf-8") except subprocess.CalledProcessError: return None diff --git a/budgie-wswitcher/wswitcher_panelrunner b/budgie-wswitcher/wswitcher_panelrunner index a3db024a..d9ba881c 100755 --- a/budgie-wswitcher/wswitcher_panelrunner +++ b/budgie-wswitcher/wswitcher_panelrunner @@ -3,7 +3,7 @@ import os import subprocess import time import psutil -from budgie_wswitcher import wswitcher_ismuted +from budgie_wswitcher import wswitcher_ismuted, user """ Budgie WallpaperSwitcher @@ -27,7 +27,7 @@ def get_pid(): app = os.path.dirname(os.path.abspath(__file__)) + "/wswitcher_run" try: return int(subprocess.check_output([ - "pgrep", "-f", app]).decode("utf-8").strip()) + "pgrep", "-f", "-u", user, app]).decode("utf-8").strip()) except subprocess.CalledProcessError: return subprocess.Popen(app).pid @@ -54,7 +54,8 @@ def run_wswitcher(): check = subprocess.check_output([ "dconf", "dump", dcpath + key + "/" ]).decode("utf-8") - if not check: + login = user in subprocess.check_output("who").decode("utf-8") + if not all([check, login]): break except TypeError: break