From b249dba0924ad439ea81f14242e4ea018f2aa511 Mon Sep 17 00:00:00 2001 From: AnErrupTion Date: Tue, 2 Dec 2025 22:11:39 +0100 Subject: [PATCH] Support multiple TTYs with systemd service (closes #102) Signed-off-by: AnErrupTion --- build.zig | 6 +++--- readme.md | 8 ++++---- res/{ly.service => ly@.service} | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) rename res/{ly.service => ly@.service} (62%) diff --git a/build.zig b/build.zig index 12ababb..d7dd3b4 100644 --- a/build.zig +++ b/build.zig @@ -260,8 +260,8 @@ fn install_service(allocator: std.mem.Allocator, patch_map: PatchMap) !void { var service_dir = std.fs.cwd().openDir(service_path, .{}) catch unreachable; defer service_dir.close(); - const patched_service = try patchFile(allocator, "res/ly.service", patch_map); - try installText(patched_service, service_dir, service_path, "ly.service", .{ .mode = 0o644 }); + const patched_service = try patchFile(allocator, "res/ly@.service", patch_map); + try installText(patched_service, service_dir, service_path, "ly@.service", .{ .mode = 0o644 }); }, .openrc => { const service_path = try std.fs.path.join(allocator, &[_][]const u8{ dest_directory, config_directory, "/init.d" }); @@ -365,7 +365,7 @@ pub fn Uninstaller(uninstall_config: bool) type { try deleteFile(allocator, config_directory, "/pam.d/ly", "ly pam file not found"); switch (init_system) { - .systemd => try deleteFile(allocator, prefix_directory, "/lib/systemd/system/ly.service", "systemd service not found"), + .systemd => try deleteFile(allocator, prefix_directory, "/lib/systemd/system/ly@.service", "systemd service not found"), .openrc => try deleteFile(allocator, config_directory, "/init.d/ly", "openrc service not found"), .runit => try deleteTree(allocator, config_directory, "/sv/ly", "runit service not found"), .s6 => { diff --git a/readme.md b/readme.md index 8e9b5b2..e0308e3 100644 --- a/readme.md +++ b/readme.md @@ -111,19 +111,19 @@ command: Then, similarly to the previous command, you need to enable the Ly service: ``` -# systemctl enable ly.service +# systemctl enable ly@tty2.service ``` **Important**: Because Ly runs in a TTY, you **must** disable the TTY service -that Ly will run on, otherwise bad things will happen. For example, to disable `getty` spawning on TTY 2 (the default TTY on which Ly spawns), you need to -execute the following command: +that Ly will run on, otherwise bad things will happen. For example, to disable `getty` spawning on TTY 2, you need to execute the following command: ``` # systemctl disable getty@tty2.service ``` You can change the TTY Ly will run on by editing the corresponding -service file for your platform. +service file for your platform, or on systemd, by enabling the service on +different TTYs, as is done above. ### OpenRC diff --git a/res/ly.service b/res/ly@.service similarity index 62% rename from res/ly.service rename to res/ly@.service index 0b72699..21d20df 100644 --- a/res/ly.service +++ b/res/ly@.service @@ -1,16 +1,16 @@ [Unit] Description=TUI display manager After=systemd-user-sessions.service plymouth-quit-wait.service -After=getty@tty$DEFAULT_TTY.service -Conflicts=getty@tty$DEFAULT_TTY.service +After=getty@%I.service +Conflicts=getty@%I.service [Service] Type=idle ExecStart=$PREFIX_DIRECTORY/bin/$EXECUTABLE_NAME StandardInput=tty -TTYPath=/dev/tty$DEFAULT_TTY +TTYPath=/dev/%I TTYReset=yes TTYVHangup=yes [Install] -Alias=display-manager.service +WantedBy=multi-user.target