Carousel: the other four pills in the row's order, two left and two right of the card, so the left-most stay left-most; none changes sides on opening

This commit is contained in:
server2
2026-10-20 14:30:39 +02:00
parent 0457830aba
commit c0fff44bcf
2 changed files with 15 additions and 11 deletions
+1 -1
View File
@@ -113,7 +113,7 @@ Whether the open card takes the song cover's colours instead (`appearance.colors
## Side pills
Two small one-icon pills sit left of the island and two right of it, on every monitor, each in its own colour (`pills.colors.*`; Home's follows the sky). A click grows a pill into a big card in the middle of the top of the screen; meanwhile the row becomes a carousel: the other pills and the island's pill line up left and right of the card in their usual order, and clicking one switches straight to its card (the island's pill closes the card, then opens the island). A closing card shrinks back into its own pill's place. Only one card is open across the shell. Esc, the cross or a click elsewhere closes it.
Two small one-icon pills sit left of the island and two right of it, on every monitor, each in its own colour (`pills.colors.*`; Home's follows the sky). A click grows a pill into a big card in the middle of the top of the screen; meanwhile the row becomes a carousel: the other pills and the island's pill line up two left and two right of the card in their usual order (around Home: AI and System left, the island and the bell right), and clicking one switches straight to its card (the island's pill closes the card, then opens the island). A closing card shrinks back into its own pill's place. Only one card is open across the shell. Esc, the cross or a click elsewhere closes it.
- **AI** (sparkle): a chat with a local Ollama model, `gemma4:e4b` at `http://localhost:11434` by default; the model chip in its header lists the installed models and switches at once. Answers stream in through curl. When Ollama doesn't answer, the shell starts the OpenRC service with `doas rc-service ollama start` (`pills.ai.start_service`). Stop ends an answer and New chat starts over. Nothing leaves the machine.
- **System** (pulse): CPU, the integrated GPU's clock, the external GPU's load (with its video memory and the programs on it, formerly in the control centre), memory, swap, network and disk read/write as graphs over the last minute, plus the hottest sensors with icons, in cool/warm/hot colours (`pills.monitor.warm|hot`). Everything is read from `/proc` and `/sys`, so there is no process list. Processes opens `ghostty --class=amane.monitor -e btm` on the special workspace `monitor`; a second press shows or hides it.
+14 -10
View File
@@ -303,15 +303,15 @@ fn index(item: Item) -> usize {
}
/*
* the two items on each side of `open`'s card, always: the row's order going round, so
* the ones past an end of the row come in on the other side (around Home: System and the
* island on its left, the bell and AI on its right)
* the two items on each side of `open`'s card: the other four in the row's order, the
* first two on its left and the last two on its right, so the left-most stays left-most
* (around Home: AI and System on its left, the island and the bell on its right; around
* AI: System and the island on its left, Home and the bell on its right)
*/
fn beside(open: Pod) -> ([Item; 2], [Item; 2]) {
let (count, at) = (ROW.len(), index(Item::Pod(open)));
let step = |by: usize| ROW[(at + by) % count];
let others: Vec<Item> = ROW.into_iter().filter(|item| *item != Item::Pod(open)).collect();
([step(count - 2), step(count - 1)], [step(1), step(2)])
([others[0], others[1]], [others[2], others[3]])
}
// an item's left edge in the carousel around `open`'s card, `card_w` wide, in the middle, and its side of the card (-1, 0 for the card's own, 1)
@@ -340,9 +340,13 @@ fn carousel(item: Item, open: Pod, card_w: f32, middle: f32) -> (f32, i8) {
}
}
// an item's side of `open` in the closed row
fn closed_side(item: Item, open: Pod) -> i8 {
(index(item) as i8 - index(Item::Pod(open)) as i8).signum()
/*
* an item's side of the middle in the closed row, where every card opens: AI and System
* left, the island in it (0, so it slides out to whichever side it goes), Home and the
* bell right. no item changes sides on opening, so none crosses the card
*/
fn closed_side(item: Item) -> i8 {
(index(item) as i8 - index(Item::Island) as i8).signum()
}
/*
@@ -408,7 +412,7 @@ impl Scene {
None => (now.0, 1.0, now.1),
};
let (x, shown) = travel((closed, closed_side(item, open)), (open_x, open_side), self.row_grow);
let (x, shown) = travel((closed, closed_side(item)), (open_x, open_side), self.row_grow);
(x, shown * open_shown)
}