Skip to main content

SDK für Pinguin Browser Addons

Project description

🐧 Pinguin Browser SDK

SDK für die Entwicklung von Addons für den Pinguin Browser.

Installation

pip install pinguinbrowser-sdk

Addon erstellen

1. Python-Datei schreiben

Erstelle eine my_addon.py:

import pinguinbrowser_sdk

# Browser-API holen
browser = pinguinbrowser_sdk.get_browser()
api = pinguinbrowser_sdk.BrowserAPI(browser)

# Beispiel: Tab erstellen
def create_google_tab():
    api.create_tab("https://google.com")
    api.show_notification("Google Tab erstellt!", "success")

# Beispiel: Alle Tabs auflisten
def list_tabs():
    count = api.get_tab_count()
    api.show_notification(f"Du hast {count} Tabs offen", "info")

# Addon-Initialisierung
api.show_notification("Mein Addon wurde geladen!", "success")
create_google_tab()

2. Addon builden

pinguinbrowser --build

Dies öffnet ein GUI-Fenster wo du:

  • Deine Python-Datei auswählst
  • Name, Autor, Version und Beschreibung eingibst
  • Auf "Addon erstellen" klickst

Es wird eine .pbcl Datei erstellt.

3. Addon installieren

  1. Kopiere die .pbcl Datei in den addons Ordner deines Browsers
  2. Starte den Browser neu
  3. Gehe zu Einstellungen → Addons
  4. Dein Addon ist jetzt sichtbar und kann aktiviert/deaktiviert werden

API-Referenz

Browser API

from pinguinbrowser_sdk import BrowserAPI, get_browser

browser = get_browser()
api = BrowserAPI(browser)

Tab Management

# Neuen Tab erstellen
api.create_tab(url="https://example.com", incognito=False, make_active=True)

# Tab schließen
api.close_tab(index=0)  # None = aktueller Tab

# Aktuellen Tab holen
tab = api.get_current_tab()

# Tab-Anzahl
count = api.get_tab_count()

# Zu Tab wechseln
api.switch_to_tab(2)

# Tab-URL holen
url = api.get_tab_url(index=0)

# Zu URL navigieren
api.navigate_to("https://github.com", index=None)

# Tab neu laden
api.reload_tab(index=None)

# JavaScript ausführen
api.execute_javascript("alert('Hello from Addon!');")

Benachrichtigungen

api.show_notification("Nachricht", level="info")  # info, success, error, action

Einstellungen

# Lesen
value = api.get_setting("key", default="default_value")

# Schreiben
api.set_setting("my_addon_setting", "value")

Storage (Addon-Daten)

# Speichern
api.store_data("my_key", {"data": "value"})

# Laden
data = api.load_data("my_key", default={})

Verlauf & Cookies

# Verlauf abrufen
history = api.get_history(limit=100)

# Verlauf löschen
api.clear_history()

# Cookies abrufen
cookies = api.get_cookies()

# Cookies löschen
api.clear_cookies()

UI Interaktion

# Sidebar öffnen/schließen
api.show_sidebar()
api.hide_sidebar()

# URL-Bar
text = api.get_url_bar_text()
api.set_url_bar_text("https://example.com")

Downloads

# Download-Liste
downloads = api.get_downloads()

# Downloads löschen
api.clear_downloads()

Tab-Gruppen

# Gruppe erstellen
group_id = api.create_group("Meine Gruppe", color="#ff0000")

# Alle Gruppen
groups = api.get_groups()

Lesezeichen

# Lesezeichen hinzufügen
api.add_bookmark("https://example.com", title="Example")

# Alle Lesezeichen
bookmarks = api.get_bookmarks()

Theme

# Dark Mode umschalten
api.toggle_dark_mode()

# Prüfen ob Dark Mode aktiv
is_dark = api.is_dark_mode()

Screenshots

# Screenshot erstellen
api.take_screenshot()

Beispiel-Addons

Auto-Refresh Addon

import pinguinbrowser_sdk
import threading
import time

api = pinguinbrowser_sdk.BrowserAPI(pinguinbrowser_sdk.get_browser())

def auto_refresh():
    while True:
        time.sleep(60)  # Alle 60 Sekunden
        api.reload_tab()
        api.show_notification("Tab aktualisiert", "info")

# Thread starten
thread = threading.Thread(target=auto_refresh, daemon=True)
thread.start()

api.show_notification("Auto-Refresh Addon gestartet", "success")

YouTube Shortcuts Addon

import pinguinbrowser_sdk

api = pinguinbrowser_sdk.BrowserAPI(pinguinbrowser_sdk.get_browser())

# YouTube-Tab erstellen
def open_youtube():
    api.create_tab("https://youtube.com")
    api.show_notification("YouTube geöffnet", "success")

open_youtube()

Dark Mode Scheduler

import pinguinbrowser_sdk
import datetime
import threading
import time

api = pinguinbrowser_sdk.BrowserAPI(pinguinbrowser_sdk.get_browser())

def check_time():
    while True:
        hour = datetime.datetime.now().hour
        
        # 18-6 Uhr: Dark Mode
        if hour >= 18 or hour < 6:
            if not api.is_dark_mode():
                api.toggle_dark_mode()
        # 6-18 Uhr: Light Mode
        else:
            if api.is_dark_mode():
                api.toggle_dark_mode()
        
        time.sleep(3600)  # Jede Stunde prüfen

thread = threading.Thread(target=check_time, daemon=True)
thread.start()

api.show_notification("Dark Mode Scheduler aktiv", "success")

Lizenz

MIT License

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pinguinbrowser_sdk-1.0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pinguinbrowser_sdk-1.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file pinguinbrowser_sdk-1.0.tar.gz.

File metadata

  • Download URL: pinguinbrowser_sdk-1.0.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for pinguinbrowser_sdk-1.0.tar.gz
Algorithm Hash digest
SHA256 2634e43e55f81251c2e0bba315e5979463ca067ca526c5d2727ce8fee003e33b
MD5 a67feb881c1d76ee711ffdb7794320f7
BLAKE2b-256 f575a1a27ed1e3cbad2f07b66a37949c9daa4a618f8b433e509d09da422305e6

See more details on using hashes here.

File details

Details for the file pinguinbrowser_sdk-1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pinguinbrowser_sdk-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e2b5b3490a17b0ed85a2a31dce915e047081757b12422302da69d0cbc9151e1d
MD5 54be789da9f06b903a046b9e7c8f7edf
BLAKE2b-256 a392ffe4147f8391cb5f3e1cd83c491e44dfaa279f2d718418c4fb0f7c2b74e7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page