Skip to content

Commit

Permalink
system: Add method to check if an app is installed
Browse files Browse the repository at this point in the history
This is implemented as a workaround for now, checking the output of
the flatpak command.

flatpak/xdg-desktop-portal#283
  • Loading branch information
manuq committed Sep 6, 2019
1 parent cecb30f commit 00e6f25
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions eosclubhouse/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import configparser
import os
import shutil
import subprocess
import time

from eosclubhouse import logger
Expand Down Expand Up @@ -438,6 +439,15 @@ def get_gtk_launch_app_proxy(self):
def is_running(self):
return self.get_gtk_app_proxy().props.g_name_owner is not None

def is_installed(self):
'''Check if the app is installed.
Note: This only works for apps distributed as flatpaks.
'''
result = subprocess.run(['/usr/bin/flatpak-spawn', '--host',
'flatpak', 'info', '--show-ref', self.dbus_name])
return result.returncode == 0

def get_object_property(self, obj, prop):
return self.get_clippy_proxy().Get('(ss)', obj, prop)

Expand Down

0 comments on commit 00e6f25

Please sign in to comment.