Add an icon size setting (#3)
Launcher / test (push) Successful in 1m59s
Launcher / apk (push) Successful in 38s

This commit was merged in pull request #3.
This commit is contained in:
nandi committed 2026-11-24 22:43:04 +00:00
1 parent 3070db4fb4
commit 472a48f4bd
22 files changed
+901 -51

No files matched your search

+4
View File
@@ -133,6 +133,10 @@ extern "js" fn now_ms() -> Double =
extern "js" fn storage_get(k : String) -> String =
#|(k) => { try { return localStorage.getItem(k) ?? "" } catch { return "" } }
///|
extern "js" fn log_error(line : String) -> Unit =
#|(line) => console.error(line)
///|
extern "js" fn storage_has(k : String) -> Bool =
#|(k) => { try { return localStorage.getItem(k) !== null } catch { return false } }
+8 -1
View File
@@ -170,6 +170,8 @@ fn exec(e : @app.Effect) -> Unit {
dispatch(LimitsKnown(id, Some(json)))
}
SaveHome(json) => storage_set("launcher.home", json)
SaveIconSize(pct) => storage_set("launcher.iconSize", pct.to_string())
LogError(line) => log_error(line)
SaveLastCheck(t) => storage_set("launcher.update.lastCheck", t.to_string())
Delay(ms, msg) => set_timeout(ms, fn() { dispatch(msg) })
HoldTimer(ms, token) => set_timeout(ms, fn() { feed(Hold(token)) })
@@ -518,7 +520,12 @@ fn main {
None
}
let legacy = if saved is None { Some(storage_legacy()) } else { None }
dispatch(Restore(saved~, legacy~))
let icon_size = if storage_has("launcher.iconSize") {
Some(storage_get("launcher.iconSize"))
} else {
None
}
dispatch(Restore(saved~, legacy~, icon_size~))
if is_android() {
// the shell keeps the build whose install the user cancelled (-1: none)
let declined = h_declined_version()
+20 -5
View File
@@ -135,14 +135,19 @@ body { margin: 0; min-height: 100vh; color: #fff; -webkit-tap-highlight-color: t
.tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: .4rem;
padding: .35rem .15rem; border-radius: calc(var(--radius) + 4px); cursor: pointer; }
.tile:active { background: rgb(255 255 255 / .12); }
.icon { width: 3.25rem; height: 3.25rem; object-fit: contain; pointer-events: none;
/* --s is the icon size setting as a factor (1 = the original size); the model sets it on
the home grid, the drawer list and the sheet's preview, and picks the row height and
column count to match (app/view.mbt, grid/scale.mbt). */
.icon { width: calc(3.25rem * var(--s, 1)); height: calc(3.25rem * var(--s, 1)); object-fit: contain; pointer-events: none;
filter: drop-shadow(0 2px 4px rgb(0 0 0 / .3)); }
.icon.missing { border-radius: 999px; background: rgb(255 255 255 / .18); object-position: -999px 0; }
.name { max-width: 100%; font-size: .75rem; line-height: 1.2; text-align: center;
.name { max-width: 100%; font-size: calc(.75rem * var(--s, 1)); line-height: 1.2; text-align: center;
text-shadow: var(--shadow-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slots .tile { gap: .25rem; padding: .2rem .1rem; }
.slots .icon { width: 2.5rem; height: 2.5rem; }
.slots .name { font-size: .68rem; }
.slots .tile, .icon-preview .tile { gap: calc(.25rem * var(--s, 1)); padding: calc(.2rem * var(--s, 1)) .1rem; }
.slots .icon, .icon-preview .icon { width: calc(2.5rem * var(--s, 1)); height: calc(2.5rem * var(--s, 1)); }
.slots .name, .icon-preview .name { font-size: calc(.68rem * var(--s, 1)); }
.drawer .apps { gap: calc(1.25rem * var(--s, 1)) .5rem; }
.drawer .tile { gap: calc(.4rem * var(--s, 1)); }
/* A widget takes whole rows. On a phone the native widget view covers the slot;
the label only shows while the slot is not live (or in a desktop browser). */
@@ -263,6 +268,16 @@ button { cursor: pointer; }
background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.sheet-item:hover, .sheet-item:active { background: var(--accent); }
.sheet .empty { text-shadow: none; color: var(--muted-foreground); }
/* ---- icon size sheet */
.icon-preview { list-style: none; margin: 0 0 1rem; padding: .75rem .5rem; display: flex; justify-content: space-around;
align-items: flex-start; min-height: 6rem; overflow: hidden; border-radius: var(--radius);
background: rgb(10 10 14 / .84); color: #fff; }
.icon-preview .tile { flex: 1 1 0; min-width: 0; cursor: default; }
.icon-size-row { display: flex; align-items: center; gap: .75rem; margin: 0 .5rem 1rem; }
.icon-size-slider { flex: 1; min-width: 0; height: 2rem; accent-color: var(--primary); touch-action: pan-y; }
.icon-size-value { min-width: 3.25rem; text-align: center; background: var(--secondary); }
.icon-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: 0 .25rem 1rem; }
.icon-error { margin: 0 .25rem 1rem; }
.widget-list { list-style: none; margin: 0; padding: 0; display: grid; }
.widget-list li { display: flex; align-items: center; gap: .75rem; padding: .5rem; border-radius: var(--radius);
cursor: pointer; }