From f48480d39edfa7c3bc2b8103bb378b564b1eb84c Mon Sep 17 00:00:00 2001 From: debianpepper Date: Fri, 21 Jun 2024 17:09:24 +0900 Subject: [PATCH] Updated: Kumo and Welcome Theys now use FF or LW or Luakit depending on the build type Signed-off-by: debianpepper --- .../__pycache__/welfunc.cpython-311.pyc | Bin 3574 -> 4986 bytes iso_configs/pmostools/peptools/kumo.py | 49 +++++--- iso_configs/pmostools/peptools/welfunc.py | 115 ++++++++++-------- 3 files changed, 95 insertions(+), 69 deletions(-) diff --git a/iso_configs/pmostools/peptools/__pycache__/welfunc.cpython-311.pyc b/iso_configs/pmostools/peptools/__pycache__/welfunc.cpython-311.pyc index 0ce6dfba8a3cb2ca28334b4a23271b92d6b0270c..80d2d3ad297f46aec21695b029f0ee0dd7e0b042 100644 GIT binary patch literal 4986 zcmds5&2JmW6`$qjk`ie}jxE=zqA{J?pajc;KY^%D1`%Em?dXOuC?4< z%q~r7D+O#JpiU8>J|swh!hjK^agAJj%)ihZ84!p-KtO;Zhu&DYz4+8OL+*-{Ej2-V zD6|?r&di%PAHRL?H;;OlNW>95$@A6XH^T`1jW@g}(5pPT1C>t^LCc6pB%n*nfdHa` z+d*&Omr(i2YoO&23DS@YZ6f4yn1naca)d-cMoAQ;Ok|KT5(610agak~2;?vs2ALoU zkVz6)Lg}RYb$k+EsXAqo&EV7`wPtBvQ;k7o@J7v|uDx+O}(PYp=@hz$s%nF62mkNwhBmQ@e$imZzQig8D#Y$E; z3#zWzWw2GO3hdi7bz6axh)O~7Aw(z)b&l_o_u(x7_L9@56xas1+>oB52?|ZX@!lVd zyY1H>_;0OmLbNV@39EnQ?|{9(hjpmm%Bw$PePs`8eyV4l!4v!myykvza5o!45?&92 zCbEt|M(>9=LQZ05A|eltmyq%C9y@sc=>voIKl1dut^d2z$DVWg_`atf8r(gc{sICO|-kx8>E7gk0IF4>=FPGM9 zIS5A{MthGb7X2|N|MNVGJFaVaMr)>C#F<6037pCFR>3JZkiu>NpK>SW%&GxV3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KNT8#jIZ1`4X(So!QCjAxg zcyGc8hfLnB2U};eTBK4Q#oIF$#kg+;^{0rX;Zsb6babTmeyQ6ZI|3Ca;Nho1n&@{u zzIJPU;n9W7jPdyLX6F2+KCz`wY;1o4u((7gT( zq9d7y`!R3-gSIpjOTUPtSOWa1wy7W6(vNL)@BatcI~FXnn0n!vF4-#O?V>zoHS@|p zy^S3M!`T?fEITfeVnuz4mfPu&orJpcqW)!C1NlQs>w3q}!qZ(^JvGTwfhi52|Dz8q%`A;%HPah^63=@m)NG_}UxmwTA8B0vutDWqZ*MKRh@=@xIw>eh`|e zviMjDiv#mn;8@(3W#Qkl%#K8flGuz&r6>XWo;cmKH?stMC`#5y;LsWzJ@s0HGbRpt z?F~* gLOn@o3YDmUZ50my_vivR!s diff --git a/iso_configs/pmostools/peptools/kumo.py b/iso_configs/pmostools/peptools/kumo.py index 90ee01ca..73c0e0c4 100755 --- a/iso_configs/pmostools/peptools/kumo.py +++ b/iso_configs/pmostools/peptools/kumo.py @@ -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} &' - ) - os.system(command) + """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(): """ diff --git a/iso_configs/pmostools/peptools/welfunc.py b/iso_configs/pmostools/peptools/welfunc.py index 30e41f19..6d76abc4 100644 --- a/iso_configs/pmostools/peptools/welfunc.py +++ b/iso_configs/pmostools/peptools/welfunc.py @@ -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} &' - ) - os.system(command) + 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} &' - ) - os.system(command) + 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} &' - ) - os.system(command) + 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} &' - ) - os.system(command) - + 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} &' - ) - os.system(command) + 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} &' - ) - os.system(command) + 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!")