diff --git a/CMakeLists.txt b/CMakeLists.txt index e284cb68..fa58b63d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -262,9 +262,11 @@ endfunction() target_link_libraries(Hyprland OpenGL::EGL OpenGL::GL Threads::Threads libudis86 uuid) -protocolnew("subprojects/hyprland-protocols/protocols" "hyprland-global-shortcuts-v1" true) +protocolnew("subprojects/hyprland-protocols/protocols" + "hyprland-global-shortcuts-v1" true) protocolnew("unstable/text-input" "text-input-unstable-v1" false) -protocolnew("subprojects/hyprland-protocols/protocols" "hyprland-toplevel-export-v1" true) +protocolnew("subprojects/hyprland-protocols/protocols" + "hyprland-toplevel-export-v1" true) protocolnew("protocols" "wlr-screencopy-unstable-v1" true) protocolnew("protocols" "wlr-gamma-control-unstable-v1" true) protocolnew("protocols" "wlr-foreign-toplevel-management-unstable-v1" true) @@ -326,19 +328,22 @@ install( # session file install(FILES ${CMAKE_SOURCE_DIR}/example/hyprland.desktop - DESTINATION ${CMAKE_INSTALL_DATADIR}/wayland-sessions) + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/wayland-sessions) + +# allow Hyprland to find wallpapers +add_compile_definitions(DATAROOTDIR="${CMAKE_INSTALL_FULL_DATAROOTDIR}") # wallpapers file(GLOB_RECURSE WALLPAPERS "assets/wall*") -install(FILES ${WALLPAPERS} DESTINATION ${CMAKE_INSTALL_DATADIR}/hyprland) +install(FILES ${WALLPAPERS} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/hypr) # default config install(FILES ${CMAKE_SOURCE_DIR}/example/hyprland.conf - DESTINATION ${CMAKE_INSTALL_DATADIR}/hyprland) + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/hypr) # portal config install(FILES ${CMAKE_SOURCE_DIR}/assets/hyprland-portals.conf - DESTINATION ${CMAKE_INSTALL_DATADIR}/xdg-desktop-portal) + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/xdg-desktop-portal) # man pages file(GLOB_RECURSE MANPAGES "docs/*.1") diff --git a/assets/meson.build b/assets/meson.build index 8c4a60ec..47de3d02 100644 --- a/assets/meson.build +++ b/assets/meson.build @@ -1,7 +1,7 @@ wallpapers = ['0', '1', '2'] foreach type : wallpapers - install_data(f'wall@type@.png', install_dir: join_paths(get_option('datadir'), 'hyprland'), install_tag: 'runtime') + install_data(f'wall@type@.png', install_dir: join_paths(get_option('datadir'), 'hypr'), install_tag: 'runtime') endforeach install_data('hyprland-portals.conf', install_dir: join_paths(get_option('datadir'), 'xdg-desktop-portal'), install_tag: 'runtime') diff --git a/example/meson.build b/example/meson.build index ccfc4e00..2fb3a35e 100644 --- a/example/meson.build +++ b/example/meson.build @@ -1,2 +1,2 @@ -install_data('hyprland.conf', install_dir: join_paths(get_option('datadir'), 'hyprland'), install_tag: 'runtime') +install_data('hyprland.conf', install_dir: join_paths(get_option('datadir'), 'hypr'), install_tag: 'runtime') install_data('hyprland.desktop', install_dir: join_paths(get_option('datadir'), 'wayland-sessions'), install_tag: 'runtime') diff --git a/meson.build b/meson.build index 4446ea0f..886f4f9c 100644 --- a/meson.build +++ b/meson.build @@ -9,6 +9,7 @@ project('Hyprland', 'cpp', 'c', 'cpp_std=c++23', ]) +datarootdir = '-DDATAROOTDIR="' + get_option('prefix') / get_option('datadir') + '"' add_project_arguments( [ '-Wno-unused-parameter', @@ -16,6 +17,7 @@ add_project_arguments( '-Wno-missing-field-initializers', '-Wno-narrowing', '-Wno-pointer-arith', + datarootdir, ], language: 'cpp') diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index b925fcc9..ea388df0 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -2669,10 +2669,12 @@ void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) { PFB->alloc(pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y, pMonitor->output->state->state().drmFormat); if (!m_pBackgroundTexture) { - // TODO: use relative paths to the installation - // or configure the paths at build time std::string texPath = ""; - texPath = "/usr/share/hyprland/wall"; +#ifndef DATAROOTDIR + texPath = "/usr/share/hypr/wall"; +#else + texPath = std::format("{}{}", DATAROOTDIR, "/hypr/wall"); +#endif // get the adequate tex if (FORCEWALLPAPER == -1) {