### HTTP GET Request Example Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/utility-helpers.md Shows how to perform an HTTP GET request to fetch weather data using the httpClient utility. ```typescript import { httpClient } from 'src/lib/httpClient'; const weather = await httpClient.get( 'https://api.weatherapi.com/v1/current.json', { params: { q: 'New York' } } ); ``` -------------------------------- ### Build HyprPanel with Meson Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/00-overview.md Compile and install HyprPanel using the Meson build system. Ensure you have the necessary dependencies installed before building. ```bash meson setup build meson compile -C build meson install -C build ``` -------------------------------- ### Install Optional Dependencies with Pip Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/README.md Installs necessary Python packages like gpustat and pywal using pip. Ensure Python and pip are installed first. ```bash sudo dnf install python python3-pip; pip install gpustat pywal ``` -------------------------------- ### MediaPlayerService getInstance Example Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/network-media-services.md Demonstrates how to get the singleton instance of MediaPlayerService and access its active player state. ```typescript import { MediaPlayerService } from 'src/services/media'; const mediaService = MediaPlayerService.getInstance(); const activePlayer = mediaService.activePlayer.get(); ``` -------------------------------- ### Example: Set OpenWeatherMap Provider Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/weather-service.md Example of how to set the 'openweathermap' provider for the WeatherService. Ensure the providerId is valid. ```typescript weatherService.setProvider('openweathermap'); ``` -------------------------------- ### Example Usage of CpuUsageService Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/system-services.md Demonstrates how to instantiate, initialize, and bind to the CPU usage service. ```typescript import CpuUsageService from 'src/services/system/cpuUsage'; import { bind } from 'astal'; const cpuService = new CpuUsageService({ frequency: Variable(2000) }); cpuService.initialize(); const cpuUsage = bind(cpuService.cpu); // cpuUsage is a number 0-100 ``` -------------------------------- ### Example: Using RamUsageService Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/system-services.md Demonstrates how to instantiate and use the RamUsageService to access reactive RAM data. ```typescript import RamUsageService from 'src/services/system/ramUsage'; import { bind } from 'astal'; const ramService = new RamUsageService({ frequency: Variable(1000) }); ramService.initialize(); const ramData = bind(ramService.ram); // ramData contains: { total: ..., used: ..., free: ..., percentage: ... } ``` -------------------------------- ### NetworkService getInstance Example Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/network-media-services.md Demonstrates how to obtain the singleton instance of NetworkService and access its WiFi and Ethernet managers. ```typescript import { NetworkService } from 'src/services/network'; const networkService = NetworkService.getInstance(); const wifiManager = networkService.wifi; const ethernetManager = networkService.ethernet; ``` -------------------------------- ### Clone and Build HyprPanel Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/README.md Clones the HyprPanel repository, sets up the build environment using Meson, compiles the project, and installs it. ```bash git clone https://github.com/Jas-SinghFSU/HyprPanel.git cd HyprPanel Meson setup build Meson compile -C build Meson install -C build ``` -------------------------------- ### Example: Set Wallpaper CLI Execution Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/cli-commands.md Demonstrates how to execute the 'setWallpaper' command using the runCLI function, specifying the image path. ```shell runCLI('setWallpaper "/home/user/Pictures/wallpaper.png"', console.log); ``` -------------------------------- ### Install HyprPanel from AUR Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/README.md Use this command to install HyprPanel if you are an Arch Linux user and have yay installed. ```bash yay -S ags-hyprpanel-git ``` -------------------------------- ### Example: Use Theme CLI Execution Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/cli-commands.md Demonstrates how to execute the 'useTheme' command using the runCLI function, specifying the theme file path. ```shell runCLI('useTheme "/home/user/.config/hyprpanel/theme.json"', console.log); ``` -------------------------------- ### RamUsageService initialize Method Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/system-services.md Starts the RAM usage monitoring service. ```typescript public initialize(): void ``` -------------------------------- ### Instantiate and Get Temperature from WeatherService Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/weather-service.md Demonstrates how to get the singleton instance of WeatherService and retrieve the current temperature. Ensure the service is imported correctly. ```typescript import WeatherService from 'src/services/weather'; const weatherService = WeatherService.getInstance(); const currentTemp = weatherService.temperature.get(); ``` -------------------------------- ### Execute mediaPlayerPrev Command Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/cli-commands.md Example of how to execute the 'mediaPlayerPrev' command using the runCLI function. The result is passed to console.log. ```typescript runCLI('mediaPlayerPrev', console.log); ``` -------------------------------- ### Simple Polling Example Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/poller-system.md Demonstrates a simple polling pattern using FunctionPoller to fetch data periodically. Includes initialization, starting, stopping, and updating the interval. ```typescript import { FunctionPoller } from 'src/lib/poller/FunctionPoller'; import { Variable, bind } from 'astal'; const result = Variable(defaultData); const interval = Variable(2000); const poller = new FunctionPoller( result, [bind(interval)], bind(interval), async () => { return await fetchData(); } ); poller.initialize('dataFetcher'); poller.start(); // Later, to update data poller.stop(); interval.set(5000); // Change interval poller.start(); // Resume with new interval ``` -------------------------------- ### Install HyprPanel Dependencies on Arch Linux Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/README.md Install HyprPanel and its dependencies on Arch Linux using yay. This command includes both required and common optional packages. ```bash yay -S --needed aylurs-gtk-shell-git wireplumber libgtop bluez bluez-utils btop networkmanager dart-sass wl-clipboard brightnessctl swww python upower pacman-contrib power-profiles-daemon gvfs gtksourceview3 libsoup3 grimblast-git wf-recorder-git hyprpicker matugen-bin python-gpustat hyprsunset-git ``` -------------------------------- ### NetworkService getWifiIcon Example Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/network-media-services.md Shows how to use the getWifiIcon method to retrieve specific or default WiFi icons. ```typescript const icon = networkService.getWifiIcon('excellent'); const defaultIcon = networkService.getWifiIcon(); // Returns '󰤫' ``` -------------------------------- ### Install Sass using npm Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/README.md Install the Sass compiler globally using npm. This is required for HyprPanel's styling if you are on Fedora and using npm. ```bash npm install -g sass ``` -------------------------------- ### Auto-start HyprPanel with Hyprland Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/README.md Adds HyprPanel to the Hyprland configuration file to ensure it starts automatically when the desktop environment launches. ```bash exec-once = hyprpanel ``` -------------------------------- ### Launch HyprPanel Manually Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/README.md Command to run the HyprPanel application from the terminal after installation. ```bash hyprpanel ``` -------------------------------- ### Handle Monitor Change Example Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/display-services.md Illustrates how to use the `handleMonitorChange` method of `BarRefreshManager` in response to Hyprland's monitor add/remove events. ```typescript const hyprland = AstalHyprland.get_default(); hyprland.connect('monitor-added', () => barRefreshManager.handleMonitorChange('added') ); hyprland.connect('monitor-removed', () => barRefreshManager.handleMonitorChange('removed') ); ``` -------------------------------- ### Required Dependencies for HyprPanel Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/README.md These are the essential dependencies required for HyprPanel to run. Installation will fail without them. ```bash aylurs-gtk-shell-git wireplumber libgtop networkmanager dart-sass wl-clipboard upower gvfs gtksourceview3 libsoup3 ``` -------------------------------- ### Monitor Service Usage Example Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/display-services.md Demonstrates how to use the `forMonitors` helper function to create Bar components for each connected monitor. ```typescript // Bars are created for each monitor using forMonitors helper import { forMonitors } from 'src/components/bar/utils/monitors'; import { Bar } from 'src/components/bar'; const bars = await forMonitors(Bar); // Creates Bar component for each connected monitor ``` -------------------------------- ### Install HyprPanel Dependencies on Fedora Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/README.md Install HyprPanel dependencies on Fedora using DNF. This includes core components and some optional packages like grimblast and hyprpicker. ```bash sudo dnf install wireplumber upower libgtop2 bluez bluez-tools grimblast hyprpicker btop NetworkManager wl-clipboard swww brightnessctl gnome-bluetooth aylurs-gtk-shell power-profiles-daemon gvfs nodejs wf-recorder ``` -------------------------------- ### Install Nerd Fonts for Icons Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/README.md Installs the JetBrainsMono Nerd Fonts, which are required for displaying icons within HyprPanel. Run this script from the HyprPanel's scripts directory. ```bash # Installs the JetBrainsMono NerdFonts used for icons ./scripts/install_fonts.sh ``` -------------------------------- ### Accessing Configuration in Services Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/configuration.md Retrieve configuration values in services by importing options and using the '.get()' method. This example shows how to access and use specific media player settings. ```typescript import options from 'src/configuration'; const { noMediaText, ignore, preferredPlayer } = options.menus.media; const placeholder = noMediaText.get(); const ignoredPlayers = ignore.get(); ``` -------------------------------- ### SystemUtilities.checkLibrary Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/system-services.md Checks if any of the specified libraries are installed on the system using `ldconfig`. ```APIDOC ## SystemUtilities.checkLibrary ### Description Checks if any of the given libraries is installed. ### Method `static checkLibrary(libraries: string[]): boolean` ### Parameters #### Path Parameters - **libraries** (string[]) - Required - Array of library names to check ### Return Type `boolean` — true if any library found ### Description Uses `ldconfig -p | grep` to check library availability. ``` -------------------------------- ### Execute mprisPlayers Command Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/cli-commands.md Example of how to execute the 'mprisPlayers' command using the runCLI function. The result is passed to console.log. ```typescript runCLI('mprisPlayers', console.log); ``` -------------------------------- ### Temperature Conversion Example Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/utility-helpers.md Demonstrates converting temperatures between Celsius and Fahrenheit using the TemperatureConverter class. ```typescript import { TemperatureConverter } from 'src/lib/units/temperature'; const temp = TemperatureConverter.fromCelsius(22); console.log(temp.formatFahrenheit()); // "71.6°F" console.log(temp.formatCelsius()); // "22°C" ``` -------------------------------- ### Example: Log Weather Location and Temperature Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/weather-service.md Shows how to access and log the location name and current temperature from the weatherData object. Assumes weatherService is initialized. ```typescript const weather = weatherService.weatherData.get(); console.log(weather.location.name); // Location name console.log(weather.current.temperature); // Current temperature ``` -------------------------------- ### MediaPlayerService.getInstance Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/network-media-services.md Gets the singleton instance of MediaPlayerService. Automatically initializes on first call. ```APIDOC ## MediaPlayerService.getInstance ### Description Gets the singleton instance of MediaPlayerService. Automatically initializes on first call. ### Method Static method call ### Parameters None ### Return Type MediaPlayerService — Singleton instance ### Example ```typescript import { MediaPlayerService } from 'src/services/media'; const mediaService = MediaPlayerService.getInstance(); ``` ``` -------------------------------- ### Example: Render Temperature Gauge with Color Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/weather-service.md Demonstrates rendering a temperature gauge using the icon and color class obtained from gaugeIcon. Colors indicate temperature extremes. ```typescript const gauge = weatherService.gaugeIcon.get(); // Colors: 'weather-color red' (hot), 'weather-color blue' (cold) ``` -------------------------------- ### System Information with BashPoller Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/poller-system.md Example demonstrating how to use BashPoller to retrieve system information. It sets up a poller to execute a bash command and update a variable with the output periodically. ```typescript import { BashPoller } from 'src/lib/poller/BashPoller'; import { Variable, bind } from 'astal'; const systemInfo = Variable(''); const updateInterval = Variable(5000); const poller = new BashPoller( systemInfo, [bind(updateInterval)], bind(updateInterval), 'lsb_release -d | cut -f 2' ); poller.initialize(); poller.start(); // systemInfo will be updated with distro name every 5 seconds ``` -------------------------------- ### HyprPanel Configuration File Format Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/configuration.md Example JSON structure for the HyprPanel configuration file, typically located at `~/.config/hyprpanel/options.json`. This file persists application settings. ```json { "hyprpanel": { "useLazyLoading": true }, "menus": { "volume": { "raiseMaximumVolume": false }, "media": { "noMediaText": "No media", "ignore": [], "preferredPlayer": "" } } } ``` -------------------------------- ### Execute Command Synchronously with GLib Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/core-types-errors.md Use `GLib.spawn_command_line_sync()` to execute shell commands and get their output synchronously. ```typescript GLib.spawn_command_line_sync() ``` -------------------------------- ### Setup Monitor Handlers Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/initialization-service.md Sets up event handlers for monitor changes to refresh bars when monitors are added or removed. Connects to Hyprland's monitor events. ```typescript private static _setupMonitorHandlers(): void ``` -------------------------------- ### Size Conversion Example Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/utility-helpers.md Demonstrates converting byte values to other size units like MiB and Bytes using the SizeConverter class. ```typescript import { SizeConverter } from 'src/lib/units/size'; const size = SizeConverter.fromBytes(1048576); console.log(size.formatMiB()); // "1.00 MiB" console.log(size.formatBytes()); // "1048576 B" ``` -------------------------------- ### Using Astal Variables for Options Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/configuration.md Provides examples of interacting with Astal Variables, which are used for HyprPanel options. Demonstrates reading with `.get()`, writing with `.set()`, and creating reactive UI bindings using `.bind()` and `.as()` for transformations. ```typescript const location = options.menus.clock.weather.location; // Read const currentLocation = location.get(); // Write location.set('New York'); // Bind to UI // Transform bind(location).as(loc => `Weather for ${loc}`) ``` -------------------------------- ### Example: Display Weather Status Icon Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/weather-service.md Shows how to bind the statusIcon variable to a label for displaying weather condition icons like sunny, cloudy, or rainy. ```typescript // Displays: 󰖙 (sunny), 󰖐 (cloudy), 󰖗 (rainy), etc. ``` -------------------------------- ### Enable Hyprland and Matugen COPR Repositories on Fedora Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/README.md Enable the necessary COPR repositories on Fedora to install Hyprland-related packages and Matugen. Prioritize the solopasha/hyprland repo for swww. ```bash sudo dnf copr enable solopasha/hyprland sudo dnf copr enable heus-sueh/packages sudo dnf config-manager --save --setopt=copr:copr.fedorainfracloud.org:heus-sueh:packages.priority=200 ``` -------------------------------- ### NetworkService.getInstance Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/network-media-services.md Gets the singleton instance of NetworkService. Creates instance on first call and returns same instance on subsequent calls. ```APIDOC ## NetworkService.getInstance ### Description Gets the singleton instance of NetworkService. Creates instance on first call and returns same instance on subsequent calls. ### Method Static method call ### Parameters None ### Return Type NetworkService — Singleton instance ### Example ```typescript import { NetworkService } from 'src/services/network'; const networkService = NetworkService.getInstance(); ``` ``` -------------------------------- ### Path Helpers Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/utility-helpers.md Provides utilities for working with file paths and directories, including expanding paths and getting standard directory locations. ```APIDOC ## Module: Path Helpers Provides utilities for working with file paths and directories. ### Function: expandPath Expands tilde and environment variables in paths. ```typescript export function expandPath(path: string): string ``` **Parameters**: - **path** (string) - Required - Path potentially containing ~ or $VARS **Return Type**: `string` — Expanded absolute path **Example**: ```typescript import { expandPath } from 'src/lib/path/helpers'; const configPath = expandPath('~/.config/hyprpanel'); const customPath = expandPath('$HOME/Documents/themes'); ``` ### Function: getConfigDir Gets HyprPanel configuration directory. ```typescript export function getConfigDir(): string ``` **Return Type**: `string` — Absolute path to config directory (typically ~/.config/hyprpanel) ### Function: getCacheDir Gets HyprPanel cache directory. ```typescript export function getCacheDir(): string ``` **Return Type**: `string` — Absolute path to cache directory ### Function: getDataDir Gets HyprPanel data directory. ```typescript export function getDataDir(): string ``` **Return Type**: `string` — Absolute path to data directory ``` -------------------------------- ### Get Bar Visibility Example Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/display-services.md Retrieves the visibility state of a specific bar. Returns true by default if the state has not been explicitly set. ```typescript import { BarVisibility } from 'src/services/display/bar'; const isVisible = BarVisibility.get('notification-center'); console.log(isVisible); // true or false ``` -------------------------------- ### Run HyprPanel Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/00-overview.md Execute HyprPanel from the command line or add it to your Hyprland configuration for automatic startup. ```bash hyprpanel # Or in Hyprland config: exec-once = hyprpanel ``` -------------------------------- ### BarRefreshManager.getInstance Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/display-services.md Gets the singleton instance of BarRefreshManager. This instance is used to manage bar updates when monitors are added or removed. ```APIDOC ## BarRefreshManager.getInstance ### Description Gets the singleton instance of BarRefreshManager. ### Method GET (conceptual) ### Endpoint N/A (Class method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```typescript const barRefreshManager = BarRefreshManager.getInstance(); ``` ### Response #### Success Response (200) - **return value** (BarRefreshManager) - Singleton instance of BarRefreshManager #### Response Example ```json { "instance": "BarRefreshManager" } ``` ``` -------------------------------- ### Example: Display Temperature using Bind Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/weather-service.md Illustrates binding the reactive temperature variable to a label for display. The output will be a formatted string like '72°F' or '22°C'. ```typescript // Displays: "72°F" or "22°C" ``` -------------------------------- ### Define listWindows CLI Command Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/cli-commands.md Defines the 'listWindows' command to retrieve a newline-separated list of all HyprPanel windows. Use this to get an overview of available windows. ```typescript { name: 'listWindows', aliases: ['lw'], description: 'Gets a list of all HyprPanel windows.', category: 'Window Management', args: [], handler: () => string } ``` -------------------------------- ### Set Bar Visibility Example Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/display-services.md Stores the visibility state for a specific bar. This is used to control whether a bar is shown or hidden. ```typescript import { BarVisibility } from 'src/services/display/bar'; BarVisibility.set('notification-center', false); // Hide bar BarVisibility.set('settings-dialog', true); // Show bar ``` -------------------------------- ### Initialize Startup Scripts Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/initialization-service.md Initializes all startup scripts required by the application. Currently executes the Python bluetooth initialization script. ```typescript private static async _initializeStartupScripts(): Promise ``` -------------------------------- ### CPU Monitoring with FunctionPoller Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/poller-system.md Example demonstrating how to use FunctionPoller to monitor CPU usage. It sets up a poller to periodically calculate and update CPU usage, with the update frequency being a trackable dependency. ```typescript import { FunctionPoller } from 'src/lib/poller/FunctionPoller'; import { bind, Variable } from 'astal'; class CpuUsageService { private _updateFrequency: Variable; private _cpu = Variable(0); private _cpuPoller: FunctionPoller; constructor() { this._updateFrequency = Variable(2000); this._cpuPoller = new FunctionPoller( this._cpu, [bind(this._updateFrequency)], bind(this._updateFrequency), () => this._calculateUsage() ); } public initialize(): void { this._cpuPoller.initialize('cpu'); } public updateTimer(timerInMs: number): void { this._updateFrequency.set(timerInMs); } private _calculateUsage(): number { // Calculate and return CPU usage percentage return calculateCPU(); } } ``` -------------------------------- ### Poller Start Method Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/poller-system.md Starts the polling loop, executing the provided function at the configured interval. Use this to begin periodic updates. ```typescript public start(): void ``` -------------------------------- ### RAM Monitoring with FunctionPoller and Parameters Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/poller-system.md Example showing FunctionPoller usage when the polling function requires parameters. It demonstrates passing an API key as a parameter to a data fetching function. ```typescript // If the function needs parameters, include them in the generic class DataFetcher { private _data = Variable({ ...initialValue... }); private _apiKey = Variable(''); private _interval = Variable(5000); private _poller: FunctionPoller; constructor() { this._poller = new FunctionPoller( this._data, [bind(this._apiKey), bind(this._interval)], bind(this._interval), this._fetchData.bind(this), // Function that takes string param this._apiKey.get() // Initial parameter value ); } private async _fetchData(apiKey: string): Promise { return fetch(`/api/data?key=${apiKey}`); } } ``` -------------------------------- ### forMonitors Helper Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/display-services.md Creates a component instance for each connected monitor. This function automatically updates when monitors are added or removed, ensuring components are always in sync with the display setup. ```APIDOC ## forMonitors Helper ### Description Creates a component instance for each connected monitor. Automatically updates when monitors are added/removed. ### Method `async function forMonitors(component: (monitor: Monitor) => T): Promise` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **component** (function) - Required - Component factory function that takes a monitor object and returns a component instance. ### Return Type `Promise` — Array of component instances, one per monitor. ### Example ```typescript import { forMonitors } from 'src/components/bar/utils/monitors'; import { Bar } from 'src/components/bar'; const bars = await forMonitors((monitor) => { return ; }); ``` ``` -------------------------------- ### mkOptions Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/utility-helpers.md Creates and initializes the complete options management system, transforming a nested object into a functional configuration system. ```APIDOC ## Function: mkOptions ### Description Transforms a nested object of options into a fully-functional configuration system with automatic disk persistence, variable binding, and change tracking. ### Signature ```typescript export function mkOptions(optionsObj: T): T & MkOptionsResult ``` ### Parameters #### Parameters - **optionsObj** (OptionsObject) - Required - Object containing option definitions ### Return Type `T & MkOptionsResult` — Enhanced options object with nested options ### Example ```typescript import { mkOptions } from 'src/lib/options'; const options = mkOptions({ appearance: { theme: opt('dark'), fontSize: opt(12), }, notifications: { enabled: opt(true), timeout: opt(5000), } }); // Access options options.appearance.theme.get(); options.notifications.timeout.set(3000); ``` ``` -------------------------------- ### HyprPanel Application Initialization Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/initialization-service.md Performs the complete application initialization sequence, including startup scripts, components, and system behaviors. This method is called automatically during application startup. ```typescript import { InitializationService } from 'src/core/initialization'; // Called automatically by App.start in app.ts await InitializationService.initialize(); ``` -------------------------------- ### CommandRegistry get Method Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/cli-commands.md The get method of the CommandRegistry class. It retrieves a command from the registry using its name or an alias. Returns undefined if the command is not found. ```typescript public get(commandName: string): Command | undefined ``` -------------------------------- ### CPU Monitor with Dynamic Polling Interval Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/poller-system.md A real-world example of a CPU monitor service. It uses a FunctionPoller where the polling interval dynamically adjusts based on a 'high detail' setting, polling more frequently when high detail is enabled. ```typescript class CpuService { private _usage = Variable(0); private _highDetail = Variable(false); private _poller: FunctionPoller; constructor() { this._poller = new FunctionPoller( this._usage, [bind(this._highDetail)], bind(this._highDetail).as(hd => hd ? 500 : 2000), () => calculateCPU() ); } public setHighDetail(enabled: boolean): void { this._highDetail.set(enabled); // Automatically polls faster when enabled } } ``` -------------------------------- ### InitializationService.initialize() Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/initialization-service.md Performs the complete application initialization sequence, executing various components and scripts in a defined order. This method is typically called automatically during application startup. ```APIDOC ## InitializationService.initialize() ### Description Performs the complete application initialization sequence. This method executes a pipeline of steps including startup scripts, component initialization, and system behavior setup, with each step being timed and logged. ### Method `static async initialize(): Promise` ### Parameters None ### Return Type `Promise` - Resolves when the initialization process is complete. ### Description of Initialization Steps: 1. Startup scripts (e.g., Python bluetooth initialization) 2. Notifications component 3. OSD component 4. Bars for all monitors 5. Menu components (standard windows and dropdown menus) 6. System behaviors 7. Monitor change handlers 8. Optional: Settings dialog preload (if lazy loading disabled) ### Throws Catches and logs errors during any initialization step, attempting to continue the process where possible. ### Example ```typescript import { InitializationService } from 'src/core/initialization'; // Called automatically by App.start in app.ts await InitializationService.initialize(); ``` ``` -------------------------------- ### Accessing Configuration Options Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/configuration.md Demonstrates how to import and access various configuration options using the options object. Use `.get()` to read the current value of an option. ```typescript import options from 'src/configuration'; // Access options options.hyprpanel.useLazyLoading.get(); options.menus.media.noMediaText.get(); options.menus.clock.weather.location.get(); ``` -------------------------------- ### Get Distribution Icon Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/system-services.md Retrieves the appropriate icon name for the current Linux distribution. ```typescript public static getDistroIcon(): string ``` -------------------------------- ### Get HyprPanel Data Directory Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/utility-helpers.md Retrieves the absolute path to the HyprPanel data directory. ```typescript import { getDataDir } from 'src/lib/path/helpers'; const dataDir = getDataDir(); ``` -------------------------------- ### Get HyprPanel Cache Directory Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/utility-helpers.md Retrieves the absolute path to the HyprPanel cache directory. ```typescript import { getCacheDir } from 'src/lib/path/helpers'; const cacheDir = getCacheDir(); ``` -------------------------------- ### Check Library Availability Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/system-services.md Checks if any of the specified shared libraries are installed on the system using `ldconfig`. ```typescript public static checkLibrary(libraries: string[]): boolean ``` -------------------------------- ### Accessing and Setting Configuration Options in HyprPanel Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/00-overview.md Demonstrates how to access and set configuration options using the 'options' module. Changes are automatically persisted to the configuration file. ```typescript import options from 'src/configuration'; // Accessing options options.menus.media.preferredPlayer.get(); options.menus.clock.weather.location.set('New York'); // Binding to UI // Changes auto-persist to ~/.config/hyprpanel/options.json ``` -------------------------------- ### Initialize Menu Components Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/initialization-service.md Initializes all menu components, including standard windows and dropdown menus. Sets up event handlers for menu realization. ```typescript private static _initializeMenus(): void ``` -------------------------------- ### BarVisibility Class Definition Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/display-services.md Defines the static methods for getting and setting bar visibility states. ```typescript export class BarVisibility { public static get(barName: string): boolean; public static set(barName: string, isVisible: boolean): void; } ``` -------------------------------- ### Run mediaPlayerNext CLI Command Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/cli-commands.md Executes the 'mediaPlayerNext' command to switch to the next media player and logs the result to the console. Use this to cycle through available media sources. ```javascript runCLI('mediaPlayerNext', console.log); ``` -------------------------------- ### Get Default Option Value Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/utility-helpers.md Retrieves a default option value using the opt helper function. ```typescript const userOption = opt(defaultValue); ``` -------------------------------- ### Initialize Options Management System Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/utility-helpers.md Use `mkOptions` to transform a nested object of options into a functional configuration system. It provides persistence, binding, and change tracking. ```typescript export function mkOptions(optionsObj: T): T & MkOptionsResult ``` ```typescript import { mkOptions } from 'src/lib/options'; const options = mkOptions({ appearance: { theme: opt('dark'), fontSize: opt(12), }, notifications: { enabled: opt(true), timeout: opt(5000), } }); // Access options options.appearance.theme.get(); options.notifications.timeout.set(3000); ``` -------------------------------- ### opt Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/utility-helpers.md Creates an individual option with initial value and automatic disk persistence. Wraps a value in a Variable-like interface. ```APIDOC ## Function: opt ### Description Creates a single option that persists to configuration file. Wraps a value in a Variable-like interface with automatic disk persistence. ### Signature ```typescript export function opt(initial: T, props?: OptProps): Opt ``` ### Parameters #### Parameters - **initial** (T) - Required - Initial value for the option - **props** (OptProps) - Optional - Configuration properties ### Return Type `Opt` — Option wrapper object supporting get/set and persistence ### Example ```typescript import { opt } from 'src/lib/options'; const fontSize = opt(12); const themeName = opt('dark'); ``` ``` -------------------------------- ### Get HyprPanel Configuration Directory Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/utility-helpers.md Retrieves the absolute path to the HyprPanel configuration directory, typically located at ~/.config/hyprpanel. ```typescript import { getConfigDir } from 'src/lib/path/helpers'; const configDir = getConfigDir(); ``` -------------------------------- ### Check Multiple Dependencies Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/system-services.md Verifies if all specified command-line binaries are available in the system's PATH. Logs a warning if any are missing. ```typescript const allFound = SystemUtilities.checkDependencies('ffmpeg', 'imagemagick', 'git'); if (!allFound) { console.warn('Some dependencies missing'); } ``` -------------------------------- ### Get WeatherService Singleton Instance Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/weather-service.md Retrieves the singleton instance of the WeatherService. Initializes configuration tracking on the first call. ```typescript public static getInstance(): WeatherService ``` -------------------------------- ### Get User Cache Directory with GLib Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/core-types-errors.md Retrieve the path to the user's cache directory using `GLib.get_user_cache_dir()`. ```typescript GLib.get_user_cache_dir() ``` -------------------------------- ### Defining Menu Specific Options Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/configuration.md Illustrates the configuration structure for various menu-specific settings, including volume controls, media player preferences, and clock/weather configurations. Options like `raiseMaximumVolume`, `noMediaText`, and `location` can be defined here. ```typescript options.menus { volume: { raiseMaximumVolume: Variable // Allow volume > 100% } media: { noMediaText: Variable // Placeholder when nothing playing ignore: Variable // Ignored player IDs preferredPlayer: Variable // Preferred MPRIS player } clock: { weather: { interval: Variable // Polling interval (ms) location: Variable // Weather location unit: Variable<'metric'|'imperial'> // Temperature unit } } } ``` -------------------------------- ### Poller Initialize Method Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/poller-system.md Initializes the poller and starts the first poll immediately. Accepts an optional module name for logging. ```typescript public initialize(moduleName?: BarModule): void ``` -------------------------------- ### HyprPanel CLI Test Commands Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/00-overview.md A collection of command-line interface commands for testing and interacting with HyprPanel. These commands cover listing windows, checking window visibility, system tray items, CPU sensors, dependencies, and media players. ```bash # List all windows hyprpanel lw # Check if window visible hyprpanel iwv settings-dialog # Get system tray items hyprpanel sti # List CPU sensors hyprpanel lcs # Check dependencies hyprpanel chd # List media players hyprpanel mpl ``` -------------------------------- ### HyprPanel CLI Commands Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/00-overview.md A comprehensive list of HyprPanel's command-line interface commands for various functionalities like window management, volume control, theming, system info, and media control. ```bash # Window management hyprpanel t settings-dialog # Volume control hyprpanel vol 10 # Theme/wallpaper hyprpanel sw /path/to/image.png hyprpanel ut /path/to/theme.json # System info hyprpanel chd # Check dependencies hyprpanel lcs # List CPU sensors hyprpanel sti # System tray items # Media control hyprpanel pp # Play/Pause hyprpanel pln # Next track hyprpanel mpl # List players # Panel control hyprpanel r # Restart hyprpanel q # Quit ``` -------------------------------- ### Get Active Player Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/network-media-services.md Retrieves the currently active media player. Use this to access player-specific information like its identity. ```typescript const player = mediaService.activePlayer.get(); if (player) { console.log(player.identity); // Player name } ``` -------------------------------- ### Get Rain Probability Percentage Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/weather-service.md Retrieves the probability of rain as a percentage (0-100). Useful for conditional logic related to precipitation. ```typescript public get rainChance(): Variable ``` -------------------------------- ### BarVisibility.get Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/display-services.md Gets the visibility state of a specific bar. It returns true by default for bars that have never had their visibility explicitly set. ```APIDOC ## BarVisibility.get ### Description Gets the visibility state of a specific bar. ### Method GET (conceptual) ### Endpoint N/A (Class method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```typescript import { BarVisibility } from 'src/services/display/bar'; const isVisible = BarVisibility.get('notification-center'); console.log(isVisible); // true or false ``` ### Response #### Success Response (200) - **return value** (boolean) - true if visible, false if hidden (defaults to true if not set) #### Response Example ```json true ``` ``` -------------------------------- ### Optional Dependencies for HyprPanel Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/README.md These dependencies provide additional features and integrations for HyprPanel, such as GPU usage tracking, brightness control, Bluetooth support, and theming. ```bash ## Used for Tracking GPU Usage in your Dashboard (NVidia only) python python-gpustat ## Used for Tracking GPU Usage in your Dashboard (Amd only) amdgpu_top ## To control screen/keyboard brightness brightnessctl ## For bluetooth support bluez bluez-utils ## Only if a pywal hook from wallpaper changes applied through settings is desired pywal ## To check for pacman updates in the default script used in the updates module pacman-contrib ## To switch between power profiles in the battery module power-profiles-daemon ## To take snapshots with the default snapshot shortcut in the dashboard grimblast ## To record screen through the dashboard record shortcut wf-recorder ## To enable the eyedropper color picker with the default snapshot shortcut in the dashboard hyprpicker ## To enable hyprland's very own blue light filter hyprsunset ## To click resource/stat bars in the dashboard and open btop btop ## To enable matugen based color theming matugen ## To enable matugen based color theming and setting wallpapers swww ``` -------------------------------- ### Run listCpuSensors CLI Command Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/cli-commands.md Executes the 'listCpuSensors' command and logs the list of CPU sensors to the console. Use this to check available temperature monitoring points. ```javascript runCLI('listCpuSensors', console.log); ``` -------------------------------- ### Creating the Central Options Object Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/configuration.md Shows how to use the `mkOptions` function to create the main options registry by combining various configuration modules. This function takes an `OptionsConfig` object and returns an `OptionsRegistry`. ```typescript import { mkOptions } from 'src/lib/options'; import theme from './modules/theme'; import config from './modules/config'; const options = mkOptions({ theme: theme, ...config, }); export default options; ``` -------------------------------- ### Exported Singleton Bindings Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/network-media-services.md Convenient pre-bound properties exported from the singleton media player manager instance for direct use and binding. ```APIDOC ### Exported Singleton Bindings The module exports convenient pre-bound properties from the singleton instance: ```typescript export const { activePlayer, timeStamp, currentPosition, loopStatus, shuffleStatus, canPlay, playbackStatus, canGoNext, canGoPrevious, mediaTitle, mediaAlbum, mediaArtist, mediaArtUrl, } = mediaPlayerManager; ``` **Usage**: ```typescript import { mediaTitle, mediaArtist, playbackStatus } from 'src/services/media'; import { bind } from 'astal'; // Directly bind exported properties const titleBinding = bind(mediaTitle); ``` ``` -------------------------------- ### Run listWindows CLI Command Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/cli-commands.md Executes the 'listWindows' command and logs the list of HyprPanel windows to the console. This is helpful for scripting window interactions. ```javascript runCLI('listWindows', console.log); ``` -------------------------------- ### Example: Check High Rain Chance Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/weather-service.md Demonstrates checking if the rain chance exceeds 80% and logging a message. Assumes weatherService is initialized. ```typescript const chance = weatherService.rainChance.get(); if (chance > 80) { console.log('High chance of rain'); } ``` -------------------------------- ### Run playPrev CLI Command Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/cli-commands.md Executes the 'playPrev' command to play the previous track and logs the result to the console. This is used for navigating media playback. ```javascript runCLI('playPrev', console.log); ``` -------------------------------- ### CommandRegistry Class Definition Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/cli-commands.md Defines the CommandRegistry class for managing command storage and retrieval. It provides methods to register, get, and retrieve all commands. ```typescript class CommandRegistry { public register(command: Command): void; public get(commandName: string): Command | undefined; public getAll(): Command[]; } ``` -------------------------------- ### SystemUtilities.sh Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/system-services.md Executes a shell command asynchronously, accepting the command as either a single string or an array of arguments. ```APIDOC ## SystemUtilities.sh ### Description Executes a shell command asynchronously. ### Method `static async sh(cmd: string | string[]): Promise` ### Parameters #### Path Parameters - **cmd** (string | string[]) - Required - Command as string or array of args ### Return Type `Promise` — Command output or empty string on error ``` -------------------------------- ### Get Weather Condition Icon Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/weather-service.md Retrieves a Unicode icon representing the current weather condition. This variable provides a visual indicator of the weather. ```typescript public get statusIcon(): Variable ``` -------------------------------- ### Example of Using errorHandler Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/core-types-errors.md Demonstrates catching an error and passing it to the centralized errorHandler for standardized propagation. The errorHandler function never returns, as it always throws. ```typescript import { errorHandler } from 'src/core/errors/handler'; try { somethingThatMightFail(); } catch (error) { errorHandler(error); // Never returns, always throws } ``` -------------------------------- ### SystemUtilities.bash Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/system-services.md Executes a bash command asynchronously, supporting both template string literals for safe command construction and regular strings. ```APIDOC ## SystemUtilities.bash ### Description Executes a bash command asynchronously. ### Method `static async bash(strings: TemplateStringsArray | string, ...values: unknown[]): Promise` ### Parameters #### Path Parameters - **strings** (TemplateStringsArray | string) - Required - Command as template string or regular string - **values** (...unknown[]) - Required - Values to interpolate into template string ### Return Type `Promise` — Command output or empty string on error ### Example ```typescript const output = await SystemUtilities.bash`ls -la ${homedir}`; const output2 = await SystemUtilities.bash('ls -la'); ``` ``` -------------------------------- ### Get Formatted Wind Condition String Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/weather-service.md Retrieves a formatted string representing the wind speed and its unit (e.g., '15 km/h' or '10 mph'). ```typescript public get windCondition(): Variable ``` -------------------------------- ### useTheme Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/utility-helpers.md Applies a color theme from a JSON file. This function loads theme data, updates relevant styling variables, and applies the changes immediately. ```APIDOC ## Function: useTheme Applies a theme from a JSON file. ### Description Loads and applies a color theme from a JSON file. Updates all theme-related variables and applies styling immediately. ### Parameters #### Path Parameters - **themePath** (string) - Required - Absolute path to theme JSON file ### Example ```typescript import { useTheme } from 'src/lib/theme/useTheme'; useTheme('/home/user/.config/hyprpanel/themes/dracula.json'); ``` ### Theme JSON Format ```json { "colors": { "primary": "#ff0000", "secondary": "#00ff00", "background": "#000000", "foreground": "#ffffff" }, "fontFamily": "JetBrains Mono", "fontSize": 12 } ``` ``` -------------------------------- ### Get Formatted Temperature with Unit Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/weather-service.md Retrieves a formatted temperature string, automatically handling Celsius/Fahrenheit conversion based on configuration. Suitable for direct display. ```typescript public get temperature(): Variable ``` -------------------------------- ### Best Practice: Accessing Options Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/configuration.md Always access configuration options through the main 'options' object imported from 'src/configuration'. Use '.get()' to retrieve the current value. ```typescript import options from 'src/configuration'; const value = options.path.to.option.get(); ``` -------------------------------- ### Configuration Options Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/INDEX.md Available configuration options for customizing HyprPanel's behavior and appearance. ```APIDOC ## Configuration Options - **Bar Module Configurations**: 29+ options available for various bar modules. - **Menu Options**: Configurations for volume, media, and notifications menus. - **Theme and Appearance Options**: Customize the visual aspects of HyprPanel. - **System Behavior Options**: Adjust system-related behaviors. ``` -------------------------------- ### List System Tray Application IDs Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/cli-commands.md Gets a list of IDs for the current applications in the system tray. Returns a newline-separated list or a message if no items are found. ```typescript { name: 'systrayItems', aliases: ['sti'], description: 'Gets a list of IDs for the current applications in the system tray.', category: 'System', args: [], handler: () => string } ``` ```bash runCLI('systrayItems', console.log); ``` -------------------------------- ### Get Temperature Gauge Icon and Color Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/weather-service.md Retrieves an object containing a temperature gauge icon and a corresponding color class. Useful for visualizing temperature ranges. ```typescript public get gaugeIcon(): Variable ``` -------------------------------- ### SystemUtilities.checkDependencies Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/system-services.md Checks if all specified dependencies (binaries) are available on the system. It uses the `which` command for verification and can send a notification if any dependencies are missing. ```APIDOC ## SystemUtilities.checkDependencies ### Description Checks if all specified dependencies are available. ### Method `static checkDependencies(...bins: string[]): boolean` ### Parameters #### Path Parameters - **bins** (...string[]) - Required - Variable number of binary/command names ### Return Type `boolean` — true if all found, false if any missing ### Example ```typescript const allFound = SystemUtilities.checkDependencies('ffmpeg', 'imagemagick', 'git'); if (!allFound) { console.warn('Some dependencies missing'); } ``` ``` -------------------------------- ### Theme Styling with Theme Object Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/configuration.md Demonstrates how to import and manipulate theme settings, such as primary colors and font families. Use `.set()` to update theme properties. ```typescript import theme from 'src/configuration/modules/theme'; theme.colors.primary.set('#ff0000'); theme.fontFamily.set('JetBrains Mono'); ``` -------------------------------- ### Expand Path with Tilde and Environment Variables Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/utility-helpers.md Expands tilde (~) and environment variables (e.g., $HOME) in a given path string to produce an absolute path. Useful for handling user-specific or system-wide configurations. ```typescript import { expandPath } from 'src/lib/path/helpers'; const configPath = expandPath('~/.config/hyprpanel'); const customPath = expandPath('$HOME/Documents/themes'); ``` -------------------------------- ### Create an Option with Initial Value Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/utility-helpers.md Use `opt` to create a single option that persists to the configuration file. It wraps a value in an interface supporting get/set operations. ```typescript export function opt(initial: T, props?: OptProps): Opt ``` ```typescript import { opt } from 'src/lib/options'; const fontSize = opt(12); const themeName = opt('dark'); ``` -------------------------------- ### Bash Command Polling Example Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/poller-system.md Demonstrates using BashPoller to poll the output of a bash command, such as checking battery status. The poller is initialized with a command string and manages its lifecycle. ```typescript import { BashPoller } from 'src/lib/poller/BashPoller'; import { Variable, bind } from 'astal'; class BatteryMonitor { private _batteryStatus = Variable(''); private _pollInterval = Variable(5000); private _poller: BashPoller; constructor() { this._poller = new BashPoller( this._batteryStatus, [bind(this._pollInterval)], bind(this._pollInterval), 'acpi -b | awk "{print \$3, \$4}"' ); } public initialize(): void { this._poller.initialize('battery'); } public start(): void { this._poller.start(); } public stop(): void { this._poller.stop(); } public get status(): Variable { return this._batteryStatus; } } ``` -------------------------------- ### Run playNext CLI Command Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/cli-commands.md Executes the 'playNext' command to play the next track and logs the result to the console. This is used for navigating media playback. ```javascript runCLI('playNext', console.log); ``` -------------------------------- ### Define mediaPlayerNext CLI Command Source: https://github.com/jas-singhfsu/hyprpanel/blob/master/_autodocs/cli-commands.md Defines the 'mediaPlayerNext' command to switch to the next available media player. It returns the name of the new player or an error. ```typescript { name: 'mediaPlayerNext', aliases: ['mpn'], description: 'Goes to the next available media player (if it exists).', category: 'Media', args: [], handler: () => string } ```