diff --git a/CMakeLists.txt b/CMakeLists.txt index bd498ed..4a5fc27 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,8 @@ add_compile_definitions(HYPRSUNSET_VERSION="${VERSION}") message(STATUS "Configuring hyprsunset!") +configure_file(systemd/hyprsunset.service.in systemd/hyprsunset.service @ONLY) + # Get git info hash and branch execute_process( COMMAND git rev-parse --abbrev-ref HEAD @@ -134,4 +136,7 @@ if(NOT DEFINED CMAKE_INSTALL_MANDIR) set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_PREFIX}/share/man") endif() +include(GNUInstallDirs) + install(TARGETS hyprsunset) +install(FILES ${CMAKE_BINARY_DIR}/systemd/hyprsunset.service DESTINATION ${CMAKE_INSTALL_LIBDIR}/systemd/user) diff --git a/systemd/hyprsunset.service.in b/systemd/hyprsunset.service.in new file mode 100644 index 0000000..70bb41b --- /dev/null +++ b/systemd/hyprsunset.service.in @@ -0,0 +1,16 @@ +[Unit] +Description=An application to enable a blue-light filter on Hyprland. +Documentation=https://wiki.hyprland.org/Hypr-Ecosystem/hyprsunset/ +PartOf=graphical-session.target +Requires=graphical-session.target +After=graphical-session.target +ConditionEnvironment=WAYLAND_DISPLAY + +[Service] +Type=simple +ExecStart=@CMAKE_INSTALL_PREFIX@/bin/hyprsunset +Slice=session.slice +Restart=on-failure + +[Install] +WantedBy=graphical-session.target