Various bug fixes and small features (#606)

* Fix stray cursor, integer overflows and other bugs

* check for getenvlist error, shorten code

* fix cascade, set info_line before auth, make code clearer and a bug fix

* Add option to turn on numlock at startup

* Fix setting numlock

* Update build.zig

* Custom info text

* Shift+Tab for previous input

* update changelog and res/config

* Some fixes

* update build.zig

* update build.zig again

* Fix xauth command for some shells and fix building in ReleaseSafe

* Use git describe to get dev version str

* revert change to getLockState (it broke the doom animation)

* add new ly error messages. Only try to make path for pam/exe during install when dest_directory is defined + print warning on error.

* add warning message for workaround
This commit is contained in:
アシュ
2024-07-02 08:52:38 +00:00
committed by GitHub
parent 3d8d8d67df
commit 291e0d836b
38 changed files with 3901 additions and 4069 deletions

View File

@@ -2,9 +2,7 @@ const std = @import("std");
const builtin = @import("builtin");
const Allocator = std.mem.Allocator;
pub const termbox = @cImport({
@cInclude("termbox.h");
});
pub const termbox = @import("termbox2");
pub const pam = @cImport({
@cInclude("security/pam_appl.h");
@@ -48,7 +46,9 @@ pub const VT_ACTIVATE: c_int = 0x5606;
pub const VT_WAITACTIVE: c_int = 0x5607;
pub const KDGETLED: c_int = 0x4B31;
pub const KDSETLED: c_int = 0x4B32;
pub const KDGKBLED: c_int = 0x4B64;
pub const KDSKBLED: c_int = 0x4B65;
pub const LED_NUM: c_int = 0x02;
pub const LED_CAP: c_int = 0x04;
@@ -106,3 +106,14 @@ pub fn getLockState(console_dev: [:0]const u8) !struct {
.capslock = capslock,
};
}
pub fn setNumlock(val: bool) !void {
var led: c_char = undefined;
_ = std.c.ioctl(0, KDGKBLED, &led);
const numlock = (led & K_NUMLOCK) != 0;
if (numlock != val) {
const status = std.c.ioctl(std.posix.STDIN_FILENO, KDSKBLED, led ^ K_NUMLOCK);
if (status != 0) return error.FailedToSetNumlock;
}
}