From ed7701c29203fe22333e545f40ab6a2f3880a68c Mon Sep 17 00:00:00 2001 From: izmyname <135810812+izmyname@users.noreply.github.com> Date: Thu, 7 Nov 2024 20:35:01 +0500 Subject: [PATCH 1/5] systemd: hyprland-systemd.desktop -> hyprland-uwsm.desktop Remove hyprland-session.service. --- systemd/hyprland-systemd.desktop | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/systemd/hyprland-systemd.desktop b/systemd/hyprland-systemd.desktop index 64ebbd472b0..2ed1031b6ad 100644 --- a/systemd/hyprland-systemd.desktop +++ b/systemd/hyprland-systemd.desktop @@ -1,7 +1,6 @@ [Desktop Entry] -Name=Hyprland (systemd session) +Name=Hyprland (uwsm-managed) Comment=An intelligent dynamic tiling Wayland compositor -Exec=systemctl --user start --wait hyprland-session -Type=Application +Exec=uwsm start -N Hyprland -D Hyprland -C An_intelligent_dynamic_tiling_Wayland_compositor -- Hyprland DesktopNames=Hyprland -Keywords=tiling;wayland;compositor; +Type=Application From bedce6feb12083dfb2fcef2fd1110eea156c05d8 Mon Sep 17 00:00:00 2001 From: Izmyname Date: Thu, 7 Nov 2024 21:01:12 +0500 Subject: [PATCH 2/5] rename hyprland-systemd.desktop and remove hyprland-session.service --- CMakeLists.txt | 10 ++-------- systemd/hyprland-session.service.in | 16 ---------------- ...and-systemd.desktop => hyprland-uwsm.desktop} | 0 systemd/meson.build | 14 +------------- 4 files changed, 3 insertions(+), 37 deletions(-) delete mode 100644 systemd/hyprland-session.service.in rename systemd/{hyprland-systemd.desktop => hyprland-uwsm.desktop} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ac2e10f902..d337680f55e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -222,16 +222,10 @@ if(NO_SYSTEMD) else() message(STATUS "SYSTEMD support is requested (NO_SYSTEMD not defined)...") add_compile_definitions(USES_SYSTEMD) - configure_file(systemd/hyprland-session.service.in - systemd/hyprland-session.service @ONLY) - # session file -systemd - install(FILES ${CMAKE_SOURCE_DIR}/systemd/hyprland-systemd.desktop + # session file -uwsm + install(FILES ${CMAKE_SOURCE_DIR}/systemd/hyprland-uwsm.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/wayland-sessions) - - # install systemd service - install(FILES ${CMAKE_BINARY_DIR}/systemd/hyprland-session.service - DESTINATION ${CMAKE_INSTALL_LIBDIR}/systemd/user) endif() set(CPACK_PROJECT_NAME ${PROJECT_NAME}) diff --git a/systemd/hyprland-session.service.in b/systemd/hyprland-session.service.in deleted file mode 100644 index dafdc141856..00000000000 --- a/systemd/hyprland-session.service.in +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=Hyprland - Tiling compositor with the looks -Documentation=man:Hyprland(1) -BindsTo=graphical-session.target -Before=graphical-session.target -Wants=xdg-desktop-autostart.target -Wants=graphical-session-pre.target -After=graphical-session-pre.target - -[Service] -Type=notify -ExecStart=@PREFIX@/@BINDIR@/Hyprland -ExecStop=@PREFIX@/@BINDIR@/hyprctl dispatch exit -ExecStopPost=systemctl --user unset-environment DISPLAY WAYLAND_DISPLAY HYPRLAND_INSTANCE_SIGNATURE XDG_CURRENT_DESKTOP -Restart=on-failure -Slice=session.slice diff --git a/systemd/hyprland-systemd.desktop b/systemd/hyprland-uwsm.desktop similarity index 100% rename from systemd/hyprland-systemd.desktop rename to systemd/hyprland-uwsm.desktop diff --git a/systemd/meson.build b/systemd/meson.build index 2cd5312a32a..731f04e325a 100644 --- a/systemd/meson.build +++ b/systemd/meson.build @@ -1,17 +1,5 @@ install_data( - 'hyprland-systemd.desktop', + 'hyprland-uwsm.desktop', install_dir: join_paths(get_option('datadir'), 'wayland-sessions'), install_tag: 'runtime', ) - -conf_data = configuration_data() -conf_data.set('PREFIX', get_option('prefix')) -conf_data.set('BINDIR', get_option('bindir')) -user_unit_dir = systemd.get_variable(pkgconfig: 'systemduserunitdir', - pkgconfig_define: ['prefix', get_option('prefix')]) - -configure_file( - configuration: conf_data, - input: 'hyprland-session.service.in', - output: '@BASENAME@', - install_dir: user_unit_dir ) From c766899c31f8f5f62812e2eb1404a81aff9251fb Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Mon, 11 Nov 2024 09:36:15 +0200 Subject: [PATCH 3/5] meson: autodetect systemd --- meson.build | 8 ++++++-- nix/default.nix | 1 - 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 76765645688..e4abad3694b 100644 --- a/meson.build +++ b/meson.build @@ -52,8 +52,12 @@ backtrace_dep = cpp_compiler.find_library('execinfo', required: false) epoll_dep = dependency('epoll-shim', required: false) # timerfd on BSDs # Handle options -if get_option('systemd').enabled() - systemd = dependency('systemd') +systemd_option = get_option('systemd') +systemd = dependency('systemd', required: systemd_option) +systemd_option.enable_auto_if(systemd.found()) + +if (systemd_option.enabled()) + message('Enabling systemd integration') add_project_arguments('-DUSES_SYSTEMD', language: 'cpp') subdir('systemd') endif diff --git a/nix/default.nix b/nix/default.nix index 29d31485123..90c92272494 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -152,7 +152,6 @@ in (mapAttrsToList mesonEnable { "xwayland" = enableXWayland; "legacy_renderer" = legacyRenderer; - "systemd" = withSystemd; }) (mapAttrsToList mesonBool { "b_pch" = false; From 61347dffc34898e21f462e91cc6ae0e256881426 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Mon, 11 Nov 2024 10:05:01 +0200 Subject: [PATCH 4/5] Lock uwsm desktop file behind feature flag The file in the repo cannot be used in NixOS due to missing full paths, and the fact that `uwsm` does not have access to `PATH` to find the listed binaries. Might be useful in other situations as well. --- CMakeLists.txt | 9 +++++++-- meson_options.txt | 1 + systemd/meson.build | 12 +++++++----- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d337680f55e..117932d0ba5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -224,8 +224,13 @@ else() add_compile_definitions(USES_SYSTEMD) # session file -uwsm - install(FILES ${CMAKE_SOURCE_DIR}/systemd/hyprland-uwsm.desktop - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/wayland-sessions) + if(NO_UWSM) + message(STATUS "UWSM support is disabled...") + else() + message(STATUS "UWSM support is enabled (NO_UWSM not defined)...") + install(FILES ${CMAKE_SOURCE_DIR}/systemd/hyprland-uwsm.desktop + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/wayland-sessions) + endif() endif() set(CPACK_PROJECT_NAME ${PROJECT_NAME}) diff --git a/meson_options.txt b/meson_options.txt index d8c9d5e64ce..9b64fb322e9 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,4 +1,5 @@ option('xwayland', type: 'feature', value: 'auto', description: 'Enable support for X11 applications') option('systemd', type: 'feature', value: 'auto', description: 'Enable systemd integration') +option('uwsm', type: 'feature', value: 'enabled', description: 'Enable uwsm integration (only if systemd is enabled)') option('legacy_renderer', type: 'feature', value: 'disabled', description: 'Enable legacy renderer') option('tracy_enable', type: 'boolean', value: false , description: 'Enable profiling') diff --git a/systemd/meson.build b/systemd/meson.build index 731f04e325a..bc62e95aea8 100644 --- a/systemd/meson.build +++ b/systemd/meson.build @@ -1,5 +1,7 @@ -install_data( - 'hyprland-uwsm.desktop', - install_dir: join_paths(get_option('datadir'), 'wayland-sessions'), - install_tag: 'runtime', -) +if (get_option('uwsm').allowed()) + install_data( + 'hyprland-uwsm.desktop', + install_dir: join_paths(get_option('datadir'), 'wayland-sessions'), + install_tag: 'runtime', + ) +endif From da0366b603a84791a30b8018cadfad22aa0683a4 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Mon, 11 Nov 2024 10:15:58 +0200 Subject: [PATCH 5/5] Nix: disable uwsm desktop file installation Will be enabled in the NixOS module. --- nix/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/default.nix b/nix/default.nix index 90c92272494..69174d4ddea 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -152,6 +152,7 @@ in (mapAttrsToList mesonEnable { "xwayland" = enableXWayland; "legacy_renderer" = legacyRenderer; + "uwsm" = false; }) (mapAttrsToList mesonBool { "b_pch" = false;