Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ The layout (tabs, splits, each remote pane's host and session) is saved to
`~/.config/hqterm/desktop-layout.json`, and the next launch reattaches every
remote pane to its hqsh session; local panes come back as fresh shells.
Settings: `~/.config/hqterm/desktop.json`, e.g.
`{"fontFamily": "JetBrains Mono", "fontSize": 14, "theme": {"background": "#000"}, "restore": true}`.
`{"fontFamily": "JetBrains Mono", "fontSize": 16, "theme": {"background": "#000"}, "restore": true}`
(the default font size is 15).

Develop: `cd desktop && npm install && npm start` (needs bun and a C++
toolchain for node-pty); `npm run dist` builds the AppImage.
Expand Down
21 changes: 20 additions & 1 deletion desktop/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function loadConfig() {
const c = readJson(configFile()) || {};
return {
fontFamily: typeof c.fontFamily === "string" && c.fontFamily.trim() ? c.fontFamily : "monospace",
fontSize: Number.isFinite(c.fontSize) && c.fontSize >= 6 && c.fontSize <= 72 ? c.fontSize : 14,
fontSize: Number.isFinite(c.fontSize) && c.fontSize >= 6 && c.fontSize <= 72 ? c.fontSize : 15,
theme: c.theme && typeof c.theme === "object" ? c.theme : undefined,
restore: c.restore !== false,
gpu: c.gpu !== false,
Expand Down Expand Up @@ -338,6 +338,25 @@ if (!app.requestSingleInstanceLock()) {
console.log(`hqterm-desktop smoke: screenshot failed: ${err && err.message}`);
}
}
// Every pane's rows must fit inside the pane: a fit that ignores the
// pane's padding cuts the last row off at the bottom.
let clipped = [];
try {
clipped = win
? await win.webContents.executeJavaScript(`[...document.querySelectorAll(".pane")].flatMap((p) => {
const s = p.querySelector(".xterm-screen");
if (!s) return [];
const a = p.getBoundingClientRect(), b = s.getBoundingClientRect();
return b.bottom > a.bottom + 0.5 || b.right > a.right + 0.5
? [\`screen \${Math.round(b.width)}x\${Math.round(b.height)} in pane \${Math.round(a.width)}x\${Math.round(a.height)}\`]
: [];
})`)
: [];
} catch {}
if (clipped.length) {
console.log(`hqterm-desktop smoke: clipped: ${clipped.join("; ")}`);
return app.exit(4);
}
console.log(`hqterm-desktop smoke: ok (ptys=${ptys.size})`);
app.exit(ptys.size > 0 ? 0 : 3);
}, wait);
Expand Down
4 changes: 2 additions & 2 deletions desktop/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion desktop/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "hqterm-desktop",
"productName": "hqterm",
"version": "0.2.4",
"version": "0.2.5",
"description": "hqterm desktop: a terminal window that shows hqtui/qc images and HD emoji (xterm.js + node-pty).",
"license": "MIT",
"author": "Profullstack, Inc. <hello@profullstack.com>",
Expand Down
19 changes: 17 additions & 2 deletions desktop/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -617,9 +617,24 @@
true,
);

window.addEventListener("resize", () => {
const fitAll = () => {
for (const rt of runtimes.values()) fitSoon(rt);
});
};
window.addEventListener("resize", fitAll);
// The cell size changes without the pane changing size when a font finishes
// loading or the window moves to a screen with another scale factor; refit
// then too, or the last row is cut off until the next window resize.
document.fonts.addEventListener("loadingdone", fitAll);
(function watchScale() {
matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`).addEventListener(
"change",
() => {
fitAll();
watchScale();
},
{ once: true },
);
})();

// ---------- start ----------

Expand Down
7 changes: 6 additions & 1 deletion desktop/src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ button.icon:hover img {
flex: 1;
min-width: 0;
min-height: 0;
padding: 4px 0 0 6px;
position: relative;
overflow: hidden;
outline: 1px solid transparent;
outline-offset: -1px;
}
Expand All @@ -233,8 +233,13 @@ button.icon:hover img {
outline-color: #5ea1ff66;
}

/* The inset lives on .xterm, not .pane: FitAddon sizes rows from the parent's
computed height, which under border-box includes the parent's own padding,
so padding on .pane made it fit one row too many and clip the bottom. It
subtracts the terminal element's padding correctly. */
.pane .xterm {
height: 100%;
padding: 4px 0 0 6px;
}

body.dragging-row,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hqterm",
"version": "0.2.4",
"version": "0.2.5",
"description": "Terminal session manager: persistent hqsh sessions with images and HD emoji, built on hqtui.",
"license": "MIT",
"private": true,
Expand Down
Loading