Skip to content
/ iconpp Public

📸 A C++17 library that allows you to grab an application's icon on Linux

License

Notifications You must be signed in to change notification settings

Soundux/iconpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📸 iconpp

A C++17 library that allows you to grab an applications icon on linux

Ubuntu Build License


⚙️ Configuration

Tests

set(iconpp_tests OFF)

If set to ON, iconpp will build tests.

📎 Installation

  • FetchContent
    include(FetchContent)
    FetchContent_Declare(iconpp GIT_REPOSITORY "https://github.com/Soundux/iconpp")
    
    FetchContent_MakeAvailable(iconpp)
    target_link_libraries(<YourLibrary> iconpp)
  • Git Submodule
    git submodule add "https://github.com/Soundux/iconpp"
    # Somewhere in your CMakeLists.txt
    add_subdirectory("<path_to_iconpp>")
    target_link_libraries(<YourLibrary> iconpp)

📔 Usage

Simple example

#include <iconpp.hpp>

int main()
{
    auto by_pid = iconpp::icon::get(0);
    // Or by name: auto by_name = iconpp::icon::get("System Monitor");

    if (by_pid)
    {
        by_pid->save("by_pid.png");
        auto raw_image = by_pid->get_raw();
        auto base64_img = by_pid->get_base64();
    }

    return 0;
}

ℹ️ Remarks

This library does not link its required libraries at compile time. Instead the dependencies are loaded at runtime.
This is done to ensure that the library will compile everywhere but only grab icons on systems that support it - In order to make the library an optional dependency that will not break builds.

⛓️ Dependencies

✅ Tested Systems

The following distributions have been confirmed working with the listed dependencies.

Distribution Dependencies
Ubuntu libwnck-3-0 libglib2.0-0 libgdk-pixbuf2.0-0
Arch Linux libwnck3 gdk-pixbuf2 glib2