Skip to content

Commit

Permalink
Proposed fix for issue #294 (updated) (#296)
Browse files Browse the repository at this point in the history
* Proposed fix for bug #294


---------

Co-authored-by: Cristiano Guadagnino <criguada+bitbucket@gmail.com>
  • Loading branch information
Cris70 and Cristiano Guadagnino authored May 14, 2024
1 parent 2e52b7d commit f25db23
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion usr/lib/webapp-manager/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ def delete_webbapp(self, webapp):
if os.path.exists(epiphany_orig_prof_dir):
os.remove(epiphany_orig_prof_dir)
shutil.rmtree(os.path.join(EPIPHANY_PROFILES_DIR, "org.gnome.Epiphany.WebApp-%s" % webapp.codename), ignore_errors=True)
falkon_orig_prof_dir = os.path.join(os.path.expanduser("~/.config/falkon/profiles"), webapp.codename)
if os.path.exists(falkon_orig_prof_dir):
os.remove(falkon_orig_prof_dir)
shutil.rmtree(os.path.join(FALKON_PROFILES_DIR, webapp.codename), ignore_errors=True)

def create_webapp(self, name, url, icon, category, browser, custom_parameters, isolate_profile=True, navbar=False, privatewindow=False):
# Generate a 4 digit random code (to prevent name collisions, so we can define multiple launchers with the same name)
Expand All @@ -250,7 +254,7 @@ def create_webapp(self, name, url, icon, category, browser, custom_parameters, i
desktop_file.write("[Desktop Entry]\n")
desktop_file.write("Version=1.0\n")
desktop_file.write("Name=%s\n" % name)
desktop_file.write("Comment=%s\n" % _("Web App"))
desktop_file.write("Comment=%s\n" % gettext.gettext("Web App"))

exec_string = self.get_exec_string(browser, codename, custom_parameters, icon, isolate_profile, navbar,
privatewindow, url)
Expand Down Expand Up @@ -286,6 +290,14 @@ def create_webapp(self, name, url, icon, category, browser, custom_parameters, i
with open(app_mode_file, 'w') as fp:
pass

if browser.browser_type == BROWSER_TYPE_FALKON:
falkon_profile_path = os.path.join(FALKON_PROFILES_DIR, codename)
os.makedirs(falkon_profile_path)
# Create symlink of profile dir at ~/.config/falkon/profiles
falkon_orig_prof_dir = os.path.join(os.path.expanduser("~/.config/falkon/profiles"), codename)
os.symlink(falkon_profile_path, falkon_orig_prof_dir)


def get_exec_string(self, browser, codename, custom_parameters, icon, isolate_profile, navbar, privatewindow, url):
if browser.browser_type in [BROWSER_TYPE_FIREFOX, BROWSER_TYPE_FIREFOX_FLATPAK, BROWSER_TYPE_FIREFOX_SNAP]:
# Firefox based
Expand Down Expand Up @@ -341,6 +353,17 @@ def get_exec_string(self, browser, codename, custom_parameters, icon, isolate_pr
exec_string += " \"" + url + "\""
if custom_parameters:
exec_string += " {}".format(custom_parameters)
elif browser.browser_type == BROWSER_TYPE_FALKON:
# KDE Falkon
exec_string = browser.exec_path
exec_string += " --wmclass=WebApp-" + codename
if isolate_profile:
exec_string += " --profile=" + codename
if privatewindow:
exec_string += " --private-browsing"
if custom_parameters:
exec_string += " {}".format(custom_parameters)
exec_string += " --no-remote " + url
else:
# Chromium based
if isolate_profile:
Expand Down

0 comments on commit f25db23

Please sign in to comment.