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 tkinter import filedialog
import sqlite3
import platform
import tkinter as tk
import requests
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);"""
)
def set_browser():
"""
Determine the system and set the browser type
"""
architecture = platform.architecture()[0]
if '64bit' in architecture:
browser_type = "min"
def determine_browser():
""" Determine what browser should be used by kumo"""
lwpath = "/home/" + gusr + "/.local/share/pmostools/lw_profile"
ffpath = "/home/" + gusr + "/.local/share/pmostools/ff_profile"
run_addrs = runaddr_value.get("1.0", 'end-1c').strip()
if os.path.exists(lwpath) and os.path.isdir(lwpath):
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:
browser_type = "luakit"
return browser_type
command = f'luakit -U {run_addrs} &'
print("This is a 32bit Flagship with no browser")
return command
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')
write_path = dpath + get_name + '.desktop'
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"""
[Desktop Entry]
Name={get_name}
Exec={browser_type} -U {get_url}
Exec={exec_command}
Icon={get_icon}
Categories={selected_category_key}
Type=Application
@ -183,13 +192,13 @@ def fill_url_address():
def run_url_address():
"""Run the ssb with the run button"""
browser_type = set_browser()
run_addrs = runaddr_value.get("1.0", 'end-1c')
command = (
f'{browser_type} -U {run_addrs} &'
)
"""Run the browser with the appropriate profile and address."""
command = determine_browser()
if command:
os.system(command)
else:
print("There no suitebable browser installed!")
def select_icon():
"""

View File

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