Skip to content

Commit

Permalink
fix: hopefully fix running from arch's package
Browse files Browse the repository at this point in the history
  • Loading branch information
Almamu committed Jun 6, 2024
1 parent 6c27d94 commit 50d3bce
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 9 deletions.
21 changes: 15 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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")
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)

1 change: 0 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
4 changes: 3 additions & 1 deletion packaging/archlinux/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
15 changes: 14 additions & 1 deletion src/WallpaperEngine/Application/CWallpaperApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -299,7 +309,10 @@ void CWallpaperApplication::show () {
this->m_context, *reinterpret_cast<Render::Drivers::CGLFWOpenGLDriver*> (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");
}
Expand Down

0 comments on commit 50d3bce

Please sign in to comment.