7 Commits

Author SHA1 Message Date
AnErrupTion
1b9286166e [Backport] Fix buffer not resizing with no animation
Signed-off-by: AnErrupTion <anerruption@disroot.org>
2026-02-05 20:10:10 +01:00
AnErrupTion
ac91704c56 [Backport] Add config.x_vt option
Signed-off-by: AnErrupTion <anerruption@disroot.org>
2026-02-05 20:09:22 +01:00
AnErrupTion
48f8b306db [Backport] Better systemd-homed user detection
Signed-off-by: AnErrupTion <anerruption@disroot.org>
2026-02-05 20:07:52 +01:00
AnErrupTion
320fa0d8df [Backport] Fix wrong session being chosen in autologin
Signed-off-by: AnErrupTion <anerruption@disroot.org>
2026-02-05 20:06:19 +01:00
AnErrupTion
bcf025437a [Backport] Fix undefined value in XCB connection check
Signed-off-by: AnErrupTion <anerruption@disroot.org>
2026-02-05 20:04:38 +01:00
AnErrupTion
735868c51c [Backport] Fix building on musl
Signed-off-by: AnErrupTion <anerruption@disroot.org>
2026-02-05 20:04:05 +01:00
AnErrupTion
9c1a64692c Start Ly v1.3.2 development cycle
Signed-off-by: AnErrupTion <anerruption@disroot.org>
2026-02-05 20:03:09 +01:00
7 changed files with 40 additions and 28 deletions

View File

@@ -23,7 +23,7 @@ comptime {
}
}
const ly_version = std.SemanticVersion{ .major = 1, .minor = 3, .patch = 1 };
const ly_version = std.SemanticVersion{ .major = 1, .minor = 3, .patch = 2 };
var dest_directory: []const u8 = undefined;
var config_directory: []const u8 = undefined;

View File

@@ -1,6 +1,6 @@
.{
.name = .ly,
.version = "1.3.1",
.version = "1.3.2",
.fingerprint = 0xa148ffcc5dc2cb59,
.minimum_zig_version = "0.15.0",
.dependencies = .{
@@ -13,8 +13,8 @@
.hash = "zigini-0.3.3-36M0FRJJAADZVq5HPm-hYKMpFFTr0OgjbEYcK2ijKZ5n",
},
.termbox2 = .{
.url = "git+https://github.com/AnErrupTion/termbox2?ref=master#290ac6b8225aacfd16851224682b851b65fcb918",
.hash = "N-V-__8AAGcUBQAa5vov1Yi_9AXEffFQ1e2KsXaK4dgygRKq",
.url = "git+https://github.com/AnErrupTion/termbox2?ref=master#496730697c662893eec43192f48ff616c2539da6",
.hash = "N-V-__8AAOEWBQDt5tNdIzIFY6n8DdZsCP-6MyLoNS20wgpA",
},
},
.paths = .{""},

View File

@@ -62,7 +62,7 @@ auto_login_service = ly-autologin
# To find available session names, check the .desktop files in:
# - /usr/share/xsessions/ (for X11 sessions)
# - /usr/share/wayland-sessions/ (for Wayland sessions)
# Use the filename without .desktop extension, or the value of DesktopNames field
# Use the filename without .desktop extension, the Name field inside the file or the value of the DesktopNames field
# Examples: "i3", "sway", "gnome", "plasma", "xfce"
# If null, automatic login is disabled
auto_login_session = null
@@ -200,7 +200,7 @@ fg = 0x00FFFFFF
# TB_WHITE 0x0008
# If full color is off, the styling options still work. The colors are
# always 32-bit values with the styling in the most significant byte.
# Note: If using the dur_file animation option and the dur file's color range
# Note: If using the dur_file animation option and the dur file's color range
# is saved as 256 with this option disabled, the file will not be drawn.
full_color = true
@@ -354,6 +354,11 @@ waylandsessions = $PREFIX_DIRECTORY/share/wayland-sessions
# Xorg server command
x_cmd = $PREFIX_DIRECTORY/bin/X
# Xorg virtual terminal number
# Mostly useful for FreeBSD where choosing the current TTY causes issues
# If null, the current TTY will be chosen
x_vt = null
# Xorg xauthority edition tool
xauth_cmd = $PREFIX_DIRECTORY/bin/xauth

View File

@@ -20,6 +20,7 @@ pub const AuthOptions = struct {
setup_cmd: []const u8,
login_cmd: ?[]const u8,
x_cmd: []const u8,
x_vt: ?u8,
session_pid: std.posix.pid_t,
};
@@ -189,7 +190,7 @@ fn startSession(
.wayland, .shell, .custom => try executeCmd(log_file, allocator, user_entry.shell.?, options, current_environment.is_terminal, current_environment.cmd),
.xinitrc, .x11 => if (build_options.enable_x11_support) {
var vt_buf: [5]u8 = undefined;
const vt = try std.fmt.bufPrint(&vt_buf, "vt{d}", .{options.tty});
const vt = try std.fmt.bufPrint(&vt_buf, "vt{d}", .{options.x_vt orelse options.tty});
try executeX11Cmd(log_file, allocator, user_entry.shell.?, user_entry.home.?, options, current_environment.cmd orelse "", vt);
},
}
@@ -437,7 +438,7 @@ fn executeX11Cmd(log_file: *LogFile, allocator: std.mem.Allocator, shell: []cons
std.process.exit(1);
}
var ok: c_int = undefined;
var ok: c_int = -1;
var xcb: ?*interop.xcb.xcb_connection_t = null;
while (ok != 0) {
xcb = interop.xcb.xcb_connect(null, null);

View File

@@ -90,6 +90,7 @@ vi_default_mode: ViMode = .normal,
vi_mode: bool = false,
waylandsessions: []const u8 = build_options.prefix_directory ++ "/share/wayland-sessions",
x_cmd: []const u8 = build_options.prefix_directory ++ "/bin/X",
x_vt: ?u8 = null,
xauth_cmd: []const u8 = build_options.prefix_directory ++ "/bin/xauth",
xinitrc: ?[]const u8 = "~/.xinitrc",
xsessions: []const u8 = build_options.prefix_directory ++ "/share/xsessions",

View File

@@ -81,9 +81,6 @@ fn PlatformStruct() type {
pub const vt_activate = vt.VT_ACTIVATE;
pub const vt_waitactive = vt.VT_WAITACTIVE;
const SYSTEMD_HOMED_UID_MIN = 60001;
const SYSTEMD_HOMED_UID_MAX = 60513;
pub fn setUserContextImpl(username: [*:0]const u8, entry: UsernameEntry) !void {
const status = grp.initgroups(username, @intCast(entry.gid));
if (status != 0) return error.GroupInitializationFailed;
@@ -187,19 +184,6 @@ fn PlatformStruct() type {
if (!nameFound) return error.UidNameNotFound;
// This code assumes the OS has a login.defs file with UID_MIN
// and UID_MAX values defined in it, which should be the case
// for most systemd-based Linux distributions out there.
// This should be a good enough safeguard for now, as there's
// no reliable (and clean) way to check for systemd support
if (uid_range.uid_min > SYSTEMD_HOMED_UID_MIN) {
uid_range.uid_min = SYSTEMD_HOMED_UID_MIN;
}
if (uid_range.uid_max < SYSTEMD_HOMED_UID_MAX) {
uid_range.uid_max = SYSTEMD_HOMED_UID_MAX;
}
return uid_range;
}

View File

@@ -633,7 +633,7 @@ pub fn main() !void {
while (run) {
// If there's no input or there's an animation, a resolution change needs to be checked
if (!update or animate) {
if (!update or animate or config.bigclock != .none or config.clock != null) {
if (!update) std.Thread.sleep(std.time.ns_per_ms * 100);
_ = termbox.tb_present(); // Required to update tb_width() and tb_height()
@@ -1085,6 +1085,7 @@ pub fn main() !void {
.setup_cmd = config.setup_cmd,
.login_cmd = config.login_cmd,
.x_cmd = config.x_cmd,
.x_vt = config.x_vt,
.session_pid = session_pid,
};
@@ -1299,14 +1300,14 @@ fn isValidUsername(username: []const u8, usernames: StringList) bool {
fn findSessionByName(session: *Session, name: []const u8) ?usize {
for (session.label.list.items, 0..) |env, i| {
if (std.ascii.eqlIgnoreCase(env.environment.file_name, name)) return i;
if (std.ascii.eqlIgnoreCase(env.environment.name, name)) return i;
if (env.environment.xdg_session_desktop) |session_desktop| {
if (session_desktop.len > 0 and std.ascii.eqlIgnoreCase(session_desktop, name)) return i;
}
if (env.environment.xdg_desktop_names) |session_desktop_name| {
if (std.ascii.eqlIgnoreCase(session_desktop_name, name)) return i;
}
if (std.ascii.eqlIgnoreCase(env.environment.name, name)) return i;
if (std.ascii.eqlIgnoreCase(env.environment.file_name, name)) return i;
}
return null;
}
@@ -1320,13 +1321,33 @@ fn getAllUsernames(allocator: std.mem.Allocator, login_defs_path: []const u8, ui
};
};
// There's no reliable (and clean) way to check for systemd support, so
// let's just define a range and check if a user is within it
const SYSTEMD_HOMED_UID_MIN = 60001;
const SYSTEMD_HOMED_UID_MAX = 60513;
const homed_uid_range = UidRange{
.uid_min = SYSTEMD_HOMED_UID_MIN,
.uid_max = SYSTEMD_HOMED_UID_MAX,
};
var usernames: StringList = .empty;
var maybe_entry = interop.getNextUsernameEntry();
while (maybe_entry) |entry| {
// We check if the UID is equal to 0 because we always want to add root
// as a username (even if you can't log into it)
if (entry.uid >= uid_range.uid_min and entry.uid <= uid_range.uid_max or entry.uid == 0 and entry.username != null) {
const is_within_range =
entry.uid >= uid_range.uid_min and
entry.uid <= uid_range.uid_max;
const is_within_homed_range =
builtin.os.tag == .linux and
entry.uid >= homed_uid_range.uid_min and
entry.uid <= homed_uid_range.uid_max;
const is_root =
entry.uid == 0 and
entry.username != null;
if (is_within_range or is_within_homed_range or is_root) {
const username = try allocator.dupe(u8, entry.username.?);
try usernames.append(allocator, username);
}