docs: automate gif generation

This commit is contained in:
Willem Vanhulle committed 2026-10-16 11:42:52 +02:00
1 parent a39797cbd2
commit 04219bb58e
18 files changed
+375 -153

No files matched your search

+13 -8
View File
@@ -21,6 +21,7 @@ pub struct Console {
foreground: Option<ForegroundVt>,
for_system: bool,
pub glyphs: Glyphs,
pub bold_is_brightness: bool,
}
impl Console {
@@ -38,6 +39,7 @@ impl Console {
},
for_system,
glyphs: font_glyphs(),
bold_is_brightness: own_vt().is_some(),
}
}
@@ -163,16 +165,19 @@ fn active_vt() -> Option<u16> {
Some(state.active)
}
fn own_vt() -> Option<u16> {
let name = ttyname(stdin(), Vec::new()).ok()?;
name.to_str()
.ok()?
.strip_prefix(VIRTUAL_TERMINAL_PREFIX)?
.parse()
.ok()
.filter(|number| *number > 0)
}
impl ForegroundVt {
fn take() -> Option<Self> {
let name = ttyname(stdin(), Vec::new()).ok()?;
let own: u16 = name
.to_str()
.ok()?
.strip_prefix(VIRTUAL_TERMINAL_PREFIX)?
.parse()
.ok()
.filter(|number| *number > 0)?;
let own = own_vt()?;
let previous = active_vt()?;
if previous != own {
activate(own).ok()?;
+11
View File
@@ -22,6 +22,7 @@ use ratatui::{
DefaultTerminal,
backend::Backend,
buffer::{Buffer, CellDiffOption},
style::Modifier,
};
use rustix::{
event::{PollFd, PollFlags, poll},
@@ -130,6 +131,13 @@ fn overwrite_every_cell<B: Backend>(backend: &mut B, frame: &Buffer) -> Result<(
backend.flush()
}
fn drop_bold(frame: &mut Buffer) {
frame
.content
.iter_mut()
.for_each(|cell| cell.modifier.remove(Modifier::BOLD));
}
fn watch(
state: &mut BootState,
feed: &mut Feed,
@@ -180,6 +188,9 @@ fn watch(
},
canvas.area(),
);
if console.bold_is_brightness {
drop_bold(canvas.buffer_mut());
}
})?;
if repaint_due {
let painted = completed.buffer.clone();