Skip to content

Commit 37bbad9

Browse files
committed
Fix for Epiphany>=43
Recent versions of Epiphany changed the prefix from `org.gnome.Epiphany.WebApp-` to `org.gnome.Epiphany.WebApp_`, and moved the desktop file under `~/.local/share/xdg-desktop-portal/applications/`. See: https://gitlab.gnome.org/GNOME/epiphany/-/commit/878e2be89508deea76f81454ffc8706ee90b7c06 Closes: #389
1 parent c35fdd9 commit 37bbad9

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

usr/lib/webapp-manager/common.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def wrapper(*args):
5959
WATERFOX_FLATPAK_PROFILES_DIR = os.path.expanduser("~/.var/app/net.waterfox.waterfox/data")
6060
FLOORP_FLATPAK_PROFILES_DIR = os.path.expanduser("~/.var/app/one.ablaze.floorp/data")
6161
EPIPHANY_PROFILES_DIR = os.path.join(ICE_DIR, "epiphany")
62+
EPIPHANY_DESKTOP_DIR = os.path.expanduser("~/.local/share/xdg-desktop-portal/applications/")
6263
FALKON_PROFILES_DIR = os.path.join(ICE_DIR, "falkon")
6364
ZEN_FLATPAK_PROFILES_DIR = os.path.expanduser("~/.var/app/app.zen_browser.zen/data/ice/zen/")
6465
ICONS_DIR = os.path.join(ICE_DIR, "icons")
@@ -157,7 +158,7 @@ def __init__(self, path, codename):
157158
class WebAppManager:
158159

159160
def __init__(self):
160-
for directory in [ICE_DIR, APPS_DIR, PROFILES_DIR, FIREFOX_PROFILES_DIR, FIREFOX_FLATPAK_PROFILES_DIR, ICONS_DIR, EPIPHANY_PROFILES_DIR, FALKON_PROFILES_DIR]:
161+
for directory in [ICE_DIR, APPS_DIR, PROFILES_DIR, FIREFOX_PROFILES_DIR, FIREFOX_FLATPAK_PROFILES_DIR, ICONS_DIR, EPIPHANY_PROFILES_DIR, EPIPHANY_DESKTOP_DIR, FALKON_PROFILES_DIR]:
161162
if not os.path.exists(directory):
162163
os.makedirs(directory)
163164

@@ -252,10 +253,13 @@ def delete_webbapp(self, webapp):
252253
# first remove symlinks then others
253254
if os.path.exists(webapp.path):
254255
os.remove(webapp.path)
255-
epiphany_orig_prof_dir=os.path.join(os.path.expanduser("~/.local/share"), "org.gnome.Epiphany.WebApp-" + webapp.codename)
256+
epiphany_orig_prof_dir=os.path.join(os.path.expanduser("~/.local/share"), "org.gnome.Epiphany.WebApp_" + webapp.codename)
256257
if os.path.exists(epiphany_orig_prof_dir):
257258
os.remove(epiphany_orig_prof_dir)
258-
shutil.rmtree(os.path.join(EPIPHANY_PROFILES_DIR, "org.gnome.Epiphany.WebApp-%s" % webapp.codename), ignore_errors=True)
259+
shutil.rmtree(os.path.join(EPIPHANY_PROFILES_DIR, "org.gnome.Epiphany.WebApp_%s" % webapp.codename), ignore_errors=True)
260+
epiphany_desktop_path = os.path.join(EPIPHANY_DESKTOP_DIR, "org.gnome.Epiphany.WebApp_%s.desktop" % webapp.codename)
261+
if os.path.exists(epiphany_desktop_path):
262+
os.remove(epiphany_desktop_path)
259263
falkon_orig_prof_dir = os.path.join(os.path.expanduser("~/.config/falkon/profiles"), webapp.codename)
260264
if os.path.exists(falkon_orig_prof_dir):
261265
os.remove(falkon_orig_prof_dir)
@@ -297,8 +301,8 @@ def create_webapp(self, name, desc, url, icon, category, browser, custom_paramet
297301

298302
if browser.browser_type == BROWSER_TYPE_EPIPHANY:
299303
# Move the desktop file and create a symlink
300-
epiphany_profile_path = os.path.join(EPIPHANY_PROFILES_DIR, "org.gnome.Epiphany.WebApp-" + codename)
301-
new_path = os.path.join(epiphany_profile_path, "org.gnome.Epiphany.WebApp-%s.desktop" % codename)
304+
epiphany_profile_path = os.path.join(EPIPHANY_PROFILES_DIR, "org.gnome.Epiphany.WebApp_" + codename)
305+
new_path = os.path.join(EPIPHANY_DESKTOP_DIR, "org.gnome.Epiphany.WebApp_%s.desktop" % codename)
302306
os.makedirs(epiphany_profile_path)
303307
os.replace(path, new_path)
304308
os.symlink(new_path, path)
@@ -385,10 +389,10 @@ def get_exec_string(self, browser, codename, custom_parameters, icon, isolate_pr
385389
os.path.join(firefox_profile_path, "chrome", "userChrome.css"))
386390
elif browser.browser_type == BROWSER_TYPE_EPIPHANY:
387391
# Epiphany based
388-
epiphany_profile_path = os.path.join(EPIPHANY_PROFILES_DIR, "org.gnome.Epiphany.WebApp-" + codename)
392+
epiphany_profile_path = os.path.join(EPIPHANY_PROFILES_DIR, "org.gnome.Epiphany.WebApp_" + codename)
389393
# Create symlink of profile dir at ~/.local/share
390394
epiphany_orig_prof_dir = os.path.join(os.path.expanduser("~/.local/share"),
391-
"org.gnome.Epiphany.WebApp-" + codename)
395+
"org.gnome.Epiphany.WebApp_" + codename)
392396
os.symlink(epiphany_profile_path, epiphany_orig_prof_dir)
393397
exec_string = browser.exec_path
394398
exec_string += " --application-mode "

0 commit comments

Comments
 (0)