diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b1556a..585a76e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,11 @@ cmake_minimum_required(VERSION 3.12) project(linux-wallpaperengine) +# prevent installing to /usr by default so we don't bork anything +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "/opt/${PROJECT_NAME}" CACHE PATH "..." FORCE) +endif() + set_property(GLOBAL PROPERTY OS_FOLDERS ON) set(CMAKE_CXX_STANDARD 17) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules") @@ -73,17 +78,17 @@ find_package(CEF REQUIRED) set( CMAKE_RUNTIME_OUTPUT_DIRECTORY - ${CMAKE_HOME_DIRECTORY}/build + ${CMAKE_CURRENT_BINARY_DIR}/build ) set( CMAKE_LIBRARY_OUTPUT_DIRECTORY - ${CMAKE_HOME_DIRECTORY}/lib + ${CMAKE_CURRENT_BINARY_DIR}/lib ) set( TARGET_OUTPUT_DIRECTORY - ${CMAKE_HOME_DIRECTORY}/build + ${CMAKE_CURRENT_BINARY_DIR}/build ) add_subdirectory(${CEF_LIBCEF_DLL_WRAPPER_PATH} libcef_dll_wrapper) @@ -467,8 +472,12 @@ if(X11_SUPPORT_FOUND) endif() endif() -file(CREATE_LINK linux-wallpaperengine wallengine SYMBOLIC) +if(NOT WAYLAND_SUPPORT_FOUND AND NOT X11_SUPPORT_FOUND) + message(WARNING "No window server detected at build time. You will only be able to preview backgrounds") +endif() # set some install parameters if not in debug mode -install(TARGETS linux-wallpaperengine) -install(DIRECTORY share/ DESTINATION share/${PROJECT_NAME}) +install(DIRECTORY ${TARGET_OUTPUT_DIRECTORY}/ DESTINATION .) +install(FILES ${TARGET_OUTPUT_DIRECTORY}/${PROJECT_NAME} PERMISSIONS OWNER_READ OWNER_WRITE WORLD_EXECUTE WORLD_READ GROUP_READ DESTINATION .) +install(DIRECTORY share/ DESTINATION ./share) + diff --git a/main.cpp b/main.cpp index de7710f..f8b6e98 100644 --- a/main.cpp +++ b/main.cpp @@ -3,7 +3,6 @@ #include "WallpaperEngine/Application/CApplicationContext.h" #include "WallpaperEngine/Application/CWallpaperApplication.h" -#include "WallpaperEngine/Core/Wallpapers/CWeb.h" #include "WallpaperEngine/WebBrowser/CWebBrowserContext.h" #include "common.h" diff --git a/packaging/archlinux/PKGBUILD b/packaging/archlinux/PKGBUILD index 9637c37..73a549b 100644 --- a/packaging/archlinux/PKGBUILD +++ b/packaging/archlinux/PKGBUILD @@ -27,11 +27,13 @@ pkgver() { build() { cmake -B build -S "$pkgname" \ -DCMAKE_BUILD_TYPE='Release' \ - -DCMAKE_INSTALL_PREFIX='/usr' \ + -DCMAKE_INSTALL_PREFIX='/opt/linux-wallpaperengine' \ -Wno-dev cmake --build build } package() { DESTDIR="$pkgdir" cmake --install build + # create forwarding script + echo "cd /opt/linux-wallpaperengine; ./linux-wallpaperengine \$*" > /usr/bin/linux-wallpaperengine } diff --git a/src/WallpaperEngine/Application/CWallpaperApplication.cpp b/src/WallpaperEngine/Application/CWallpaperApplication.cpp index 9858d47..f7f244d 100644 --- a/src/WallpaperEngine/Application/CWallpaperApplication.cpp +++ b/src/WallpaperEngine/Application/CWallpaperApplication.cpp @@ -267,6 +267,16 @@ void CWallpaperApplication::show () { "Cannot read environment variable XDG_SESSION_TYPE, window server detection failed. Please ensure proper values are set"); } + sLog.debug("Checking for window servers: "); + +#ifdef ENABLE_WAYLAND + sLog.debug("\twayland"); +#endif // ENABLE_WAYLAND + +#ifdef ENABLE_X11 + sLog.debug("\tx11"); +#endif // ENABLE_X11 + #ifdef ENABLE_WAYLAND bool isWayland = strncmp ("wayland", XDG_SESSION_TYPE, strlen ("wayland")) == 0; #endif // ENABLE_WAYLAND @@ -299,7 +309,10 @@ void CWallpaperApplication::show () { this->m_context, *reinterpret_cast (m_videoDriver)); } #endif // ENABLE_X11 - else { +#ifdef ENABLE_X11 + else +#endif // ENABLE_X11 + { sLog.exception ( "Cannot run in background mode, window server could not be detected. XDG_SESSION_TYPE must be wayland or x11"); }