cheogram-www-2

created pr with cheogram-www-2/stop-simultaneous-tabs.1 on 2026-11-12T21:42:42Z · by 3c31bc8c
commented on 2026-11-12T21:42:42Z · by 3c31bc8c
Changes are available at https://tangled.org/mrry.band/cheogram-www on branch stop-simultaneous-tabs.
added cheogram-www-2/stop-simultaneous-tabs.2 on 2026-11-13T00:24:13Z · by 3c31bc8c
1: 737d18a ! 1: 6e7bffc Prevent running in multiple tabs
cmds
checkout latest patchset:
ssh pr.pico.sh pull cheogram-www-2:stop-simultaneous-tabs | git am -3
checkout specific patchset revision:
ssh pr.pico.sh pull cheogram-www-2:stop-simultaneous-tabs [rev] | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh cheogram-www-2:stop-simultaneous-tabs
add comment to patch request:
ssh pr.pico.sh comment cheogram-www-2:stop-simultaneous-tabs "lgtm!"

Patchset cheogram-www-2/stop-simultaneous-tabs.1 on 2026-11-12T21:42:42Z · commit 737d18a

Prevent running in multiple tabs
Eric Roberts 2026-11-12T01:09:42Z
Because it causes all kinds of problems. I do this regularly and then I
get confused why things are not working.

Separate stylesheet for now until our style update changes are shipped,
and then it can reuse the same root background styling that those
changes will bring.
Semantic diff summary
1 added, 0 modified, 0 signature changed, 0 removed across 1 analyzed file (2 files skipped: unsupported file type)
+1 -1 index.html #
......@@ -10,7 +10,7 @@
1010 <meta name="theme-color" content="#7401cf" />
1111 <base target="_blank" />
1212 <title>%VITE_APP_TITLE%</title>
13- <script type="module" src="/src/index.tsx"></script>
13+ <script type="module" src="/src/bootstrap.tsx"></script>
1414 </head>
1515 <body>
1616 <noscript>You need to enable JavaScript to run this app.</noscript>
+38 -0 src/bootstrap.scss #
......@@ -0,0 +1,38 @@
1+.startup-message {
2+ position: fixed;
3+ inset: 0;
4+ overflow: auto;
5+ box-sizing: border-box;
6+ display: flex;
7+ flex-direction: column;
8+ align-items: center;
9+ justify-content: center;
10+ padding: 2rem;
11+ font-family: system-ui;
12+ text-align: center;
13+ background:
14+ url(/gloop01.svg) top left / min(50vh, 100vw) auto no-repeat,
15+ url(/gloop02.svg) bottom right / min(50vh, 100vw) auto no-repeat,
16+ #7401cf;
17+ color: white;
18+
19+ > p {
20+ max-width: 22rem;
21+ }
22+
23+ > button {
24+ border: 0;
25+ border-radius: 10em;
26+ padding: 1em 2em;
27+ margin-top: 1em;
28+ font: inherit;
29+ color: #1e0038;
30+ background: #ffc700;
31+ cursor: pointer;
32+
33+ &:focus-visible {
34+ outline: 2px solid white;
35+ outline-offset: 4px;
36+ }
37+ }
38+}
+33 -0 src/bootstrap.tsx #
......@@ -0,0 +1,33 @@
1+import { createRoot } from "react-dom/client";
2+import "./bootstrap.scss";
3+
4+async function start() {
5+ if (!navigator.locks) {
6+ await import("./index");
7+ return;
8+ }
9+ await navigator.locks.request(
10+ "cheogram-active-tab",
11+ { ifAvailable: true },
12+ async (lock) => {
13+ if (!lock) {
14+ createRoot(document.getElementById("root")!).render(
15+ <main className="startup-message">
16+ <p role="status">
17+ Cheogram is already running in another tab or window. Close it,
18+ then try again here.
19+ </p>
20+ <button onClick={() => window.location.reload()}>Try again</button>
21+ </main>,
22+ );
23+ return;
24+ }
25+ await import("./index").catch(console.error);
26+
27+ // https://github.com/w3c/web-locks/blob/main/EXPLAINER.md#can-you-hold-a-lock-for-the-lifetime-of-a-tab
28+ await new Promise<void>(() => {});
29+ },
30+ );
31+}
32+
33+void start();
Back to top