Skip to content

Instantly share code, notes, and snippets.

@cvoltz
Created August 9, 2019 14:54
Show Gist options
  • Save cvoltz/7198bddcf3d1f994cbd1bbec5d3db14a to your computer and use it in GitHub Desktop.
Save cvoltz/7198bddcf3d1f994cbd1bbec5d3db14a to your computer and use it in GitHub Desktop.
Patch to dropbox.py to get the correct PID when running Dropbox via flatpak
--- dropbox.py
+++ dropbox.py
@@ -134,11 +134,12 @@
FatalVisibleError("Platform not supported")
def is_dropbox_running():
- pidfile = os.path.expanduser("~/.dropbox/dropbox.pid")
-
try:
- with open(pidfile, "r") as f:
- pid = int(f.read())
+ pid = subprocess.run("flatpak ps | awk '/dropbox/ { print $2 }'",
+ shell=True, encoding="UTF-8",
+ stdout=subprocess.PIPE)
+ pid = int(pid.stdout.strip())
+
with open("/proc/%d/cmdline" % pid, "r") as f:
cmdline = f.read().lower()
except:
EOF
@cvoltz
Copy link
Author

cvoltz commented Aug 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment