HyprPanel

repository·master·Indexed 24 days ago

https://github.com/jas-singhfsu/hyprpanel

A customizable panel built for the Hyprland compositor using the Astal framework. It provides a comprehensive shell experience including system monitoring, brightness control, bluetooth management, and a modular bar system with support for custom modules via JSON configuration.

Tokens
36.9K
Snippets
29
Records
250
Agent score
81%

What's inside hyprpanel

  1. Install NerdFonts for HyprPanel Icons

    master

    HyprPanel requires NerdFonts to display icons correctly. You can install the required JetBrainsMono NerdFonts by running the provided script within the HyprPanel directory. If fonts are installed after the panel is already running, you must restart HyprPanel.

    ./scripts/install_fonts.sh
  2. Install HyprPanel from Source

    master

    To build and install HyprPanel from the source repository, use the meson build system. Ensure you have the required dependencies installed first.

    git clone https://github.com/Jas-SinghFSU/HyprPanel.git
    cd HyprPanel
    meson setup build
    meson compile -C build
    meson install -C build
  3. How MediaPlayerService manages media players

    master

    The MediaPlayerService acts as a bridge between the AstalMpris service and the HyprPanel UI.

    1. Player Discovery: It listens to player-added and player-closed events from the MPRIS service.
    2. Filtering: It uses filterPlayers and user-defined ignore lists from the configuration to decide which players to track.
    3. Selection Logic: It selects an activePlayer based on a preferredPlayer setting in the configuration. If no preferred player is found or set, it defaults to the first available non-ignored player.
    4. Reactive Synchronization: When the activePlayer changes, the service automatically re-subscribes to the new player's properties (title, position, status, etc.) using Variable.derive. This ensures that UI bindings always point to the correct data without manual updates.
  4. Manage OSD visibility with OsdRevealerController

    master

    The OsdRevealerController is a singleton class used to manage On-Screen Display (OSD) revealer widgets. It handles the lifecycle of these widgets, including registration, temporary visibility (auto-hiding), and cleanup to prevent stale references.

    Key behaviors:

    • Startup Delay: The controller prevents OSD reveals for the first 3000ms after initialization to ensure system stability.
    • Auto-hide: When show() is called, the widget is revealed and an auto-hide timer is started based on the configured duration.
    • Configuration Dependency: The controller respects the enable and duration settings from options.theme.osd.
  5. Execute script actions via notification action IDs

    master

    Notification actions in HyprPanel support two types of behavior based on their id string:

    1. Script Actions: If the action ID starts with the prefix scriptAction:-, the component treats the remainder of the ID as a shell command and executes it asynchronously using execAsync. After execution, the notification is dismissed.
    2. Standard Actions: For any other ID, the component calls notification.invoke(action.id) to trigger the native notification action and then dismisses the notification.

    Example ID formats:

    • scriptAction:-notify-me (Executes the command notify-me)
    • default-action-id (Invokes the standard notification action via invoke)
  6. Understand WeatherService reactive data flow

    master

    The WeatherService manages data updates through a layered reactive approach using astal's Variable and bind mechanisms:

    1. Configuration Tracking: The service monitors changes to the API key, polling interval, and location via _initializeConfigTracker. If any of these change, the polling mechanism is restarted.
    2. Polling: An internal interval fetches data from the active WeatherProvider using an httpClient.
    3. Data Transformation: Once fetched, the provider's adapter transforms the raw API response into a standard Weather format, which is then set into the _weatherData variable.
    4. Derived State: The _initializeWeatherTracker method uses Variable.derive to watch _weatherData and the user's preferred unit. When the weather data or units change, it automatically recalculates and updates the derived variables like temperature, statusIcon, and gaugeIcon.
  7. Use the WallpaperService to manage desktop wallpapers

    master

    The WallpaperService is a singleton service used to manage desktop wallpapers via the swww daemon. It handles copying wallpaper files to a central configuration directory (~/.config/background) and applying them with transition effects based on the current cursor position.

    Key Features

    • Singleton Pattern: Access the service using WallpaperService.getInstance().
    • Automatic Monitoring: It monitors the wallpaper directory for changes.
    • Transition Effects: When setting a wallpaper, it uses a grow transition effect originating from the user's cursor position.
    • Configuration Integration: The service automatically starts or stops the swww daemon based on the options.wallpaper.enable setting.
  8. Configure Notification Theme settings

    master

    Notification appearance in HyprPanel is controlled via the options.theme.notification configuration object. The following keys are available for customization through the settings UI or direct configuration:

    • background: Color of the notification background.
    • opacity: Opacity level (number, range 0-100).
    • label: Color of the notification label.
    • labelicon: Color of the label icon (does not apply if the icon is an app icon).
    • border: Color of the notification border.
    • time: Color of the timestamp.
    • text: Color of the body text.

    Action Button Settings (buttons within a notification):

    • actions.background: Background color of action buttons.
    • actions.text: Text color of action buttons.

    Dismiss Button Settings (the close button):

    • close_button.background: Background color of the dismiss button.
    • close_button.label: Text color of the dismiss button.