https://github.com/soundux/iconpp
đ¸ A C++17 library that allows you to grab an application's icon on Linux
https://github.com/soundux/iconpp
application-icon application-icons cmake cpp cpp-library cpp17 cpp17-library icons
Last synced: 11 months ago
JSON representation
đ¸ A C++17 library that allows you to grab an application's icon on Linux
- Host: GitHub
- URL: https://github.com/soundux/iconpp
- Owner: Soundux
- License: mit
- Created: 2021-11-06T22:28:46.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-11-07T11:48:17.000Z (about 4 years ago)
- Last Synced: 2025-01-12T00:13:35.089Z (about 1 year ago)
- Topics: application-icon, application-icons, cmake, cpp, cpp-library, cpp17, cpp17-library, icons
- Language: C++
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
đ¸ iconpp
A C++17 library that allows you to grab an applications icon on linux
---
## âī¸ Configuration
### Tests
```cmake
set(iconpp_tests OFF)
```
> If set to `ON`, iconpp will build tests.
## đ Installation
- FetchContent
```cmake
include(FetchContent)
FetchContent_Declare(iconpp GIT_REPOSITORY "https://github.com/Soundux/iconpp")
FetchContent_MakeAvailable(iconpp)
target_link_libraries( iconpp)
```
- Git Submodule
```bash
git submodule add "https://github.com/Soundux/iconpp"
```
```cmake
# Somewhere in your CMakeLists.txt
add_subdirectory("")
target_link_libraries( iconpp)
```
## đ Usage
### Simple example
```cpp
#include
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
- wnck3
- gdk3
- glib2
- [`Catch2`](https://github.com/catchorg/Catch2) _(For tests only!)_
- [`expected`](https://github.com/TartanLlama/expected)
## â
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` |