feat: get icon from pixmaps

This commit is contained in:
Curve 2021-04-03 12:54:53 +02:00
parent 7ef13c4fe8
commit 2f73e98893
No known key found for this signature in database
GPG Key ID: 460F6C466BD35813
2 changed files with 15 additions and 9 deletions

View File

@ -102,12 +102,6 @@ else()
target_compile_definitions(soundux PRIVATE IS_EMBEDDED=1)
endif()
# [[ Copy tray icon ]]
if (UNIX)
file(COPY "${CMAKE_SOURCE_DIR}/assets/soundux.png"
DESTINATION "${CMAKE_SOURCE_DIR}/build")
endif()
# [[ Copy Openssl dlls ]]
# > Needed because dlls are not copied to output folder in github action
if (MSVC)
@ -134,14 +128,12 @@ if(USE_FLATPAK)
if (${EMBED_PATH} STREQUAL "OFF")
install(DIRECTORY "${CMAKE_SOURCE_DIR}/build/dist" DESTINATION bin)
endif()
install(FILES "${CMAKE_SOURCE_DIR}/build/soundux.png" DESTINATION bin)
else()
set(CMAKE_INSTALL_PREFIX "/opt/soundux" CACHE PATH "Install path prefix, prepended onto install directories." FORCE)
install(TARGETS soundux DESTINATION .)
if (${EMBED_PATH} STREQUAL "OFF")
install(DIRECTORY "${CMAKE_SOURCE_DIR}/build/dist" DESTINATION .)
endif()
install(FILES "${CMAKE_SOURCE_DIR}/build/soundux.png" DESTINATION /opt/soundux)
install(FILES "${CMAKE_SOURCE_DIR}/deployment/soundux.desktop" DESTINATION /usr/share/applications)
install(FILES "${CMAKE_SOURCE_DIR}/deployment/appstream/io.github.Soundux.metainfo.xml" DESTINATION /usr/share/metainfo)
install(FILES "${CMAKE_SOURCE_DIR}/assets/soundux.png" DESTINATION /usr/share/pixmaps)

View File

@ -35,7 +35,21 @@ namespace Soundux::Objects
#endif
#if defined(__linux__)
auto path = std::filesystem::canonical("/proc/self/exe").parent_path() / "dist" / "index.html";
auto iconPath = std::filesystem::canonical("/proc/self/exe").parent_path() / "soundux.png";
std::filesystem::path iconPath;
if (std::filesystem::exists("/app/share/icons/hicolor/256x256/apps/io.github.Soundux.png"))
{
iconPath = "/app/share/icons/hicolor/256x256/apps/io.github.Soundux.png";
}
else if (std::filesystem::exists("/usr/share/pixmaps/soundux.png"))
{
iconPath = "/usr/share/pixmaps/soundux.png";
}
else
{
Fancy::fancy.logTime().warning() << "Failed to find iconPath for tray icon" << std::endl;
}
tray = std::make_shared<Tray>("soundux-tray", iconPath);
#endif