screen_browser_select

Path: /screens/screen_browser_select.py

Overview

This component presents a full-screen UI for selecting the user's preferred web browser and saves the choice to a temporary configuration file.

Purpose & Use Cases

Guide users, on first run or during setup, to choose which installed browser Talon should integrate with.

Allow users to re-select or change their preferred browser by re-running the selection screen.

Dependencies

PyQt5 for the GUI framework (QApplication, QWidget, events).

ui_components package for UIBaseFull, UITitleText, UIHeaderText, UIImage, and UIButton.

Configuration & Parameters

Parameter Type Description Default
None N/A This script does not accept any command-line parameters. N/A

Usage Example

python screen_browser_select.py

Behavior & Implementation

On launch, the script creates a full-screen overlay (UIBaseFull), displays a title "Welcome", a header prompting browser selection, and an image browser_selection.png. It dynamically generates buttons for each supported browser (Chrome, Edge, Brave, Firefox, LibreWolf) with associated colors and labels. A ResizeHandler listens for window resize events to reposition buttons below the image. Clicking a button writes the chosen browser's package ID to browser_choice.json in the system temporary directory and then exits the application.

Error Handling

There is no explicit exception handling around file operations or UI events; uncaught exceptions (e.g., failure to write the JSON file) will propagate and print a traceback to the console.

Security Considerations

Writes user choice to a temporary directory using safe os.makedirs with exist_ok=True. No sensitive input is processed. Ensure the temporary path is secure and not writable by untrusted users if running in a multi-user environment.

Logging

No built-in logging is used; debugging output will appear in the console via default PyQt5 logging of uncaught exceptions.

Testing & Validation

To test, launch the script, verify the UI appears full-screen, resize the window and confirm buttons reposition correctly, click each browser option, and check that browser_choice.json is created with the correct {"browser": <pkg_id>} entry in the temporary talon subdirectory.

Author

Author: Raven Development Team