-
-
Save janxkoci/b0816c3a94748d313b72a898b245f3b3 to your computer and use it in GitHub Desktop.
Patch to dropbox.py to get the correct PID when running Dropbox via flatpak
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
patch for dropbox flatpak
The original post is here: flathub/com.dropbox.Client#43 (comment)
And the code to apply the patch: