import type { Icon as IIcon, IconPack, IconPack as IIconPack, SeelenCommandGetIconArgs } from "../../gen/types/mod.js"; import { List } from "../utils/List.js"; import { type UnSubscriber } from "../handlers/mod.js"; import type { UnlistenFn } from "@tauri-apps/api/event"; export declare class IconPackList extends List { static getAsync(): Promise; static onChange(cb: (payload: IconPackList) => void): Promise; } /** * Class helper to allow easy use of icon packs */ export declare class IconPackManager { protected _availableIconPacks: IconPack[]; protected _activeIconPackIds: string[]; private callbacks; private unlisteners; private isListeningForChanges; private activeIconPacks; protected constructor(_availableIconPacks: IconPack[], _activeIconPackIds: string[]); get iconPacks(): IconPack[]; get activeIconPackIds(): string[]; protected resolveAvailableIcons(): void; protected cacheActiveIconPacks(): void; /** * Creates an instance of IconPackManager. This intance will be updated when * the list of icon packs or the settings changes, so just having one global instance is enough. * * @returns A new instance of IconPackManager */ static create(): Promise; /** * Registers a callback to be invoked when the list of active icon packs changes. * This method also sets up listeners to detect changes in the icon pack list and * the active icon packs settings. If no callbacks are registered beforehand, the * listeners are initialized. When no callbacks remain registered, the listeners are stopped. * * @param {() => void} cb - The callback to be invoked when the list of active icon packs changes. * This callback takes no arguments and returns no value. * @returns {Promise} A promise that resolves to an `UnlistenFn` function. When invoked, * this function unregisters the callback and stops listening for changes * if no other callbacks are registered. * * @example * const manager = await IconPackManager.create(); * const unlisten = await manager.onChange(() => { * console.log("Icon packs changed: ", manager.actives); * }); * * // Later, to stop listening for changes: * unlisten(); * * @remarks * - The `this` context inside the callback refers to the `IconPackManager` instance, provided the callback * is not rebound to another context (e.g., using `bind`, `call`, or `apply`). * - If the callback is defined as an arrow function, `this` will be lexically bound to the surrounding context. * - If the callback is a regular function, ensure it is bound correctly to avoid `this` being `undefined` (in strict mode) * or the global object (in non-strict mode). * * @see {@link IconPackManager} for the class this method belongs to. * @see {@link UnlistenFn} for the type of the function returned by this method. */ onChange(cb: () => void): Promise; /** * Returns the icon path for an app or file. If no icon is available, returns `null`. * * The search for icons follows this priority order: * 1. UMID (App User Model Id) * 2. Full path * 3. Filename (this is only used to match executable files like .exe) * 4. Extension * * @param {Object} args - Arguments for retrieving the icon path. * @param {string} [args.path] - The full path to the app or file. * @param {string} [args.umid] - The UMID of the app. * @returns {string | null} - The path to the icon, or `null` if no icon is found. * * @example * // Example 1: Get icon by full path * const iconPath = instance.getIconPath({ * path: "C:\\Program Files\\Steam\\steam.exe" * }); * * // Example 2: Get icon by UMID * const iconPath = instance.getIconPath({ * umid: "Seelen.SeelenUI_p6yyn03m1894e!App" * }); */ getIconPath(args: SeelenCommandGetIconArgs): IIcon | null; getIcon({ path, umid }: SeelenCommandGetIconArgs): IIcon | null; /** * Will return the special missing icon path from the highest priority icon pack. * If no icon pack haves a missing icon, will return null. */ getMissingIconPath(): IIcon | null; /** * Will return the special missing icon SRC from the highest priority icon pack. * If no icon pack haves a missing icon, will return null. */ getMissingIcon(): IIcon | null; /** * Will return the specific icon path from the highest priority icon pack. * If no icon pack haves the searched icon, will return null. */ getCustomIconPath(name: string): IIcon | null; /** * Will return the specific icon SRC from the highest priority icon pack. * If no icon pack haves the searched icon, will return null. */ getCustomIcon(name: string): IIcon | null; /** * This method doesn't take in care icon packs, just extracts the inherited icon into system's icon pack * if it's not already there. * * @param filePath The path to the app could be umid o full path * @example * const iconPath = instance.extractIcon({ * path: "C:\\Program Files\\Steam\\steam.exe" * }); * const iconPath = instance.extractIcon({ * umid: "Seelen.SeelenUI_p6yyn03m1894e!App" * }); */ static requestIconExtraction(obj: SeelenCommandGetIconArgs): Promise; /** * This will delete all stored icons on the system icon pack.\ * All icons should be regenerated after calling this method. */ static clearCachedIcons(): Promise; } //# sourceMappingURL=icon_pack.d.ts.map