Skip to content

Commit

Permalink
Fixed wswitcher to run independently on multiple accounts simultaneou…
Browse files Browse the repository at this point in the history
…sly.
  • Loading branch information
Jacob-Vlijm committed Jan 27, 2018
1 parent 2c192d6 commit b0bf3aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions budgie-wswitcher/budgie_wswitcher.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import gi.repository

gi.require_version('Budgie', '1.0')
from gi.repository import Budgie, GObject, Gtk
import subprocess
Expand All @@ -20,6 +19,7 @@
program. If not, see <http://www.gnu.org/licenses/>.
"""

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")
Expand All @@ -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
Expand Down
7 changes: 4 additions & 3 deletions budgie-wswitcher/wswitcher_panelrunner
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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
Expand Down

0 comments on commit b0bf3aa

Please sign in to comment.