mod: adjust layout and style of widgets and header links

This commit is contained in:
2024-10-19 16:11:08 +02:00
parent 49caf89287
commit 03a4b571d3
2 changed files with 21 additions and 4 deletions

View File

@@ -110,16 +110,25 @@ pub fn main() !void {
.border = .{ .where = .all }, .border = .{ .where = .all },
})); }));
// should be 120 characters wide and centered horizontally
var view_port_x_off: usize = undefined;
var limit: usize = 120;
if (root_window.width / 2 -| 60 > 0) {
view_port_x_off = root_window.width / 2 -| 60;
} else {
view_port_x_off = 1;
limit = root_window.width - 1;
}
view_port.draw(root_window.child(.{ view_port.draw(root_window.child(.{
.x_off = root_window.width / 8, .x_off = view_port_x_off,
.y_off = 3, .y_off = 3,
.width = .{ .limit = root_window.width / 2 + (root_window.width / 4) }, .width = .{ .limit = limit },
})); }));
if (active_menu) { if (active_menu) {
menu.draw(root_window.child(.{ menu.draw(root_window.child(.{
.x_off = root_window.width / 2 - 25, .x_off = root_window.width / 2 -| 25,
.y_off = root_window.height / 2 - 10, .y_off = root_window.height / 2 -| 10,
.width = .{ .limit = 50 }, .width = .{ .limit = 50 },
.height = .{ .limit = 20 }, .height = .{ .limit = 20 },
.border = .{ .where = .all }, .border = .{ .where = .all },

View File

@@ -66,6 +66,10 @@ fn fillView(this: *@This()) void {
const cell: vaxis.Cell = .{ const cell: vaxis.Cell = .{
.link = .{ .uri = "https://github.com/yves-biener" }, .link = .{ .uri = "https://github.com/yves-biener" },
.char = .{ .grapheme = "github" }, .char = .{ .grapheme = "github" },
.style = .{
.fg = .{ .index = 3 },
.ul_style = .single,
},
}; };
this.view.?.writeCell(this.view.?.screen.width - 9, 0, cell); this.view.?.writeCell(this.view.?.screen.width - 9, 0, cell);
} }
@@ -74,6 +78,10 @@ fn fillView(this: *@This()) void {
const cell: vaxis.Cell = .{ const cell: vaxis.Cell = .{
.link = .{ .uri = "mailto:yves.biener@gmx.de" }, .link = .{ .uri = "mailto:yves.biener@gmx.de" },
.char = .{ .grapheme = "mail" }, .char = .{ .grapheme = "mail" },
.style = .{
.fg = .{ .index = 3 },
.ul_style = .single,
},
}; };
this.view.?.writeCell(this.view.?.screen.width - 16, 0, cell); this.view.?.writeCell(this.view.?.screen.width - 16, 0, cell);
} }