Skip to content

Repository files navigation

XDGKit

XDGKit is released under the LGPLv2.1 license.Current XDGKit version.

XDGKit is a C++ library providing utilities for working with XDG standards.

Features

This library does not load icons into memory. Instead, it provides fast lookups for icon metadata, including paths, extensions, sizes, and other relevant details.

Links

Example

#include<CZ/XDG/XDGKit.h>
#include<iostream>usingnamespaceCZ;intmain()
{
XDGKit::Options options;
// Load themes from cache when possible
options.useIconThemesCache = true;
// Automatically reload themes if a cache update is detected
options.autoReloadCache = true;
// Create an instance of XDGKit.auto kit = XDGKit::Make(options);
// Search for an iconconst XDGIcon *firefox =
kit->iconThemeManager().findIcon(
"firefox", // Icon to search for512, // Desired icon size (unscaled)2, // Scale factor
XDGIcon::PNG | XDGIcon::SVG | XDGIcon::XMP, // File extensions to consider
{ "Adwaita", "" } // Theme names to search in order, "" as wildcard for all themes
);
// Check if the icon was foundif (firefox)
{
std::cout
<< "Theme: " << firefox->directory().theme().name() << "\n"
<< "Icon: " << firefox->name() << "\n"
<< "Size: " << firefox->directory().size() << "\n"
<< "Scale: " << firefox->directory().scale() << "\n";
if (firefox->extensions() & XDGIcon::PNG)
std::cout << "PNG Path: " << firefox->getPath(XDGIcon::PNG) << "\n";
if (firefox->extensions() & XDGIcon::SVG)
std::cout << "SVG Path: " << firefox->getPath(XDGIcon::SVG) << "\n";
if (firefox->extensions() & XDGIcon::XMP)
std::cout << "XMP Path: " << firefox->getPath(XDGIcon::XMP) << "\n";
return0;
}
else
{
std::cout << "Could not find an icon named 'firefox'." << "\n";
return1;
}
}

About

XDG Utilities for C++

Topics

Resources

Stars

3 stars

Watchers

2 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages