Updated: Kumo and Welcome

Theys now use FF or LW or Luakit depending on the build type

Signed-off-by: debianpepper <pdpdebdevuan@protonmail.com>
This commit is contained in:
debianpepper 2024-06-21 17:09:24 +09:00
parent e451573a47
commit f48480d39e
3 changed files with 95 additions and 69 deletions

View File

@ -11,7 +11,6 @@ import re
from urllib.parse import urljoin from urllib.parse import urljoin
from tkinter import filedialog from tkinter import filedialog
import sqlite3 import sqlite3
import platform
import tkinter as tk import tkinter as tk
import requests import requests
import ttkbootstrap as ttk import ttkbootstrap as ttk
@ -44,17 +43,23 @@ pcur.execute(""" CREATE TABLE IF NOT EXISTS kumoapp (id integer PRIMARY
KEY AUTOINCREMENT, ssbname text, lnk text);""" KEY AUTOINCREMENT, ssbname text, lnk text);"""
) )
def set_browser(): def determine_browser():
""" """ Determine what browser should be used by kumo"""
Determine the system and set the browser type lwpath = "/home/" + gusr + "/.local/share/pmostools/lw_profile"
""" ffpath = "/home/" + gusr + "/.local/share/pmostools/ff_profile"
architecture = platform.architecture()[0] run_addrs = runaddr_value.get("1.0", 'end-1c').strip()
if '64bit' in architecture: if os.path.exists(lwpath) and os.path.isdir(lwpath):
browser_type = "min" profile_path = os.path.expanduser(f"/home/{gusr}/.local/share/pmostools/lw_profile/")
command = f'librewolf -P kumo --profile "{profile_path}" {run_addrs} &'
print("Found the LW, running LibreWolf")
elif os.path.exists(ffpath) and os.path.isdir(ffpath):
profile_path = os.path.expanduser(f"/home/{gusr}/.local/share/pmostools/ff_profile/")
command = f'firefox -P kumo --profile "{profile_path}" {run_addrs} &'
print("Found the FF, running Firefox")
else: else:
browser_type = "luakit" command = f'luakit -U {run_addrs} &'
return browser_type print("This is a 32bit Flagship with no browser")
return command
def download_favicon(url, output_folder=ipath, request_timeout=3): def download_favicon(url, output_folder=ipath, request_timeout=3):
@ -129,11 +134,15 @@ def make_desktop_file():
get_icon = icon_value.get("1.0", 'end-1c') get_icon = icon_value.get("1.0", 'end-1c')
write_path = dpath + get_name + '.desktop' write_path = dpath + get_name + '.desktop'
selected_category_key = categories_reverse[get_local] selected_category_key = categories_reverse[get_local]
browser_type = set_browser() command = determine_browser()
if not command:
print("No suitable browser found. .desktop file not created")
return
exec_command = f'{command.split("&")[0]} "{get_url}" &'
app_content = f""" app_content = f"""
[Desktop Entry] [Desktop Entry]
Name={get_name} Name={get_name}
Exec={browser_type} -U {get_url} Exec={exec_command}
Icon={get_icon} Icon={get_icon}
Categories={selected_category_key} Categories={selected_category_key}
Type=Application Type=Application
@ -183,13 +192,13 @@ def fill_url_address():
def run_url_address(): def run_url_address():
"""Run the ssb with the run button""" """Run the browser with the appropriate profile and address."""
browser_type = set_browser() command = determine_browser()
run_addrs = runaddr_value.get("1.0", 'end-1c') if command:
command = (
f'{browser_type} -U {run_addrs} &'
)
os.system(command) os.system(command)
else:
print("There no suitebable browser installed!")
def select_icon(): def select_icon():
""" """

View File

@ -7,22 +7,36 @@
* Screen * Screen
""" """
import os.path import os.path
import platform
# This will get the logged in user # This will get the logged in user
gusr = os.getlogin() gusr = os.getlogin()
spath = "/home/" + gusr + "/.local/share/pmostools/peptools" spath = "/home/" + gusr + "/.local/share/pmostools/peptools"
def set_browser(): def determine_browser(run_addrs):
""" """ Determine what browser should be used by kumo"""
Determine the system and set the browser type
""" lwpath = "/home/" + gusr + "/.local/share/pmostools/lw_profile"
architecture = platform.architecture()[0] ffpath = "/home/" + gusr + "/.local/share/pmostools/ff_profile"
if '64bit' in architecture: if os.path.exists(lwpath) and os.path.isdir(lwpath):
browser_type = "min" profile_path = os.path.expanduser(
f"/home/{gusr}/.local/share/pmostools/lw_profile/"
)
command = (
f'librewolf -P kumo --profile "{profile_path}" {run_addrs} &'
)
print("Found the LW, running LibreWolf")
elif os.path.exists(ffpath) and os.path.isdir(ffpath):
profile_path = os.path.expanduser(
f"/home/{gusr}/.local/share/pmostools/ff_profile/"
)
command = (
f'firefox -P kumo --profile "{profile_path}" {run_addrs} &'
)
print("Found the FF, running Firefox")
else: else:
browser_type = "luakit" command = f'luakit -U {run_addrs} &'
return browser_type print("This is a 32bit Flagship with no browser")
return command
def suggested_packages(): def suggested_packages():
@ -32,66 +46,69 @@ def suggested_packages():
def about(): def about():
"""Open the about page""" """Open the about page"""
os.system('min --new-window https://peppermintos.com/about/ &' run_addrs = "https://peppermintos.com/about/"
) command = determine_browser(run_addrs)
if command:
os.system(command)
else:
print("There no suitebable browser installed!")
##SSB's### ##SSB's###
def pep_docs(): def pep_docs():
"""Open Pep Docs""" """Open Pep Docs"""
browser_type = set_browser() run_addrs = "https://peppermint_os.codeberg.page/html/"
url = "https://peppermint_os.codeberg.page/html/" command = determine_browser(run_addrs)
command = ( if command:
f'{browser_type} --new-window {url} &'
)
os.system(command) os.system(command)
else:
print("There no suitebable browser installed!")
# Community Section # Community Section
def mastodon(): def mastodon():
"""Open Mastodon""" """Open Mastodon"""
browser_type = set_browser() run_addrs = "https://fosstodon.org/@peppermintos"
url ="https://fosstodon.org/@peppermintos" command = determine_browser(run_addrs)
command = ( if command:
f'{browser_type} --new-window {url} &'
)
os.system(command) os.system(command)
else:
print("There no suitebable browser installed!")
def code_berg(): def code_berg():
"""Open Codeberg""" """Open Codeberg"""
browser_type = set_browser() run_addrs = "https://codeberg.org/Peppermint_OS"
url ="https://codeberg.org/Peppermint_OS" command = determine_browser(run_addrs)
command = ( if command:
f'{browser_type} --new-window {url} &'
)
os.system(command) os.system(command)
else:
print("There no suitebable browser installed!")
def matrix(): def matrix():
"""Open Matrix""" """Open Matrix"""
browser_type = set_browser() run_addrs = "https://matrix.to/#/!JhPtEbNexzFaoOkvGp:matrix.org?via=matrix.org"
url ="https://matrix.to/#/!JhPtEbNexzFaoOkvGp:matrix.org?via=matrix.org" command = determine_browser(run_addrs)
command = ( if command:
f'{browser_type} --new-window {url} &'
)
os.system(command) os.system(command)
else:
print("There no suitebable browser installed!")
def source_forge(): def source_forge():
"""Open Sourceforge""" """Open Sourceforge"""
browser_type = set_browser() run_addrs = "https://sourceforge.net/p/peppermintos/pepos/"
url ="https://sourceforge.net/p/peppermintos/pepos/" command = determine_browser(run_addrs)
command = ( if command:
f'{browser_type} --new-window {url} &'
)
os.system(command) os.system(command)
else:
print("There no suitebable browser installed!")
def build_date(): def build_date():
"""Open BuildDate wiki""" """Open BuildDate wiki"""
browser_type = set_browser() run_addrs = "https://sourceforge.net/p/peppermintos/pepwiki/BuildDate/"
url ="https://sourceforge.net/p/peppermintos/pepwiki/BuildDate/" command = determine_browser(run_addrs)
command = ( if command:
f'{browser_type} --new-window {url} &'
)
os.system(command) os.system(command)
else:
print("There no suitebable browser installed!")