Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposed fix for issue #294 #295

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion usr/lib/webapp-manager/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,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 @@ -246,7 +250,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 @@ -282,6 +286,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]:
# Firefox based
Expand Down Expand Up @@ -332,6 +344,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