mirror of
https://github.com/fairyglade/ly.git
synced 2026-02-04 08:24:55 +00:00
Allow building without X11 support
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
const std = @import("std");
|
||||
const build_options = @import("build_options");
|
||||
const enums = @import("enums.zig");
|
||||
const interop = @import("interop.zig");
|
||||
const TerminalBuffer = @import("tui/TerminalBuffer.zig");
|
||||
@@ -142,7 +143,7 @@ fn startSession(
|
||||
switch (current_environment.display_server) {
|
||||
.wayland => try executeWaylandCmd(pwd.pw_shell, config.wayland_cmd, current_environment.cmd),
|
||||
.shell => try executeShellCmd(pwd.pw_shell),
|
||||
.xinitrc, .x11 => {
|
||||
.xinitrc, .x11 => if (build_options.enable_x11_support) {
|
||||
var vt_buf: [5]u8 = undefined;
|
||||
const vt = try std.fmt.bufPrint(&vt_buf, "vt{d}", .{config.tty});
|
||||
try executeX11Cmd(pwd.pw_shell, pwd.pw_dir, config, current_environment.cmd, vt);
|
||||
|
||||
@@ -45,6 +45,7 @@ insert: []const u8 = "insert",
|
||||
login: []const u8 = "login:",
|
||||
logout: []const u8 = "logged out",
|
||||
normal: []const u8 = "normal",
|
||||
no_x11_support: []const u8 = "x11 support disabled at compile-time",
|
||||
numlock: []const u8 = "numlock",
|
||||
other: []const u8 = "other",
|
||||
password: []const u8 = "password:",
|
||||
|
||||
15
src/main.zig
15
src/main.zig
@@ -128,6 +128,8 @@ pub fn main() !void {
|
||||
}
|
||||
}
|
||||
|
||||
if (!build_options.enable_x11_support) try info_line.setText(lang.no_x11_support);
|
||||
|
||||
interop.setNumlock(config.numlock) catch {};
|
||||
|
||||
if (config.initial_info_text) |text| {
|
||||
@@ -178,14 +180,17 @@ pub fn main() !void {
|
||||
desktop.addEnvironment(.{ .Name = lang.shell }, "", .shell) catch {
|
||||
try info_line.setText(lang.err_alloc);
|
||||
};
|
||||
if (config.xinitrc) |xinitrc| {
|
||||
desktop.addEnvironment(.{ .Name = lang.xinitrc, .Exec = xinitrc }, "", .xinitrc) catch {
|
||||
try info_line.setText(lang.err_alloc);
|
||||
};
|
||||
|
||||
if (build_options.enable_x11_support) {
|
||||
if (config.xinitrc) |xinitrc| {
|
||||
desktop.addEnvironment(.{ .Name = lang.xinitrc, .Exec = xinitrc }, "", .xinitrc) catch {
|
||||
try info_line.setText(lang.err_alloc);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
try desktop.crawl(config.waylandsessions, .wayland);
|
||||
try desktop.crawl(config.xsessions, .x11);
|
||||
if (build_options.enable_x11_support) try desktop.crawl(config.xsessions, .x11);
|
||||
|
||||
var login = try Text.init(allocator, &buffer, config.max_login_len);
|
||||
defer login.deinit();
|
||||
|
||||
Reference in New Issue
Block a user