mirror of https://github.com/fairyglade/ly
make long lines shorter and add changelog
parent
6a41bcf13a
commit
f904be8fc0
@ -0,0 +1,41 @@
|
||||
# Zig Rewrite
|
||||
|
||||
## Config Options
|
||||
|
||||
res/config.ini contains all of the available config options and their default values.
|
||||
|
||||
### Additions
|
||||
|
||||
+ border\_fg has been introduced to change the color of the borders.
|
||||
+ term\_restore\_cursor\_cmd should restore the cursor to it's usual state.
|
||||
+ sleep\_key and sleep\_cmd.
|
||||
+ log\_path is used to store ly.log and ly.log.old for debugging purposes (pretty much nothing is logged currently).
|
||||
|
||||
Note: sleep\_cmd is unset by default, meaning it's hidden and has no effect.
|
||||
|
||||
### Changes
|
||||
|
||||
+ xinitrc can be set to null to hide it.
|
||||
+ blank\_password has been renamed to clear\_password.
|
||||
|
||||
### Removals
|
||||
|
||||
+ wayland\_specifier has been removed.
|
||||
|
||||
## Save File
|
||||
|
||||
The save file is now in .ini format.
|
||||
|
||||
Example:
|
||||
|
||||
```ini
|
||||
user = ash
|
||||
session_index = 0
|
||||
```
|
||||
|
||||
## Misc
|
||||
|
||||
+ getty@tty2 has been added as a conflict in res/ly.service, so if it is running, ly should still be able to start.
|
||||
+ XDG\_CURRENT\_DESKTOP is now set by ly.
|
||||
+ LANG is no longer set by ly.
|
||||
+ X Server PID is fetched from /tmp/X{d}.lock to be able to kill the process since it detaches.
|
@ -1,47 +0,0 @@
|
||||
const std = @import("std");
|
||||
const ini = @import("ini");
|
||||
const Config = @import("Config.zig");
|
||||
const Lang = @import("Lang.zig");
|
||||
|
||||
const Allocator = std.mem.Allocator;
|
||||
|
||||
pub const CONFIG_MAX_SIZE: u64 = 8 * 1024;
|
||||
|
||||
const ConfigReader = @This();
|
||||
|
||||
allocator: Allocator,
|
||||
config_allocated: bool = false,
|
||||
lang_allocated: bool = false,
|
||||
config: []u8 = undefined,
|
||||
lang: []u8 = undefined,
|
||||
|
||||
pub fn init(config_allocator: Allocator) ConfigReader {
|
||||
return .{
|
||||
.allocator = config_allocator,
|
||||
};
|
||||
}
|
||||
|
||||
pub fn deinit(self: ConfigReader) void {
|
||||
if (self.config_allocated) self.allocator.free(self.config);
|
||||
if (self.lang_allocated) self.allocator.free(self.lang);
|
||||
}
|
||||
|
||||
pub fn readConfig(self: *ConfigReader, path: []const u8) !Config {
|
||||
var file = std.fs.cwd().openFile(path, .{}) catch return Config.init();
|
||||
defer file.close();
|
||||
|
||||
self.config = try file.readToEndAlloc(self.allocator, CONFIG_MAX_SIZE);
|
||||
self.config_allocated = true;
|
||||
|
||||
return try ini.readToStruct(Config, self.config);
|
||||
}
|
||||
|
||||
pub fn readLang(self: *ConfigReader, path: []const u8) !Lang {
|
||||
var file = std.fs.cwd().openFile(path, .{}) catch return Lang.init();
|
||||
defer file.close();
|
||||
|
||||
self.lang = try file.readToEndAlloc(self.allocator, CONFIG_MAX_SIZE);
|
||||
self.lang_allocated = true;
|
||||
|
||||
return try ini.readToStruct(Lang, self.lang);
|
||||
}
|
Loading…
Reference in New Issue