prime8dev

prime8dev
git clone https://git.prime8.dev/prime8dev.git
Log | Files | Refs | README | LICENSE

commit e39fd98ee2632ece169c40b1b85c960866329fbf
parent 2d9548063db09b652733f64f8a7bec2468ad45f2
Author: Damian Myrda <damian@prime8.dev>
Date:   Wed, 21 Oct 2026 01:56:49 +0000

feat(web): ssh hint in the statusline

Show "$ ssh prime8.dev" in the statusbar; clicking copies it. This
replaces the SSH note that lived in the old about sidebar.

Diffstat:
Minternal/web/scripts/modules/layout.js | 28++++++++++++++++++++++++++++
Minternal/web/styles/footer.css | 30++++++++++++++++++++++++++++++
Minternal/web/templates/partials/footer.gohtml | 1+
3 files changed, 59 insertions(+), 0 deletions(-)

diff --git a/internal/web/scripts/modules/layout.js b/internal/web/scripts/modules/layout.js @@ -21,6 +21,7 @@ export async function initLayout() { await playBootAnimation(); startStatusClock(); + initSSHCopy(); if (!wakaEnabled) return; @@ -154,3 +155,30 @@ async function loadWakaFooter(data = null) { link.style.display = "none"; } } + +function initSSHCopy() { + const button = document.querySelector("#statusbar [data-ssh-copy]"); + const label = button?.querySelector("[data-ssh-command]"); + if (!button || !label || button.dataset.bound === "true") return; + + button.dataset.bound = "true"; + const command = label.textContent.trim(); + button.addEventListener("click", async () => { + const copied = await copyText(command); + label.textContent = copied ? "copied" : "copy failed"; + button.classList.toggle("copied", copied); + setTimeout(() => { + label.textContent = command; + button.classList.remove("copied"); + }, 1200); + }); +} + +async function copyText(text) { + try { + await navigator.clipboard.writeText(text); + return true; + } catch { + return false; + } +} diff --git a/internal/web/styles/footer.css b/internal/web/styles/footer.css @@ -27,3 +27,33 @@ #statusbar .wakatime:hover { opacity: 0.8; } + +#statusbar .ssh { + border: 0; + background: none; + padding: 0; + font: inherit; + color: var(--fg); + cursor: pointer; +} + +#statusbar .ssh .ssh-dollar { + color: var(--green); +} + +#statusbar .ssh .ssh-hint { + color: var(--fg-dim); + margin-left: 6px; +} + +#statusbar .ssh:hover { + color: var(--accent); +} + +#statusbar .ssh.copied { + color: var(--green); +} + +#statusbar .wakatime { + margin-left: 12px; +} diff --git a/internal/web/templates/partials/footer.gohtml b/internal/web/templates/partials/footer.gohtml @@ -2,6 +2,7 @@ <footer id="statusbar"> <span class="time" id="status-time"></span> <span class="spacer"></span> + <button type="button" class="ssh" data-ssh-copy title="copy to clipboard"><span class="ssh-dollar">$</span> <span data-ssh-command>ssh prime8.dev</span><span class="ssh-hint">[copy]</span></button> {{if wakaTimeEnabled}} <a class="wakatime" id="wakatime-link" href="https://wakatime.com/@{{.About.Handle}}" target="_blank" rel="noopener noreferrer">Loading...</a> {{end}}