From 3f8cc92109209364e9d39789b3631e9ac109987a Mon Sep 17 00:00:00 2001 From: izmyname <135810812+izmyname@users.noreply.github.com> Date: Sat, 26 Oct 2024 02:14:47 +0500 Subject: [PATCH] Add systemd service (#208) --- CMakeLists.txt | 5 +++++ systemd/hyprpaper.service.in | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 systemd/hyprpaper.service.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 09b6305..e19c8a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,8 @@ set(CMAKE_MESSAGE_LOG_LEVEL "STATUS") message(STATUS "Configuring hyprpaper!") +configure_file(systemd/hyprpaper.service.in systemd/hyprpaper.service @ONLY) + # Get git info hash and branch execute_process( COMMAND git rev-parse --abbrev-ref HEAD @@ -138,4 +140,7 @@ if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG) "${CMAKE_SHARED_LINKER_FLAGS} -pg -no-pie -fno-builtin") endif(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG) +include(GNUInstallDirs) + install(TARGETS hyprpaper) +install(FILES ${CMAKE_BINARY_DIR}/systemd/hyprpaper.service DESTINATION ${CMAKE_INSTALL_LIBDIR}/systemd/user) diff --git a/systemd/hyprpaper.service.in b/systemd/hyprpaper.service.in new file mode 100644 index 0000000..ef347ec --- /dev/null +++ b/systemd/hyprpaper.service.in @@ -0,0 +1,16 @@ +[Unit] +Description=Fast, IPC-controlled wallpaper utility for Hyprland. +Documentation=https://wiki.hyprland.org/Hypr-Ecosystem/hyprpaper/ +PartOf=graphical-session.target +Requires=graphical-session.target +After=graphical-session.target +ConditionEnvironment=WAYLAND_DISPLAY + +[Service] +Type=simple +ExecStart=@CMAKE_INSTALL_PREFIX@/bin/hyprpaper +Slice=session.slice +Restart=on-failure + +[Install] +WantedBy=graphical-session.target