LordOS — a free, fast and secure GNU/Linux distribution based on Debian, with its own desktop environment: display server and Wayland compositor in C, a React UI engine on QuickJS, and private native apps.
C cdebiandesktop-environmentebpffirewalllandlocklinuxlinux-distributionopen-sourceprivacyquickjsraspberry-pi-5reactsecuritywaylandwayland-compositor
Classic theme: a second full appearance (taskbar, start menu, quick settings, notifications, snapping, task view)
Federico Pereira936df18fda1e
diff --git a/themes/classic/components/Menu.jsx b/themes/classic/components/Menu.jsxnew file mode 100644index 0000000..cd17d53--- /dev/null+++ b/themes/classic/components/Menu.jsx@@ -0,0 +1,72 @@+// A small menu at a point of the screen, in the popover layer (docs/LAYERS.md): the taskbar's jump+// lists, the Trash, the desktop, a window's title bar and the start menu's right click.+// items: [{ label, onClick, disabled, checked, destructive, hint } | '-']; submenus are flattened.+// Keyboard: ↑/↓, Enter, Escape. `above`: the menu ends at y (a bottom taskbar) instead of starting there.+import { View, Text, Layer, ScrollView, screen, addListener, takeTextFocus, releaseTextFocus, direction } from '@lordos/sdk';+import { useEffect, useRef, useState } from 'react';++const ROW = 30, SEP = 9;++export function flatten(items) {+ const out = [];+ for (const it of items || []) {+ if (it && it !== '-' && it.submenu) { if (out.length && out[out.length - 1] !== '-') out.push('-'); out.push(...it.submenu); }+ else if (it) out.push(it);+ }+ while (out[0] === '-') out.shift();+ while (out[out.length - 1] === '-') out.pop();+ return out.filter((it, i) => !(it === '-' && out[i - 1] === '-'));+}++export function Menu({ t, items: raw, x, y, above, onClose, width = 240 }) {+ const items = flatten(raw);+ const ref = useRef(null);+ const [active, setActive] = useState(-1);+ const st = useRef({});+ st.current = { items, active };+ const ok = (it) => it && it !== '-' && !it.disabled;+ useEffect(() => {+ const offPtr = addListener('pointerdown', (e) => {+ for (let n = e.target; n; n = n.parent) if (n === ref.current) return;+ onClose();+ });+ const tok = {};+ takeTextFocus(tok, (e) => {+ const { items: list, active: a } = st.current;+ const step = (d) => { for (let k = 1; k <= list.length; k++) { const i = ((a < 0 && d < 0 ? 0 : a) + d * k + list.length * 2) % list.length; if (ok(list[i])) { setActive(i); return; } } };+ if (e.key === 'Escape') onClose();+ else if (e.key === 'ArrowDown') step(1);+ else if (e.key === 'ArrowUp') step(-1);+ else if ((e.key === 'Enter' || e.key === ' ') && ok(list[a])) { onClose(); list[a].onClick?.(); }+ });+ return () => { offPtr(); releaseTextFocus(tok); };+ }, []);+ const H = items.reduce((h, it) => h + (it === '-' ? SEP : ROW), 10);+ const maxH = Math.max(120, screen.height - 24);+ const h = Math.min(H, maxH);+ // in right-to-left languages the menu opens toward the left of the point+ const rtl = direction() === 'rtl';+ let left = rtl ? x - width : x;+ left = Math.max(6, Math.min(left, screen.width - width - 6));+ let top = above ? y - h : y;+ top = Math.max(6, Math.min(top, screen.height - h - 6));+ const rows = items.map((it, i) => (it === '-'+ ? <View key={i} style={{ height: 1, backgroundColor: t.separator, marginVertical: 4, marginHorizontal: 6 }} />+ : (+ <View key={i} onMouseEnter={() => setActive(ok(it) ? i : -1)} onClick={() => { if (it.disabled) return; onClose(); it.onClick?.(); }}+ style={{ flexDirection: 'row', alignItems: 'center', height: ROW, paddingHorizontal: 10, gap: 8, borderRadius: t.menuItemRadius,+ backgroundColor: i === active ? t.hover : 'transparent', opacity: it.disabled ? 0.45 : 1 }}>+ <Text style={{ width: 14, fontSize: 12, color: t.accent }}>{it.checked ? '✓' : ''}</Text>+ <Text style={{ flex: 1, fontSize: 13, color: it.destructive ? t.closeHover : t.text, whiteSpace: 'nowrap', textOverflow: 'ellipsis', textAlign: 'start' }}>{it.label}</Text>+ {it.hint ? <Text style={{ fontSize: 11, color: t.textDim }}>{it.hint}</Text> : null}+ </View>+ )));+ return (+ <Layer name="popover">+ <View ref={ref} style={{ position: 'absolute', left, top, width, padding: 5, borderRadius: t.menuRadius,+ backgroundColor: t.panelBg, backdropFilter: t.blur ? `blur(${t.blur}px)` : undefined, border: `1px solid ${t.windowBorder}`, boxShadow: t.shadow }}>+ {H > maxH ? <ScrollView style={{ height: maxH - 10 }}>{rows}</ScrollView> : rows}+ </View>+ </Layer>+ );+}diff --git a/themes/classic/components/NotificationCenter.jsx b/themes/classic/components/NotificationCenter.jsxnew file mode 100644index 0000000..ea412dd--- /dev/null+++ b/themes/classic/components/NotificationCenter.jsx@@ -0,0 +1,147 @@+// The notification panel, from the clock: this session's notifications (sdk/notify.js+// notifyHistory) grouped by app, with Do Not Disturb and "Clear all", and a month calendar below.+import {+ View, Text, ScrollView, Toggle, useStore, notifyHistory, clearNotifyHistory, settings, notifyPrefs, dndActive, useSettings,+ getApp, appName, formatTime, formatDate, monthName, weekdayName, locale, addListener, wm, t as tr,+} from '@lordos/sdk';+import { useEffect, useRef, useState } from 'react';+import { BellGlyph, CloseGlyph, Chevron } from '../glyphs.jsx';++const W = 380;++function Item({ t, n, onRemove }) {+ const [hover, setHover] = useState(false);+ return (+ <View onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}+ style={{ padding: 10, paddingEnd: 28, gap: 2, borderRadius: 6, backgroundColor: t.tile, border: `1px solid ${t.tileBorder}` }}>+ <View style={{ flexDirection: 'row', gap: 8 }}>+ <Text style={{ flex: 1, fontSize: 13, fontWeight: 600, color: t.text, textAlign: 'start', whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{n.title}</Text>+ <Text style={{ fontSize: 11, color: t.textDim }}>{formatTime(new Date(n.time))}</Text>+ </View>+ {n.body ? <Text style={{ fontSize: 12, color: t.textDim, lineHeight: 1.35, textAlign: 'start', numberOfLines: 3 }}>{n.body}</Text> : null}+ {hover ? (+ <View onClick={onRemove} style={{ position: 'absolute', top: 8, insetInlineEnd: 6, width: 18, height: 18, borderRadius: 4, alignItems: 'center', justifyContent: 'center',+ backgroundColor: t.hover }}>+ <CloseGlyph color={t.textDim} size={9} />+ </View>+ ) : null}+ </View>+ );+}++function MonthCalendar({ t }) {+ const today = new Date();+ const [cur, setCur] = useState(() => new Date(today.getFullYear(), today.getMonth(), 1));+ const first = (locale.get().lang || 'en').startsWith('en') ? 0 : 1; // the week starts on Sunday in English+ const y = cur.getFullYear(), m = cur.getMonth();+ const lead = (new Date(y, m, 1).getDay() - first + 7) % 7;+ const days = new Date(y, m + 1, 0).getDate();+ const cells = [...Array(lead).fill(null), ...Array.from({ length: days }, (_, i) => i + 1)];+ while (cells.length % 7) cells.push(null);+ const isToday = (d) => d && y === today.getFullYear() && m === today.getMonth() && d === today.getDate();+ const cell = (W - 32) / 7;+ return (+ <View style={{ gap: 6 }}>+ <View style={{ flexDirection: 'row', alignItems: 'center' }}>+ <Text style={{ flex: 1, fontSize: 13, fontWeight: 600, color: t.text, textAlign: 'start' }}>{`${monthName(m)} ${y}`}</Text>+ <View style={{ flexDirection: 'row', gap: 2, direction: 'ltr' }}>+ <View onClick={() => setCur(new Date(y, m - 1, 1))} style={{ width: 28, height: 28, borderRadius: 4, alignItems: 'center', justifyContent: 'center' }}>+ <Chevron color={t.text} size={6} dir="up" />+ </View>+ <View onClick={() => setCur(new Date(y, m + 1, 1))} style={{ width: 28, height: 28, borderRadius: 4, alignItems: 'center', justifyContent: 'center' }}>+ <Chevron color={t.text} size={6} dir="down" />+ </View>+ </View>+ </View>+ <View style={{ flexDirection: 'row' }}>+ {Array.from({ length: 7 }, (_, i) => (+ <Text key={i} style={{ width: cell, fontSize: 11, color: t.textDim, textAlign: 'center' }}>{weekdayName((i + first) % 7).slice(0, 2)}</Text>+ ))}+ </View>+ <View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>+ {cells.map((d, i) => (+ <View key={i} onClick={d ? () => wm.open('calendar', { args: { at: new Date(y, m, d, 9).getTime() } }) : undefined}+ style={{ width: cell, height: 32, alignItems: 'center', justifyContent: 'center' }}>+ {d ? (+ <View style={{ width: 28, height: 28, borderRadius: 14, alignItems: 'center', justifyContent: 'center', backgroundColor: isToday(d) ? t.accent : 'transparent' }}>+ <Text style={{ fontSize: 12, color: isToday(d) ? '#fff' : t.text, fontWeight: isToday(d) ? 600 : 400 }}>{d}</Text>+ </View>+ ) : null}+ </View>+ ))}+ </View>+ </View>+ );+}++export function NotificationCenter({ t, at, onClose, isOnBar }) {+ const ref = useRef(null);+ const list = useStore(notifyHistory);+ useSettings();+ useEffect(() => addListener('pointerdown', (e) => {+ for (let n = e.target; n; n = n.parent) if (n === ref.current) return;+ if (!isOnBar(e.x, e.y)) onClose();+ }), []);+ useEffect(() => addListener('keydown', (e) => { if (e.key === 'Escape') onClose(); }), []);+ const dnd = dndActive();+ const setDnd = (on) => settings.set((x) => ({ ...x, notifications: { ...notifyPrefs(x), dnd: !!on } }));+ const groups = [];+ const byKey = new Map();+ for (const n of list) {+ const k = n.app || n.label || '';+ if (!byKey.has(k)) { const g = { key: k, items: [] }; byKey.set(k, g); groups.push(g); }+ byKey.get(k).items.push(n);+ }+ const remove = (id) => notifyHistory.set((l) => l.filter((x) => x.id !== id));+ const calH = 300;+ const listH = Math.max(140, at.height - calH - 12);+ const panel = (children, h, extra) => (+ <View style={{ width: W, height: h, borderRadius: 10, overflow: 'hidden', backgroundColor: t.panelBg,+ backdropFilter: t.blur ? `blur(${t.blur}px)` : undefined, border: `1px solid ${t.windowBorder}`, boxShadow: t.shadow, ...extra }}>{children}</View>+ );+ return (+ <View ref={ref} style={{ position: 'absolute', left: at.left, top: at.top, width: W, gap: 12 }}>+ {panel(+ <View style={{ flex: 1 }}>+ <View style={{ height: 48, flexDirection: 'row', alignItems: 'center', paddingHorizontal: 16, gap: 10 }}>+ <Text style={{ flex: 1, fontSize: 14, fontWeight: 600, color: t.text, textAlign: 'start' }}>{tr('shell.classic.notifications')}</Text>+ <Text style={{ fontSize: 11, color: t.textDim }}>{tr('shell.classic.dnd')}</Text>+ <Toggle small on={dnd} onChange={setDnd} />+ {list.length ? (+ <View onClick={clearNotifyHistory} style={{ height: 26, paddingHorizontal: 10, borderRadius: 4, justifyContent: 'center', backgroundColor: t.control, border: `1px solid ${t.tileBorder}` }}>+ <Text style={{ fontSize: 12, color: t.text }}>{tr('shell.classic.clearAll')}</Text>+ </View>+ ) : null}+ </View>+ {groups.length ? (+ <ScrollView style={{ height: listH - 48 }}>+ <View style={{ paddingHorizontal: 12, paddingBottom: 12, gap: 12 }}>+ {groups.map((g) => {+ const app = g.key ? getApp(g.key) : null;+ return (+ <View key={g.key || '-'} style={{ gap: 6 }}>+ <View style={{ flexDirection: 'row', alignItems: 'center', gap: 8, paddingHorizontal: 4 }}>+ {app?.Icon ? <app.Icon size={16} /> : null}+ <Text style={{ fontSize: 12, fontWeight: 600, color: t.textDim, textAlign: 'start' }}>{app ? appName(app) : g.items[0].label || ''}</Text>+ </View>+ {g.items.slice(0, 6).map((n) => <Item key={n.id} t={t} n={n} onRemove={() => remove(n.id)} />)}+ </View>+ );+ })}+ </View>+ </ScrollView>+ ) : (+ <View style={{ height: listH - 48, alignItems: 'center', justifyContent: 'center', gap: 10 }}>+ <BellGlyph color={t.textDim} size={28} />+ <Text style={{ fontSize: 13, color: t.textDim }}>{tr('shell.classic.noNotifications')}</Text>+ </View>+ )}+ </View>, listH)}+ {panel(+ <View style={{ padding: 16, gap: 8 }}>+ <Text style={{ fontSize: 13, color: t.text, textAlign: 'start' }}>{formatDate(new Date(), 'long')}</Text>+ <MonthCalendar t={t} />+ </View>, calH)}+ </View>+ );+}diff --git a/themes/classic/components/QuickSettings.jsx b/themes/classic/components/QuickSettings.jsxnew file mode 100644index 0000000..82d80fe--- /dev/null+++ b/themes/classic/components/QuickSettings.jsx@@ -0,0 +1,111 @@+// Quick settings, from the tray: toggles for the network, Bluetooth, Do Not Disturb, Night Light,+// dark mode and transparency, the volume, what is playing, the battery and a way into Settings.+// Everything comes from the SDK's stores (sound, Bluetooth, battery, Night Light, notifications);+// nothing here polls except the network glyph (every 5 s, Taskbar.jsx useNet).+import {+ View, Text, Slider, useSettings, settings, useSound, defaultSink, sound, useBluetooth, useBattery, BatteryGlyph, NowPlayingTile,+ nightActive, setNightManual, notifyPrefs, dndActive, wm, addListener, t as tr,+} from '@lordos/sdk';+import { useEffect, useRef, useState } from 'react';+import { NetworkGlyph, BluetoothGlyph, MoonGlyph, SunGlyph, ContrastGlyph, LayersGlyph, SpeakerGlyph, GearGlyph, Chevron } from '../glyphs.jsx';+import { useNet } from './Taskbar.jsx';++const W = 360;+const TILE = Math.floor((W - 2 - 32 - 16) / 3); // three per row (border, padding and gaps out)++function Toggle({ t, on, label, detail, onClick, onMore, children }) {+ const [hover, setHover] = useState(false);+ const fg = on ? '#ffffff' : t.text;+ return (+ <View style={{ width: TILE, gap: 6, alignItems: 'center' }}>+ <View onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}+ style={{ alignSelf: 'stretch', height: 48, borderRadius: 6, flexDirection: 'row', overflow: 'hidden',+ backgroundColor: on ? t.accent : t.tile, border: `1px solid ${on ? t.accent : t.tileBorder}`, opacity: hover ? 0.9 : 1, direction: 'ltr' }}>+ <View onClick={onClick} style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>{children(fg, on ? t.accent : (t.mode === 'dark' ? '#303035' : '#fbfbfc'))}</View>+ {onMore ? (+ <View onClick={onMore} style={{ width: 24, alignItems: 'center', justifyContent: 'center', borderLeftWidth: 1, borderColor: on ? 'rgba(255,255,255,0.3)' : t.tileBorder }}>+ <Chevron color={fg} size={5} dir="right" />+ </View>+ ) : null}+ </View>+ <Text style={{ fontSize: 11, color: t.text, whiteSpace: 'nowrap', textOverflow: 'ellipsis', maxWidth: TILE, textAlign: 'center' }}>{label}</Text>+ {detail ? <Text style={{ fontSize: 10, color: t.textDim, marginTop: -4, whiteSpace: 'nowrap', textOverflow: 'ellipsis', maxWidth: TILE }}>{detail}</Text> : null}+ </View>+ );+}++// at: { pos: { left, top | bottom }, height } — next to the tray, computed by the theme for the taskbar's side+export function QuickSettings({ t, at, onClose, isOnBar }) {+ const ref = useRef(null);+ const [s, set] = useSettings();+ const st = useSound();+ const out = defaultSink(st);+ const bt = useBluetooth();+ const bat = useBattery();+ const net = useNet();+ const adapter = bt?.adapter;+ useEffect(() => addListener('pointerdown', (e) => {+ for (let n = e.target; n; n = n.parent) if (n === ref.current) return;+ if (!isOnBar(e.x, e.y)) onClose();+ }), []);+ useEffect(() => addListener('keydown', (e) => { if (e.key === 'Escape') onClose(); }), []);+ const open = (section, page) => { onClose(); wm.open('settings', { args: { section, ...(page ? { page } : null) } }); };+ const dnd = dndActive();+ const setDnd = (on) => settings.set((x) => ({ ...x, notifications: { ...notifyPrefs(x), dnd: !!on } }));+ const night = nightActive();+ const pct = out ? Math.round(out.level * 100) : 0;+ const H = at.height;+ return (+ <View ref={ref} style={{ position: 'absolute', ...at.pos, width: W, borderRadius: 10, overflow: 'hidden',+ backgroundColor: t.panelBg, backdropFilter: t.blur ? `blur(${t.blur}px)` : undefined, border: `1px solid ${t.windowBorder}`, boxShadow: t.shadow }}>+ <View style={{ padding: 16, gap: 14, maxHeight: H }}>+ <View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 8 }}>+ <Toggle t={t} on={net.online} label={tr('shell.cc.network')} detail={net.online ? (net.vpn ? `${net.name} · VPN` : net.name) : tr('shell.cc.offline')}+ onClick={() => open('network')} onMore={() => open('network', net.vpn ? 'vpn' : undefined)}>+ {(c) => <NetworkGlyph color={c} size={16} off={!net.online} />}+ </Toggle>+ {adapter ? (+ <Toggle t={t} on={!!adapter.powered} label={tr('shell.classic.bluetooth')} onClick={() => lord.bt.power(!adapter.powered)} onMore={() => open('bluetooth')}>+ {(c) => <BluetoothGlyph color={c} size={16} />}+ </Toggle>+ ) : null}+ <Toggle t={t} on={dnd} label={tr('shell.classic.dnd')} onClick={() => setDnd(!dnd)}>+ {(c, bg) => <MoonGlyph color={c} bg={bg} size={16} />}+ </Toggle>+ <Toggle t={t} on={night} label={tr('shell.classic.nightLight')} onClick={() => setNightManual(!night)} onMore={() => open('displays')}>+ {(c) => <SunGlyph color={c} size={16} />}+ </Toggle>+ <Toggle t={t} on={s.mode === 'dark'} label={tr('shell.cc.dark')} onClick={() => set({ mode: s.mode === 'dark' ? 'light' : 'dark' })}>+ {(c) => <ContrastGlyph color={c} size={16} />}+ </Toggle>+ <Toggle t={t} on={s.effects !== false} label={tr('shell.cc.effects')} onClick={() => set({ effects: s.effects === false })}>+ {(c) => <LayersGlyph color={c} size={16} />}+ </Toggle>+ </View>+ {out && st.connected ? (+ <View style={{ flexDirection: 'row', alignItems: 'center', gap: 10, direction: 'ltr' }}>+ <View onClick={() => sound.setMute('sink', out.index, !out.mute)} style={{ width: 28, height: 28, borderRadius: 4, alignItems: 'center', justifyContent: 'center' }}>+ <SpeakerGlyph color={t.text} size={18} level={out.mute || pct === 0 ? 0 : pct < 50 ? 1 : 2} muted={out.mute} />+ </View>+ <Slider value={Math.min(1, out.level)} width={W - 32 - 28 - 10 - 44 - 10} onChange={(v) => sound.setVolume('sink', out.index, v)} />+ <Text style={{ width: 44, fontSize: 12, color: t.textDim, textAlign: 'right' }}>{out.mute ? '—' : `${pct} %`}</Text>+ </View>+ ) : null}+ <NowPlayingTile style={{ borderRadius: 6 }} />+ </View>+ <View style={{ height: 48, flexDirection: 'row', alignItems: 'center', paddingHorizontal: 16, gap: 10, backgroundColor: t.panelFoot,+ borderTopWidth: 1, borderColor: t.separator }}>+ {bat && bat.hasBattery ? (+ <View onClick={() => open('power')} style={{ flexDirection: 'row', alignItems: 'center', gap: 8 }}>+ <BatteryGlyph percent={bat.percent} charging={bat.charging} color={t.text} width={22} />+ <Text style={{ fontSize: 12, color: t.text }}>{bat.percent >= 0 ? `${bat.percent} %` : ''}</Text>+ </View>+ ) : null}+ <View style={{ flex: 1 }} />+ <View onClick={() => open('general')} style={{ width: 32, height: 32, borderRadius: 4, alignItems: 'center', justifyContent: 'center' }}>+ <GearGlyph color={t.text} bg={t.mode === 'dark' ? '#222226' : '#f0f0f2'} size={16} />+ </View>+ </View>+ </View>+ );+}diff --git a/themes/classic/components/StartMenu.jsx b/themes/classic/components/StartMenu.jsxnew file mode 100644index 0000000..367a8eb--- /dev/null+++ b/themes/classic/components/StartMenu.jsx@@ -0,0 +1,257 @@+// The Classic start menu: a search field, the pinned apps (a grid the user arranges), recently used+// apps, every app A–Z, and at the bottom the user and the power button (Lock, Switch User, Log Out,+// Restart…, Shut Down…: the session's own power sheet, sdk/power.jsx). Typing searches like the+// system search (apps, settings, files, notes, calculator, Help…; sdk/spotlight.js searchEverything).+// Right click on an app: pin or unpin it in the start menu or the taskbar; drag it onto the taskbar to+// pin it there. Keyboard: type to search, ↑/↓ and Enter, Escape closes.+import {+ View, Text, ScrollView, SearchField, addListener, t as tr, tOptional, useSettings, settings, useStore,+ useLauncherApps, launchApp, dockIdOf, dock, beginDockDrag, dockDragJustEnded, session, wm, useSystemInfo, searchEverything,+ mainDisplay, direction,+} from '@lordos/sdk';+import { useEffect, useMemo, useRef, useState } from 'react';+import { Menu } from './Menu.jsx';+import { PowerGlyph, Chevron, FolderGlyph, PageGlyph, GearGlyph, SearchGlyph } from '../glyphs.jsx';+import { BAR_H, BAR_W } from './Taskbar.jsx';++export const START_DEFAULT = ['files', 'terminal', 'editor', 'calculator', 'notes', 'photos', 'player', 'mail', 'calendar',+ 'contacts', 'store', 'settings', 'monitor', 'clock', 'help', 'about'];+const COLS = 6;++// The pinned list: the user's (settings.startPinned) or the defaults that are installed.+export function startPins(s, list) {+ const have = new Set(list.map((a) => a.id));+ return (Array.isArray(s.startPinned) ? s.startPinned : START_DEFAULT).filter((id) => have.has(id));+}+export function pinToStart(id, on) {+ const list = settings.get().startPinned;+ const cur = Array.isArray(list) ? list : START_DEFAULT;+ settings.set({ startPinned: on ? [...cur.filter((x) => x !== id), id] : cur.filter((x) => x !== id) });+}++function Tile({ t, a, onOpen, onMenu, onDrag }) {+ const [hover, setHover] = useState(false);+ return (+ <View onClick={() => { if (!dockDragJustEnded()) onOpen(); }} onContextMenu={onMenu} onMouseDown={onDrag}+ onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}+ style={{ width: 92, height: 82, alignItems: 'center', justifyContent: 'center', gap: 6, borderRadius: 6, paddingHorizontal: 4,+ backgroundColor: hover ? t.hover : 'transparent' }}>+ <a.Icon size={32} />+ <Text style={{ fontSize: 12, color: t.text, textAlign: 'center', numberOfLines: 2, maxWidth: 84 }}>{a.name}</Text>+ </View>+ );+}++function Row({ t, Icon, glyph, title, subtitle, selected, onClick, onMenu, onDrag, onHover }) {+ const [hover, setHover] = useState(false);+ return (+ <View onClick={onClick} onContextMenu={onMenu} onMouseDown={onDrag}+ onMouseEnter={() => { setHover(true); onHover?.(); }} onMouseLeave={() => setHover(false)}+ style={{ height: 44, flexDirection: 'row', alignItems: 'center', gap: 12, paddingHorizontal: 10, borderRadius: 6,+ backgroundColor: selected ? t.hover : hover ? t.hover : 'transparent' }}>+ {selected ? <View style={{ position: 'absolute', insetInlineStart: 0, top: 14, width: 3, height: 16, borderRadius: 2, backgroundColor: t.accent }} /> : null}+ <View style={{ width: 28, height: 28, alignItems: 'center', justifyContent: 'center' }}>{Icon ? <Icon size={28} /> : glyph}</View>+ <View style={{ flex: 1, minWidth: 0 }}>+ <Text style={{ fontSize: 13, color: t.text, whiteSpace: 'nowrap', textOverflow: 'ellipsis', textAlign: 'start' }}>{title}</Text>+ {subtitle ? <Text style={{ fontSize: 11, color: t.textDim, whiteSpace: 'nowrap', textOverflow: 'ellipsis', textAlign: 'start' }}>{subtitle}</Text> : null}+ </View>+ </View>+ );+}++function Header({ t, title, action, onAction, back }) {+ return (+ <View style={{ flexDirection: 'row', alignItems: 'center', height: 32, paddingHorizontal: 8 }}>+ <Text style={{ flex: 1, fontSize: 13, fontWeight: 600, color: t.text, textAlign: 'start' }}>{title}</Text>+ {action ? (+ <View onClick={onAction} style={{ flexDirection: 'row', alignItems: 'center', gap: 4, height: 26, paddingHorizontal: 10, borderRadius: 4,+ backgroundColor: t.control, border: `1px solid ${t.tileBorder}` }}>+ {back ? <Chevron color={t.text} size={5} dir={direction() === 'rtl' ? 'right' : 'left'} /> : null}+ <Text style={{ fontSize: 12, color: t.text }}>{action}</Text>+ {back ? null : <Chevron color={t.text} size={5} dir={direction() === 'rtl' ? 'left' : 'right'} />}+ </View>+ ) : null}+ </View>+ );+}++// The glyph of a search result that has no app icon (the system search uses emoji there).+function resultGlyph(t, it, sectionId) {+ if (it.image) return null;+ if (sectionId === 'files') return it.subtitle && it.glyph === '📁' ? <FolderGlyph color={t.accent} size={22} /> : <PageGlyph color={t.textDim} size={22} />;+ if (sectionId === 'settings') return <GearGlyph color={t.textDim} bg={t.panelBg.startsWith('rgba') ? (t.mode === 'dark' ? '#26262b' : '#f6f6f8') : t.panelBg} size={18} />;+ if (sectionId === 'notes') return <PageGlyph color={t.accent} size={22} />;+ const g = it.glyph && /^[=⇄⏎]$/.test(it.glyph) ? it.glyph : '';+ return g ? <Text style={{ fontSize: 18, color: t.accent }}>{g}</Text> : <SearchGlyph color={t.textDim} size={16} />;+}++// box: the panel's place ({ left, top, width, height }, global coordinates)+export function StartMenu({ t, box, onClose, isOnBar }) {+ const ref = useRef(null);+ const list = useLauncherApps();+ const [s] = useSettings();+ const info = useSystemInfo(60000);+ const [query, setQuery] = useState('');+ const [view, setView] = useState('home'); // 'home' | 'all'+ const [ctx, setCtx] = useState(null); // { app, x, y }+ const [power, setPower] = useState(null);+ const [sel, setSel] = useState(0);+ useStore(searchEverything.version());+ useEffect(() => { searchEverything.prepare(); }, []);+ useEffect(() => addListener('pointerdown', (e) => {+ for (let n = e.target; n; n = n.parent) if (n === ref.current) return;+ if (!isOnBar(e.x, e.y)) onClose();+ }), []);+ useEffect(() => setSel(0), [query]);++ const byId = new Map(list.map((a) => [a.id, a]));+ const pins = startPins(s, list).map((id) => byId.get(id)).filter(Boolean);+ const recent = (s.dockRecentApps || []).map((x) => list.find((a) => dockIdOf(a) === dockIdOf(x))).filter(Boolean)+ .filter((a, i, arr) => arr.indexOf(a) === i).slice(0, 6);+ const sorted = useMemo(() => [...list].sort((a, b) => a.name.localeCompare(b.name)), [list]);+ const sections = useMemo(() => (query.trim() ? searchEverything.results(query, list) : []), [query, list]);+ const flat = sections.flatMap((x) => x.items.map((it) => ({ it, sec: x.id })));++ const open = (a) => { onClose(); launchApp(a.id); };+ const drag = (a) => (e) => { if (!e.button && dockIdOf(a)) beginDockDrag({ id: dockIdOf(a), Icon: a.Icon, x: e.x, y: e.y, source: 'launcher', onStart: onClose }); };+ const menu = (a) => (e) => setCtx({ app: a, x: e.x, y: e.y });+ const run = (it) => { if (!it) return; onClose(); searchEverything.run(it); };+ const onKey = (e) => {+ if (!query.trim()) return false;+ if (e.key === 'ArrowDown') { setSel((v) => Math.min(flat.length - 1, v + 1)); return true; }+ if (e.key === 'ArrowUp') { setSel((v) => Math.max(0, v - 1)); return true; }+ if (e.key === 'Enter') { run(flat[Math.min(sel, flat.length - 1)]?.it); return true; }+ return false;+ };++ const name = info.fullName || info.user || '';+ const initials = name.split(/\s+/).filter(Boolean).slice(0, 2).map((w) => w[0].toUpperCase()).join('') || '?';+ const bodyH = box.height - 72 - 64;+ let body;+ if (query.trim()) {+ let k = 0;+ body = (+ <ScrollView style={{ height: bodyH }}>+ {flat.length ? sections.map((sec) => (+ <View key={sec.id} style={{ marginBottom: 6 }}>+ <Text style={{ fontSize: 11, fontWeight: 600, color: t.textDim, marginHorizontal: 10, marginTop: 6, marginBottom: 2, textAlign: 'start' }}>+ {tOptional(`shell.spotlight.section.${sec.id}`) || sec.id}</Text>+ {sec.items.map((it) => {+ const i = k++;+ return <Row key={it.key} t={t} Icon={it.Icon} glyph={resultGlyph(t, it, sec.id)} title={it.title} subtitle={it.subtitle}+ selected={i === sel} onHover={() => setSel(i)} onClick={() => run(it)}+ onMenu={it.preview?.kind === 'app' ? menu(it.preview.app) : undefined} />;+ })}+ </View>+ )) : (+ <View style={{ height: bodyH - 40, alignItems: 'center', justifyContent: 'center', gap: 8 }}>+ <SearchGlyph color={t.textDim} size={32} />+ <Text style={{ fontSize: 13, color: t.textDim }}>{tr('shell.classic.noResults', { query: query.trim() })}</Text>+ </View>+ )}+ </ScrollView>+ );+ } else if (view === 'all') {+ let letter = '';+ body = (+ <View style={{ height: bodyH }}>+ <Header t={t} title={tr('shell.classic.allApps')} action={tr('shell.classic.back')} back onAction={() => setView('home')} />+ <ScrollView style={{ flex: 1 }}>+ {sorted.map((a) => {+ const l = (a.name[0] || '#').toUpperCase();+ const head = l !== letter ? (letter = l) : null;+ return (+ <View key={a.id}>+ {head ? <Text style={{ fontSize: 12, fontWeight: 600, color: t.accent, marginHorizontal: 12, marginTop: 8, marginBottom: 2, textAlign: 'start' }}>{head}</Text> : null}+ <Row t={t} Icon={a.Icon} title={a.name} onClick={() => { if (!dockDragJustEnded()) open(a); }} onMenu={menu(a)} onDrag={drag(a)} />+ </View>+ );+ })}+ </ScrollView>+ </View>+ );+ } else {+ const rows = Math.ceil(pins.length / COLS);+ const gridH = Math.min(rows, recent.length ? 3 : 5) * 82;+ body = (+ <View style={{ height: bodyH, gap: 4 }}>+ <Header t={t} title={tr('shell.classic.pinned')} action={tr('shell.classic.allApps')} onAction={() => setView('all')} />+ {pins.length ? (+ <ScrollView style={{ height: gridH, flex: 0 }}>+ <View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 0, paddingHorizontal: 2 }}>+ {pins.map((a) => <Tile key={a.id} t={t} a={a} onOpen={() => open(a)} onMenu={menu(a)} onDrag={drag(a)} />)}+ </View>+ </ScrollView>+ ) : <Text style={{ fontSize: 12, color: t.textDim, margin: 12, textAlign: 'start' }}>{tr('shell.classic.noPins')}</Text>}+ {recent.length ? (+ <View style={{ marginTop: 10 }}>+ <Header t={t} title={tr('shell.classic.recent')} />+ <View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>+ {recent.map((a) => (+ <View key={a.id} style={{ width: '50%' }}>+ <Row t={t} Icon={a.Icon} title={a.name} subtitle={tr('shell.classic.recentHint')} onClick={() => { if (!dockDragJustEnded()) open(a); }} onMenu={menu(a)} onDrag={drag(a)} />+ </View>+ ))}+ </View>+ </View>+ ) : null}+ </View>+ );+ }++ const ctxItems = ctx ? [+ { label: tr('shell.dock.open'), onClick: () => open(ctx.app) },+ '-',+ pins.includes(ctx.app)+ ? { label: tr('shell.classic.unpinStart'), onClick: () => pinToStart(ctx.app.id, false) }+ : { label: tr('shell.classic.pinStart'), onClick: () => pinToStart(ctx.app.id, true) },+ ...(dockIdOf(ctx.app) ? [dock.isPinned(ctx.app)+ ? { label: tr('shell.dock.unpin'), disabled: !dock.canRemove(ctx.app), onClick: () => dock.unpin(ctx.app) }+ : { label: tr('shell.dock.pin'), onClick: () => dock.pin(ctx.app) }] : []),+ ] : [];+ const powerItems = [+ ...(session.managed() ? [{ label: tr('shell.menu.lock'), onClick: () => session.lock() }, { label: tr('shell.menu.switchUser'), onClick: () => session.switchUser() }] : []),+ { label: tr('shell.menu.logout'), onClick: () => session.quit() },+ ...(session.canPower() ? ['-', { label: tr('shell.menu.restart'), onClick: () => session.restart() }, { label: tr('shell.menu.shutdown'), onClick: () => session.shutdown() }] : []),+ ];+ // the power glyph cuts its gap with the color behind it (opaque approximations of the footer)+ const footBg = t.mode === 'dark' ? '#232327' : '#efeff2';+ const hoverBg = t.mode === 'dark' ? '#2e2e33' : '#e6e6ea';+ return (+ <View ref={ref} style={{ position: 'absolute', ...box, borderRadius: 10, overflow: 'hidden',+ backgroundColor: t.panelBg, backdropFilter: t.blur ? `blur(${t.blur}px)` : undefined, border: `1px solid ${t.windowBorder}`, boxShadow: t.shadow }}>+ <View style={{ height: 72, paddingHorizontal: 28, justifyContent: 'center' }}>+ <SearchField value={query} onChange={setQuery} onKeyDown={onKey} autoFocus placeholder={tr('shell.classic.searchHint')}+ onCancel={() => { if (!query) onClose(); }} style={{ height: 34 }} />+ </View>+ <View style={{ flex: 1, paddingHorizontal: 22 }}>{body}</View>+ <View style={{ height: 64, flexDirection: 'row', alignItems: 'center', paddingHorizontal: 28, gap: 10, backgroundColor: t.panelFoot,+ borderTopWidth: 1, borderColor: t.separator }}>+ <View onClick={() => { onClose(); wm.open('settings', { args: { section: 'users' } }); }} style={{ flexDirection: 'row', alignItems: 'center', gap: 10, paddingHorizontal: 8, height: 40, borderRadius: 6 }}>+ <View style={{ width: 32, height: 32, borderRadius: 16, alignItems: 'center', justifyContent: 'center', backgroundColor: t.accent }}>+ <Text style={{ fontSize: 13, fontWeight: 600, color: '#fff' }}>{initials}</Text>+ </View>+ <Text style={{ fontSize: 13, color: t.text, whiteSpace: 'nowrap' }}>{name}</Text>+ </View>+ <View style={{ flex: 1 }} />+ <View onClick={(e) => setPower({ x: e.x - 200, y: e.y - 12 })} style={{ width: 40, height: 40, borderRadius: 6, alignItems: 'center', justifyContent: 'center',+ backgroundColor: power ? t.hover : 'transparent' }}>+ <PowerGlyph color={t.text} bg={power ? hoverBg : footBg} size={16} />+ </View>+ </View>+ {ctx && <Menu t={t} x={ctx.x} y={ctx.y} onClose={() => setCtx(null)} items={ctxItems} />}+ {power && <Menu t={t} x={power.x} y={power.y} above width={220} onClose={() => setPower(null)} items={powerItems.map((it) => (it === '-' ? it : { ...it, onClick: () => { onClose(); it.onClick(); } }))} />}+ </View>+ );+}++// Where the start menu goes for a taskbar position and alignment (global coordinates).+export function startBox(pos, align, m = mainDisplay()) {+ const width = Math.min(640, m.w - 24);+ const height = Math.min(700, m.h - (pos === 'top' || pos === 'bottom' ? BAR_H : 0) - 24);+ const vert = pos === 'left' || pos === 'right';+ const left = vert ? (pos === 'left' ? m.x + BAR_W + 12 : m.x + m.w - BAR_W - 12 - width)+ : align === 'start' ? (direction() === 'rtl' ? m.x + m.w - 12 - width : m.x + 12) : m.x + Math.round((m.w - width) / 2);+ const top = pos === 'top' ? m.y + BAR_H + 12 : pos === 'bottom' ? m.y + m.h - BAR_H - 12 - height : m.y + 12;+ return { left, top, width, height };+}diff --git a/themes/classic/components/TaskView.jsx b/themes/classic/components/TaskView.jsxnew file mode 100644index 0000000..76a5465--- /dev/null+++ b/themes/classic/components/TaskView.jsx@@ -0,0 +1,78 @@+// Task view: every window of the main display laid out in a grid, at a smaller scale, over a dimmed+// desktop. The windows themselves are drawn smaller (a transform on their frame, which lord-server+// paints from a cached raster: no app redraws), so what you see is live. Click one to bring it to+// the front; Escape, a click on the desktop or the taskbar button closes it. ←/→ and Enter work too.+import { View, Text, addListener, t as tr, windowTitle, windowIcon, wm } from '@lordos/sdk';+import { useEffect } from 'react';+import { CloseGlyph } from '../glyphs.jsx';++const PAD = 48, GAP = 28, LABEL = 30;++// id → { x, y, scale, w, h } (screen coordinates of the scaled frame)+export function taskViewLayout(list, a) {+ const out = new Map();+ const n = list.length;+ if (!n) return out;+ const cols = Math.ceil(Math.sqrt(n * (a.w / Math.max(1, a.h)) / 1.6));+ const c = Math.max(1, Math.min(n, cols)), r = Math.ceil(n / c);+ const cw = (a.w - 2 * PAD - GAP * (c - 1)) / c, ch = (a.h - 2 * PAD - GAP * (r - 1)) / r;+ list.forEach((w, i) => {+ const col = i % c, row = Math.floor(i / c);+ const inRow = row === r - 1 ? n - row * c : c; // the last row is centered+ const rowLeft = a.x + PAD + ((c - inRow) * (cw + GAP)) / 2;+ const scale = Math.min(0.85, cw / w.w, (ch - LABEL) / w.h);+ const sw = w.w * scale, sh = w.h * scale;+ out.set(w.id, {+ x: Math.round(rowLeft + col * (cw + GAP) + (cw - sw) / 2),+ y: Math.round(a.y + PAD + row * (ch + GAP) + LABEL + (ch - LABEL - sh) / 2),+ scale, w: sw, h: sh,+ });+ });+ return out;+}++export function TaskViewBackdrop({ area, onClose, empty }) {+ return (+ <View onClick={onClose} style={{ position: 'absolute', left: area.x, top: area.y, width: area.w, height: area.h,+ backgroundColor: 'rgba(8,10,16,0.45)', alignItems: 'center', justifyContent: 'center' }}>+ {empty ? <Text style={{ fontSize: 15, color: '#fff' }}>{tr('shell.classic.noWindows')}</Text> : null}+ </View>+ );+}++// The title above each scaled window, with a close button.+export function TaskViewLabels({ t, list, layout, hover, setHover }) {+ return list.map((w) => {+ const p = layout.get(w.id);+ if (!p) return null;+ const Icon = windowIcon(w);+ return (+ <View key={w.id} onMouseEnter={() => setHover(w.id)}+ style={{ position: 'absolute', left: p.x, top: p.y - LABEL, width: p.w, height: LABEL - 4, flexDirection: 'row', alignItems: 'center', gap: 8,+ paddingHorizontal: 6, borderRadius: 6, backgroundColor: hover === w.id ? t.panelBg : 'transparent' }}>+ {Icon ? <Icon size={16} /> : null}+ <Text style={{ flex: 1, fontSize: 12, color: hover === w.id ? t.text : '#ffffff', whiteSpace: 'nowrap', textOverflow: 'ellipsis', textAlign: 'start' }}>{windowTitle(w)}</Text>+ {hover === w.id ? (+ <View onClick={() => wm.close(w.id)} style={{ width: 22, height: 22, borderRadius: 4, alignItems: 'center', justifyContent: 'center', backgroundColor: t.closeHover }}>+ <CloseGlyph color="#ffffff" size={9} />+ </View>+ ) : null}+ </View>+ );+ });+}++// Keyboard while the task view is open.+export function useTaskViewKeys(open, list, hover, setHover, pick, close) {+ useEffect(() => {+ if (!open) return undefined;+ return addListener('keydown', (e) => {+ if (e.key === 'Escape') { close(); return; }+ if (!list.length) return;+ const i = Math.max(0, list.findIndex((w) => w.id === hover));+ if (e.key === 'ArrowRight' || e.key === 'Tab') setHover(list[(i + 1) % list.length].id);+ else if (e.key === 'ArrowLeft') setHover(list[(i - 1 + list.length) % list.length].id);+ else if (e.key === 'Enter' && hover) pick(hover);+ });+ }, [open, list.map((w) => w.id).join(','), hover]);+}diff --git a/themes/classic/components/Taskbar.jsx b/themes/classic/components/Taskbar.jsxnew file mode 100644index 0000000..ed5e58a--- /dev/null+++ b/themes/classic/components/Taskbar.jsx@@ -0,0 +1,292 @@+// The Classic taskbar: the start button, search and task view, the pinned and open apps (one button+// per app: its windows are grouped), the Trash last, and the tray at the end (privacy dots, status+// items, keyboard layout, quick settings, the clock with the notification bell and a "show desktop"+// sliver). Centered by default (Settings → Desktop & Dock → alignment); bottom, top, left or right.+//+// Pinning follows the same rules and SDK calls as the default theme's Dock (sdk/dock.js, docs/DOCK.md):+// Files is first and can't be removed, Settings can't be removed, the Trash is always last; drag a+// button to reorder it (a line shows where it lands), drag it off the bar and hold to unpin it, drop+// apps from the start menu. Click: opens the app or brings its window (if it was already in front,+// minimizes it); right click: its jump list.+import {+ View, Text, Layer, useSettings, useWindows, useClock, wm, windowTitle, formatTime, formatDate, t as tr,+ useDockEntries, dockActivate, dockMenu, useStore, dockDrag, beginDockDrag, registerDockTarget, dockDragJustEnded,+ useTrash, openTrash, refreshTrash, trashMenu, StatusItems, PrivacyIndicators, keyboard, useSound, defaultSink, LordOSLogo,+ mainDisplay, screen,+} from '@lordos/sdk';+import { useEffect, useRef, useState } from 'react';+import { Menu } from './Menu.jsx';+import { SearchGlyph, TaskViewGlyph, NetworkGlyph, SpeakerGlyph, BellGlyph, TrashGlyph } from '../glyphs.jsx';++export const BAR_H = 48; // bar at the top or bottom+export const BAR_W = 56; // bar on the left or right (icons only)+export const barSize = (pos) => (pos === 'left' || pos === 'right' ? BAR_W : BAR_H);++// The taskbar's default pins (Files first; the user's own order lives in settings.dockPinned).+export const TASKBAR_DEFAULT = ['files', 'terminal', 'store', 'settings'];++// The network as the tray shows it: polled every 5 s (no per-frame work).+const VPN = (i) => ['wireguard', 'tun', 'xfrm', 'ppp'].includes(i.type) || /^(wg|ovpn|ips|ppp|oc|fvpn)-/.test(i.name);+export function readNet() {+ if (typeof lord === 'undefined' || !lord.net) return { online: false, wifi: false, name: '', ip: '', vpn: 0 };+ let ifs = [];+ try { ifs = lord.net.interfaces(); } catch (e) { ifs = []; }+ const main = ifs.find((i) => !VPN(i) && i.type !== 'loopback' && i.addresses.some((a) => a.scope === 'global' && a.family === 4));+ return {+ online: !!main, wifi: main?.type === 'wifi', name: main?.name || '', vpn: ifs.filter((i) => VPN(i) && i.up).length,+ ip: main?.addresses.find((a) => a.family === 4 && a.scope === 'global')?.address || '',+ };+}+export function useNet() {+ const [net, setNet] = useState(readNet);+ useEffect(() => { const id = setInterval(() => setNet(readNet()), 5000); return () => clearInterval(id); }, []);+ return net;+}++// "Show desktop": the windows it minimized, to bring them back on the next click.+let hiddenByDesktop = [];++function BarButton({ t, vert, active, onClick, onContextMenu, onMouseDown, onEnter, onLeave, children, refFn, width, style }) {+ const [hover, setHover] = useState(false);+ return (+ <View ref={refFn} onClick={onClick} onContextMenu={onContextMenu} onMouseDown={onMouseDown}+ onMouseEnter={() => { setHover(true); onEnter?.(); }} onMouseLeave={() => { setHover(false); onLeave?.(); }}+ style={{ width: width || (vert ? 44 : 40), height: vert ? 40 : 40, borderRadius: 6, alignItems: 'center', justifyContent: 'center',+ backgroundColor: active ? (t.mode === 'dark' ? 'rgba(255,255,255,0.10)' : 'rgba(255,255,255,0.7)') : hover ? t.hover : 'transparent',+ border: `1px solid ${active ? t.tileBorder : 'transparent'}`, ...style }}>+ {children}+ </View>+ );+}++export function Taskbar({ t, pos, align, start, onStart, onSearch, taskView, onTaskView, quick, onQuick, notif, onNotif, unread, onEmptyTrash }) {+ const entries = useDockEntries(TASKBAR_DEFAULT);+ const { focused, windows } = useWindows();+ const [jump, setJump] = useState(null);+ const [trashAt, setTrashAt] = useState(null);+ const [tip, setTip] = useState(null);+ const tipTimer = useRef(0);+ const trash = useTrash();+ const drag = useStore(dockDrag);+ const snd = useSound();+ const out = defaultSink(snd);+ const net = useNet();+ const vert = pos === 'left' || pos === 'right';+ const refs = useRef(new Map());+ const barRef = useRef(null);+ const trashRef = useRef(null);+ const center = align !== 'start';+ const m = mainDisplay();+ useEffect(() => () => clearTimeout(tipTimer.current), []);++ const click = (e) => {+ if (dockDragJustEnded()) return;+ const top = e.windows.find((w) => w.id === focused);+ if (top && e.windows.length === 1) wm.minimize(top.id); else dockActivate(e);+ };+ // where the buttons are (global coordinates), for the drop position+ const centerOf = (id) => {+ const n = refs.current.get(id);+ if (!n) return null;+ const [x, y, w, h] = lord.getLayout(n.id);+ return vert ? y + h / 2 : x + w / 2;+ };+ const geo = useRef({});+ geo.current = { entries, vert, drag };+ useEffect(() => registerDockTarget({+ hit(x, y) {+ const g = geo.current;+ if (!barRef.current) return null;+ const [bx, by, bw, bh] = lord.getLayout(barRef.current.id);+ if (!(x >= bx - 16 && x < bx + bw + 16 && y >= by - 16 && y < by + bh + 16)) return null;+ if (trashRef.current) {+ const [tx, ty, tw, th] = lord.getLayout(trashRef.current.id);+ if (x >= tx && x < tx + tw && y >= ty && y < ty + th) return { trash: true };+ }+ const a = g.vert ? y : x;+ const own = g.drag?.source === 'dock' ? g.drag.id : null;+ const cs = g.entries.filter((e) => e.pinned && !e.recent && e.id !== own).map((e) => centerOf(e.id)).filter((c) => c != null);+ return { index: cs.filter((c) => c < a).length };+ },+ near(x, y) {+ if (!barRef.current) return false;+ const [bx, by, bw, bh] = lord.getLayout(barRef.current.id);+ const dx = x < bx ? bx - x : x > bx + bw ? x - bx - bw : 0, dy = y < by ? by - y : y > by + bh ? y - by - bh : 0;+ return Math.hypot(dx, dy) <= 60;+ },+ }), []);++ // the drop line: before the pinned button at that index (after the last one at the end)+ let dropLine = null;+ if (drag && drag.over && drag.over.index != null && barRef.current) {+ const own = drag.source === 'dock' ? drag.id : null;+ const pinned = entries.filter((e) => e.pinned && !e.recent && e.id !== own);+ const k = Math.max(1, Math.min(pinned.length, drag.over.index));+ const ref = refs.current.get((pinned[k] || pinned[pinned.length - 1])?.id);+ if (ref) {+ const [bx, by] = lord.getLayout(barRef.current.id);+ const [x, y, w, h] = lord.getLayout(ref.id);+ const at = pinned[k] ? (vert ? y - by - 3 : x - bx - 3) : (vert ? y - by + h + 1 : x - bx + w + 1);+ dropLine = vert ? { top: at, left: 8, right: 8, height: 2 } : { left: at, top: 8, bottom: 8, width: 2 };+ }+ }++ // a name above (or beside) the hovered button, after a short wait+ const showTip = (text, node) => {+ clearTimeout(tipTimer.current);+ tipTimer.current = setTimeout(() => {+ if (!node) return;+ const [x, y, w, h] = lord.getLayout(node.id);+ setTip({ text, x: x + w / 2, y, w, h });+ }, 600);+ };+ const hideTip = () => { clearTimeout(tipTimer.current); setTip(null); };+ // a menu next to the bar, at the point along it+ const menuAt = (ev) => (pos === 'bottom' ? { x: ev.x - 20, y: m.y + m.h - BAR_H - 6, above: true }+ : pos === 'top' ? { x: ev.x - 20, y: m.y + BAR_H + 6 }+ : pos === 'left' ? { x: m.x + BAR_W + 6, y: ev.y - 20 } : { x: m.x + m.w - BAR_W - 246, y: ev.y - 20 });++ const indicator = (e) => {+ if (!e.running) return null;+ const on = e.focused;+ const len = on ? 16 : 6;+ const at = pos === 'top' ? { top: 2, left: 20 - len / 2, width: len, height: 3 }+ : pos === 'left' ? { left: 2, top: 20 - len / 2, width: 3, height: len }+ : pos === 'right' ? { right: 2, top: 20 - len / 2, width: 3, height: len } : { bottom: 2, left: 20 - len / 2, width: len, height: 3 };+ return <View style={{ position: 'absolute', ...at, borderRadius: 2, backgroundColor: on ? t.accent : t.textDim }} />;+ };++ const appButton = (e) => {+ const dragged = drag && drag.source === 'dock' && drag.id === e.id;+ const title = e.windows.length > 1 ? `${e.name} · ${e.windows.length}` : e.windows.length ? windowTitle(e.windows[e.windows.length - 1]) : e.name;+ return (+ <BarButton key={e.id} t={t} vert={vert} active={e.focused} refFn={(n) => { if (n) refs.current.set(e.id, n); else refs.current.delete(e.id); }}+ onClick={() => { hideTip(); click(e); }} onContextMenu={(ev) => { hideTip(); setJump({ entry: e, at: menuAt(ev) }); }}+ onMouseDown={(ev) => { if (!ev.button) beginDockDrag({ id: e.id, Icon: e.Icon, x: ev.x, y: ev.y, source: 'dock' }); }}+ onEnter={() => showTip(title, refs.current.get(e.id))} onLeave={hideTip} style={{ opacity: dragged ? 0.35 : 1 }}>+ <e.Icon size={26} />+ {indicator(e)}+ {e.windows.length > 1 ? <View style={{ position: 'absolute', right: 3, top: 3, minWidth: 12, height: 12, paddingHorizontal: 2, borderRadius: 6,+ backgroundColor: t.control, border: `1px solid ${t.tileBorder}`, alignItems: 'center', justifyContent: 'center' }}>+ <Text style={{ fontSize: 8, fontWeight: 700, color: t.text }}>{e.windows.length}</Text></View> : null}+ </BarButton>+ );+ };++ const startRef = useRef(null), searchRef = useRef(null), tvRef = useRef(null);+ const apps = (+ <View style={{ flexDirection: vert ? 'column' : 'row', alignItems: 'center', gap: 2, direction: 'ltr' }}>+ <BarButton t={t} vert={vert} active={start} refFn={startRef} onClick={() => { hideTip(); onStart(); }}+ onEnter={() => showTip(tr('shell.classic.start'), startRef.current)} onLeave={hideTip}>+ <LordOSLogo size={26} />+ </BarButton>+ <BarButton t={t} vert={vert} refFn={searchRef} onClick={() => { hideTip(); onSearch(); }}+ onEnter={() => showTip(tr('shell.classic.search'), searchRef.current)} onLeave={hideTip}>+ <SearchGlyph color={t.text} size={17} />+ </BarButton>+ <BarButton t={t} vert={vert} active={taskView} refFn={tvRef} onClick={() => { hideTip(); onTaskView(); }}+ onEnter={() => showTip(tr('shell.classic.taskView'), tvRef.current)} onLeave={hideTip}>+ <TaskViewGlyph color={t.text} bg={t.mode === 'dark' ? '#2a2a30' : '#eceef2'} size={19} />+ </BarButton>+ {entries.map(appButton)}+ <View style={vert ? { width: 24, height: 1, marginVertical: 3, backgroundColor: t.separator } : { width: 1, height: 24, marginHorizontal: 3, backgroundColor: t.separator }} />+ <View ref={trashRef} dropTrash onMouseUp={() => setTimeout(refreshTrash, 60)}>+ <BarButton t={t} vert={vert} active={!!drag?.over?.trash} onClick={() => { if (!dockDragJustEnded()) openTrash(); }}+ onContextMenu={(ev) => setTrashAt(menuAt(ev))} onEnter={() => showTip(tr('shell.classic.trash'), trashRef.current)} onLeave={hideTip}>+ <TrashGlyph size={24} full={trash.full} dark={t.mode === 'dark'} />+ </BarButton>+ </View>+ </View>+ );++ const level = out ? (out.mute || out.level === 0 ? 0 : out.level < 0.5 ? 1 : 2) : 2;+ const qsGlyphs = (+ <View style={{ flexDirection: vert ? 'column' : 'row', alignItems: 'center', gap: vert ? 6 : 8, direction: 'ltr' }}>+ <NetworkGlyph color={t.text} size={15} off={!net.online} />+ {out ? <SpeakerGlyph color={t.text} size={16} level={level} muted={out.mute} /> : null}+ </View>+ );+ const showDesktop = () => {+ const vis = windows.filter((w) => !w.minimized);+ if (vis.length) { hiddenByDesktop = vis.map((w) => w.id); vis.forEach((w) => wm.minimize(w.id)); }+ else { hiddenByDesktop.forEach((id) => wm.focus(id)); hiddenByDesktop = []; }+ };+ const tray = (+ <View style={{ flexDirection: vert ? 'column' : 'row', alignItems: 'center', gap: 2 }}>+ <PrivacyIndicators />+ {vert ? null : <StatusItems color={t.text} />}+ {!vert && keyboard.configured().length > 1 ? (+ <BarButton t={t} width={36} onClick={() => keyboard.next()}>+ <Text style={{ fontSize: 11, fontWeight: 600, color: t.text }}>{keyboard.label(keyboard.active())}</Text>+ </BarButton>+ ) : null}+ <BarButton t={t} vert={vert} active={quick} width={vert ? 44 : 64} onClick={onQuick}>{qsGlyphs}</BarButton>+ <BarButton t={t} vert={vert} active={notif} width={vert ? 48 : undefined} onClick={onNotif}+ style={vert ? { height: 52 } : { paddingHorizontal: 8, width: undefined, flexDirection: 'row', gap: 8 }}>+ <TrayClock t={t} vert={vert} />+ <BellGlyph color={t.text} size={14} dot={unread ? t.accent : null} />+ </BarButton>+ {vert ? null : <View onClick={showDesktop} style={{ width: 8, height: BAR_H, marginStart: 2, borderStartWidth: 1, borderColor: t.separator }} />}+ </View>+ );++ const edge = vert+ ? { top: 0, bottom: 0, width: BAR_W, [pos]: 0, flexDirection: 'column', paddingVertical: 6,+ [pos === 'left' ? 'borderRightWidth' : 'borderLeftWidth']: 1 }+ : { left: 0, right: 0, height: BAR_H, [pos]: 0, flexDirection: 'row', paddingHorizontal: 6,+ [pos === 'top' ? 'borderBottomWidth' : 'borderTopWidth']: 1 };+ return (+ <View ref={barRef} style={{ position: 'absolute', ...edge, alignItems: 'center', borderColor: t.barBorder,+ backgroundColor: t.barBg, backdropFilter: t.blur ? `blur(${t.blur}px)` : undefined }}>+ {center ? <View style={{ flex: 1 }} /> : null}+ {apps}+ <View style={{ flex: 1, flexDirection: vert ? 'column' : 'row', justifyContent: 'flex-end', alignItems: 'center' }}>{tray}</View>+ {dropLine && <View style={{ position: 'absolute', ...dropLine, backgroundColor: t.accent, pointerEvents: 'none' }} />}+ {jump && <Menu t={t} {...jump.at} onClose={() => setJump(null)} items={jumpItems(entries.find((x) => x.id === jump.entry.id) || jump.entry)} />}+ {trashAt && <Menu t={t} {...trashAt} onClose={() => setTrashAt(null)} items={trashMenu({ onEmpty: onEmptyTrash })} />}+ {tip && (+ <Layer name="tooltip">+ <TipBubble t={t} tip={tip} pos={pos} />+ </Layer>+ )}+ </View>+ );+}++// Time over the date; its own component, so only it renders when the minute (or second) changes.+function TrayClock({ t, vert }) {+ const [s] = useSettings();+ const seconds = !!s.clock?.seconds;+ // a different interval restarts the timer with the new format when Settings → Date & Time changes+ const txt = useClock((d) => `${formatTime(d, { seconds })}\n${formatDate(d, 'numeric')}`, seconds ? 1000 : 1001);+ const [time, date] = txt.split('\n');+ return (+ <View style={{ alignItems: vert ? 'center' : 'flex-end' }}>+ <Text style={{ fontSize: vert ? 10 : 12, color: t.text, whiteSpace: 'nowrap' }}>{time}</Text>+ {vert ? null : <Text style={{ fontSize: 11, color: t.text, whiteSpace: 'nowrap' }}>{date}</Text>}+ </View>+ );+}++// The SDK's Dock items (dockMenu), with taskbar wording: pin/unpin, close all windows.+function jumpItems(entry) {+ const items = [];+ for (const it of dockMenu(entry, { keepLabel: tr('shell.dock.pin'), removeLabel: tr('shell.dock.unpin') })) {+ if (it !== '-' && it.label === tr('shell.dock.quit')) items.push({ ...it, label: tr('shell.dock.closeAll') });+ else if (it !== '-' && it.label === tr('shell.dock.hide')) continue;+ else items.push(it);+ }+ return items;+}++function TipBubble({ t, tip, pos }) {+ const w = Math.min(320, Math.max(40, tip.text.length * 7 + 20));+ const at = pos === 'bottom' ? { left: tip.x - w / 2, top: tip.y - 34 } : pos === 'top' ? { left: tip.x - w / 2, top: tip.y + tip.h + 8 }+ : pos === 'left' ? { left: tip.x + tip.w / 2 + 8, top: tip.y + tip.h / 2 - 13 } : { left: tip.x - tip.w / 2 - w - 8, top: tip.y + tip.h / 2 - 13 };+ return (+ <View style={{ position: 'absolute', ...at, left: Math.max(4, Math.min(at.left, screen.width - w - 4)), width: w, height: 26, borderRadius: 4,+ alignItems: 'center', justifyContent: 'center', backgroundColor: t.popupBg, border: `1px solid ${t.windowBorder}`, boxShadow: '0 4px 12px rgba(0,0,0,0.25)', pointerEvents: 'none' }}>+ <Text style={{ fontSize: 12, color: t.text, whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>{tip.text}</Text>+ </View>+ );+}diff --git a/themes/classic/components/Window.jsx b/themes/classic/components/Window.jsxnew file mode 100644index 0000000..d468456--- /dev/null+++ b/themes/classic/components/Window.jsx@@ -0,0 +1,153 @@+// Window frame of the Classic theme: the app's icon and title at the start of a 34 px title bar and+// the minimize / maximize / close buttons at the end (on the left in right-to-left languages, the+// engine mirrors the row). Rounded corners unless maximized or snapped. Hovering over maximize+// offers the snap layouts (halves, thirds, quarters; sdk/windows.js "Snapping"). Moving and+// resizing are done in C (<WindowShell>, wm.beginMove; docs/WINDOWS.md); a maximized window is+// dragged out of its place by JS, and snaps where it is dropped.+import { View, Text, Layer, addListener, wm, AppHost, windowTitle, WindowShell, windowIcon, snapZoneAt, t as tr } from '@lordos/sdk';+import { useEffect, useRef, useState } from 'react';+import { MinimizeGlyph, MaximizeGlyph, RestoreGlyph, CloseGlyph, LayoutGlyph } from '../glyphs.jsx';+import { Menu } from './Menu.jsx';++export const TITLE_H = 34;+const BTN_W = 44;++// The snap layouts (cells in 0..1 of the work area) and the zone each cell snaps to.+const LAYOUTS = [+ { cells: [[0, 0, 0.5, 1], [0.5, 0, 0.5, 1]], zones: ['left', 'right'] },+ { cells: [[0, 0, 2 / 3, 1], [2 / 3, 0, 1 / 3, 1]], zones: ['left-two-thirds', 'right-third'] },+ { cells: [[0, 0, 1 / 3, 1], [1 / 3, 0, 1 / 3, 1], [2 / 3, 0, 1 / 3, 1]], zones: ['left-third', 'center-third', 'right-third'] },+ { cells: [[0, 0, 0.5, 0.5], [0.5, 0, 0.5, 0.5], [0, 0.5, 0.5, 0.5], [0.5, 0.5, 0.5, 0.5]], zones: ['top-left', 'top-right', 'bottom-left', 'bottom-right'] },+];++function SnapLayouts({ t, win, at, onEnter, onLeave, onDone }) {+ const [hover, setHover] = useState(null); // [layout, cell]+ const W = 4 * 72 + 3 * 8 + 24;+ return (+ <Layer name="popover">+ <View onMouseEnter={onEnter} onMouseLeave={onLeave}+ style={{ position: 'absolute', left: Math.max(6, at.x - W + BTN_W * 1.5), top: at.y, width: W, padding: 12, gap: 8, borderRadius: t.menuRadius + 2,+ backgroundColor: t.panelBg, backdropFilter: t.blur ? `blur(${t.blur}px)` : undefined, border: `1px solid ${t.windowBorder}`, boxShadow: t.shadow }}>+ <Text style={{ fontSize: 11, fontWeight: 600, color: t.textDim, textAlign: 'start' }}>{tr('shell.classic.snapLayouts')}</Text>+ <View style={{ flexDirection: 'row', gap: 8, direction: 'ltr' }}>+ {LAYOUTS.map((l, li) => (+ <View key={li} style={{ padding: 6, borderRadius: 6, backgroundColor: t.hover }}>+ <LayoutGlyph cells={l.cells} w={60} h={40} color={t.textDim} accent={t.accent}+ hoverIndex={hover && hover[0] === li ? hover[1] : -1}+ onHover={(i) => setHover(i < 0 ? null : [li, i])}+ onPick={(i) => { onDone(); wm.focus(win.id); wm.snap(win.id, l.zones[i]); }} />+ </View>+ ))}+ </View>+ </View>+ </Layer>+ );+}++function FrameButton({ t, focused, onClick, danger, children, anchor, onEnter, onLeave }) {+ const [hover, setHover] = useState(false);+ return (+ <View ref={anchor} onMouseDown={(e) => e.stopPropagation()} onClick={onClick}+ onMouseEnter={() => { setHover(true); onEnter?.(); }} onMouseLeave={() => { setHover(false); onLeave?.(); }}+ style={{ width: BTN_W, height: TITLE_H, alignItems: 'center', justifyContent: 'center', opacity: focused || hover ? 1 : 0.55,+ backgroundColor: hover ? (danger ? t.closeHover : t.hover) : 'transparent' }}>+ {children(hover && danger ? '#ffffff' : t.text)}+ </View>+ );+}++// tv: the task view's place for this window ({ x, y, scale, onPick, onClose }), or null.+export function Window({ win, t, focused, app, tv }) {+ const drag = useRef(null);+ const geo = wm.frame(win);+ const maxRef = useRef(null);+ const [layouts, setLayouts] = useState(null); // where the snap layouts open+ const [menu, setMenu] = useState(null);+ const hoverTimer = useRef(0), leaveTimer = useRef(0);+ const flat = win.maximized || !!win.snapped;+ useEffect(() => {+ const offMove = addListener('pointermove', (e) => {+ const d = drag.current;+ if (!d) return;+ if (!d.moving) {+ if (Math.abs(e.x - d.x0) + Math.abs(e.y - d.y0) < 6) return;+ d.moving = true;+ // out of the maximized place: back to its own size, under the pointer where it was grabbed+ d.dx = Math.round(d.rel * win.w);+ d.dy = Math.min(TITLE_H / 2, d.y0 - geo.y);+ }+ wm.move(win.id, e.x - d.dx, e.y - d.dy);+ });+ const offUp = addListener('pointerup', (e) => {+ const d = drag.current;+ drag.current = null;+ if (d && d.moving) { const z = snapZoneAt(e.x, e.y); if (z) wm.snap(win.id, z); }+ });+ return () => { offMove(); offUp(); clearTimeout(hoverTimer.current); clearTimeout(leaveTimer.current); };+ }, [win.id, win.w, geo.y]);++ const shadow = focused ? t.shadow : (t.mode === 'dark' ? '0 8px 22px rgba(0,0,0,0.4)' : '0 8px 22px rgba(0,0,0,0.16)');+ const tvStyle = tv ? { transform: `translate(${tv.x - geo.x}px, ${tv.y - geo.y}px) scale(${tv.scale})`, transformOrigin: 'left top' } : null;+ const tvCover = tv ? (+ <View onClick={tv.onPick} style={{ position: 'absolute', left: 0, top: 0, right: 0, bottom: 0, cursor: 'pointer',+ borderRadius: flat ? 0 : 8, border: tv.hover ? `${Math.round(3 / tv.scale)}px solid ${t.accent}` : '0 solid transparent' }}+ onMouseEnter={tv.onEnter} onMouseLeave={tv.onLeave} />+ ) : null;++ // Linux app with its own frame (GTK, Chromium): only the content, with the theme's shadow.+ if (win.args?.csd) {+ return (+ <WindowShell win={win} resizable={!tv} onMouseDown={() => wm.focus(win.id)} style={{ boxShadow: shadow, ...tvStyle }}>+ <AppHost id={win.id} focused={focused && !tv} />+ {tvCover}+ </WindowShell>+ );+ }++ const Icon = windowIcon(win);+ const openLayouts = () => {+ if (!maxRef.current || tv) return;+ const [x, y, w, h] = lord.getLayout(maxRef.current.id);+ setLayouts({ x: x + w / 2 - BTN_W / 2, y: y + h + 4 });+ };+ const enterMax = () => { clearTimeout(leaveTimer.current); clearTimeout(hoverTimer.current); hoverTimer.current = setTimeout(openLayouts, 550); };+ const leaveMax = () => { clearTimeout(hoverTimer.current); clearTimeout(leaveTimer.current); leaveTimer.current = setTimeout(() => setLayouts(null), 300); };+ const titleMenu = (e) => setMenu({ x: e.x, y: e.y });+ return (+ <WindowShell win={win} resizable={!tv} onMouseDown={() => wm.focus(win.id)} style={{+ borderRadius: flat ? 0 : 8, backgroundColor: app.transparent ? 'transparent' : t.windowBg, overflow: 'hidden',+ border: `1px solid ${focused ? t.windowBorder : t.separator}`, boxShadow: shadow, ...tvStyle,+ }}>+ <View onMouseDown={(e) => {+ if (e.button) return;+ if (!wm.beginMove(win.id)) drag.current = { x0: e.x, y0: e.y, rel: geo.w ? (e.x - geo.x) / geo.w : 0.5, moving: false };+ }}+ onDoubleClick={() => wm.toggleMaximize(win.id)} onContextMenu={titleMenu}+ style={{ height: TITLE_H, flexDirection: 'row', alignItems: 'center', paddingStart: 12, gap: 8,+ backgroundColor: focused ? t.titleBg : t.titleBgBlur }}>+ {Icon ? <Icon size={16} /> : null}+ <Text style={{ flex: 1, fontSize: 12, color: focused ? t.text : t.textDim, whiteSpace: 'nowrap', textOverflow: 'ellipsis', textAlign: 'start' }}>{windowTitle(win)}</Text>+ <FrameButton t={t} focused={focused} onClick={() => wm.minimize(win.id)}>{(c) => <MinimizeGlyph color={c} />}</FrameButton>+ <FrameButton t={t} focused={focused} anchor={maxRef} onClick={() => { setLayouts(null); wm.toggleMaximize(win.id); }} onEnter={enterMax} onLeave={leaveMax}>+ {(c) => (win.maximized || win.snapped ? <RestoreGlyph color={c} /> : <MaximizeGlyph color={c} />)}+ </FrameButton>+ <FrameButton t={t} focused={focused} danger onClick={() => wm.close(win.id)}>{(c) => <CloseGlyph color={c} />}</FrameButton>+ </View>+ <View style={{ flex: 1 }}><AppHost id={win.id} focused={focused && !tv} /></View>+ {tvCover}+ {layouts && !tv && <SnapLayouts t={t} win={win} at={layouts} onEnter={() => clearTimeout(leaveTimer.current)} onLeave={leaveMax} onDone={() => setLayouts(null)} />}+ {menu && (+ <Menu t={t} x={menu.x} y={menu.y} onClose={() => setMenu(null)} items={[+ { label: tr('shell.classic.restore'), disabled: !win.maximized && !win.snapped, onClick: () => wm.snap(win.id, 'restore') },+ { label: tr('shell.classic.minimize'), onClick: () => wm.minimize(win.id) },+ { label: tr('shell.classic.maximize'), disabled: win.maximized, onClick: () => wm.snap(win.id, 'max') },+ '-',+ { label: tr('shell.classic.snapLeft'), onClick: () => wm.snap(win.id, 'left') },+ { label: tr('shell.classic.snapRight'), onClick: () => wm.snap(win.id, 'right') },+ '-',+ { label: tr('shell.classic.close'), hint: 'Alt+F4', onClick: () => wm.close(win.id) },+ ]} />+ )}+ </WindowShell>+ );+}diff --git a/themes/classic/glyphs.jsx b/themes/classic/glyphs.jsxnew file mode 100644index 0000000..ae3d072--- /dev/null+++ b/themes/classic/glyphs.jsx@@ -0,0 +1,238 @@+// Classic theme glyphs, drawn with views (our own shapes: no icon font, no color emoji; see+// docs/DESIGN.md, "Icons"). Each one takes a color and, where it needs to cut a hole, the color+// of what is behind it (bg).+import { View } from '@lordos/sdk';++const box = (s, extra) => ({ width: s, height: s, alignItems: 'center', justifyContent: 'center', ...extra });++// Window buttons: minimize, maximize, restore (two squares) and close (an ×).+export function MinimizeGlyph({ color }) {+ return <View style={box(12)}><View style={{ width: 10, height: 1, backgroundColor: color }} /></View>;+}+export function MaximizeGlyph({ color }) {+ return <View style={box(12)}><View style={{ width: 9, height: 9, borderRadius: 1.5, border: `1px solid ${color}` }} /></View>;+}+export function RestoreGlyph({ color }) {+ return (+ <View style={box(12)}>+ <View style={{ position: 'absolute', left: 3.5, top: 1, width: 7.5, height: 7.5, borderTopWidth: 1, borderRightWidth: 1, borderColor: color, borderTopRightRadius: 1.5 }} />+ <View style={{ position: 'absolute', left: 1, top: 3.5, width: 7.5, height: 7.5, borderRadius: 1.5, border: `1px solid ${color}` }} />+ </View>+ );+}+export function CloseGlyph({ color, size = 12 }) {+ const bar = (deg) => <View style={{ position: 'absolute', left: size * 0.04, top: size / 2 - 0.5, width: size * 0.92, height: 1.1, backgroundColor: color, transform: `rotate(${deg}deg)` }} />;+ return <View style={box(size)}>{bar(45)}{bar(-45)}</View>;+}++// A magnifier.+export function SearchGlyph({ color, size = 16 }) {+ const r = size * 0.62;+ return (+ <View style={{ width: size, height: size }}>+ <View style={{ position: 'absolute', left: 0, top: 0, width: r, height: r, borderRadius: r / 2, border: `${Math.max(1.4, size / 10)}px solid ${color}` }} />+ <View style={{ position: 'absolute', left: r * 0.82, top: r * 0.98, width: size * 0.42, height: Math.max(1.6, size / 9), borderRadius: 1, backgroundColor: color, transform: 'rotate(45deg)', transformOrigin: 'left top' }} />+ </View>+ );+}++// Task view: two cards, one in front of the other.+export function TaskViewGlyph({ color, bg, size = 18 }) {+ return (+ <View style={{ width: size, height: size }}>+ <View style={{ position: 'absolute', left: size * 0.32, top: size * 0.12, width: size * 0.62, height: size * 0.5, borderRadius: 2, border: `1.4px solid ${color}` }} />+ <View style={{ position: 'absolute', left: size * 0.06, top: size * 0.38, width: size * 0.62, height: size * 0.5, borderRadius: 2, border: `1.4px solid ${color}`, backgroundColor: bg }} />+ </View>+ );+}++// Signal bars (network); off: the bars dim and a short slash.+export function NetworkGlyph({ color, size = 16, level = 4, off }) {+ const bars = [0.35, 0.55, 0.75, 1];+ return (+ <View style={{ width: size, height: size, flexDirection: 'row', alignItems: 'flex-end', gap: size * 0.08, direction: 'ltr' }}>+ {bars.map((k, i) => (+ <View key={i} style={{ width: size * 0.17, height: size * 0.9 * k, borderRadius: 1, backgroundColor: color, opacity: off || i >= level ? 0.3 : 1 }} />+ ))}+ </View>+ );+}++// A speaker with 0–2 sound waves; muted: a short cross. The cone is the left half of a diamond+// (a rotated square clipped at its middle), so it widens away from the body.+export function SpeakerGlyph({ color, size = 16, level = 2, muted }) {+ const d = size * 0.5; // the diamond's side+ const wave = (k) => (+ <View key={k} style={{ position: 'absolute', left: size * (0.3 + 0.14 * k), top: size * (0.5 - 0.15 * k - 0.1), width: size * (0.2 + 0.3 * k), height: size * (0.2 + 0.3 * k),+ borderRadius: size, borderRightWidth: 1.4, borderColor: color }} />+ );+ return (+ <View style={{ width: size, height: size, direction: 'ltr' }}>+ <View style={{ position: 'absolute', left: size * 0.04, top: size * 0.36, width: size * 0.18, height: size * 0.28, borderRadius: 1, backgroundColor: color }} />+ <View style={{ position: 'absolute', left: size * 0.14, top: size * 0.14, width: size * 0.3, height: size * 0.72, overflow: 'hidden' }}>+ <View style={{ position: 'absolute', left: size * 0.3 - d / 2, top: size * 0.36 - d / 2, width: d, height: d, backgroundColor: color, transform: 'rotate(45deg)' }} />+ </View>+ {muted ? (+ <View style={{ position: 'absolute', left: size * 0.56, top: size * 0.29, width: size * 0.42, height: size * 0.42 }}>+ <CloseGlyph color={color} size={size * 0.42} />+ </View>+ ) : [1, 2].filter((k) => k <= level).map(wave)}+ </View>+ );+}++// A bell (notifications); with `dot`, a small accent dot for unread ones.+export function BellGlyph({ color, size = 16, dot }) {+ return (+ <View style={{ width: size, height: size }}>+ <View style={{ position: 'absolute', left: size * 0.2, top: size * 0.1, width: size * 0.6, height: size * 0.62, borderTopLeftRadius: size * 0.3, borderTopRightRadius: size * 0.3,+ borderRadius: 1, border: `1.4px solid ${color}`, borderBottomWidth: 0 }} />+ <View style={{ position: 'absolute', left: size * 0.08, top: size * 0.7, width: size * 0.84, height: 1.4, borderRadius: 1, backgroundColor: color }} />+ <View style={{ position: 'absolute', left: size * 0.4, top: size * 0.78, width: size * 0.2, height: size * 0.14, borderBottomLeftRadius: size, borderBottomRightRadius: size, backgroundColor: color }} />+ {dot ? <View style={{ position: 'absolute', right: -1, top: -1, width: size * 0.38, height: size * 0.38, borderRadius: size, backgroundColor: dot }} /> : null}+ </View>+ );+}++// The power symbol.+export function PowerGlyph({ color, bg, size = 14 }) {+ const k = size / 14;+ return (+ <View style={{ width: size, height: size }}>+ <View style={{ position: 'absolute', left: 1 * k, top: 2 * k, width: 12 * k, height: 12 * k, borderRadius: 6 * k, border: `${1.6 * k}px solid ${color}` }} />+ <View style={{ position: 'absolute', left: 4 * k, top: 0, width: 6 * k, height: 5 * k, backgroundColor: bg }} />+ <View style={{ position: 'absolute', left: 6.2 * k, top: 0, width: 1.6 * k, height: 7 * k, borderRadius: 1, backgroundColor: color }} />+ </View>+ );+}++// A gear: four crossed bars under a ring, with a hole of the background's color.+export function GearGlyph({ color, bg, size = 16 }) {+ const bar = (deg) => <View key={deg} style={{ position: 'absolute', left: size * 0.41, top: 0, width: size * 0.18, height: size, borderRadius: 1, backgroundColor: color, transform: `rotate(${deg}deg)` }} />;+ return (+ <View style={{ width: size, height: size }}>+ {[0, 45, 90, 135].map(bar)}+ <View style={{ position: 'absolute', left: size * 0.16, top: size * 0.16, width: size * 0.68, height: size * 0.68, borderRadius: size, backgroundColor: color }} />+ <View style={{ position: 'absolute', left: size * 0.34, top: size * 0.34, width: size * 0.32, height: size * 0.32, borderRadius: size, backgroundColor: bg }} />+ </View>+ );+}++// A crescent (Do Not Disturb): a disc with another one of the background's color over it.+export function MoonGlyph({ color, bg, size = 16 }) {+ return (+ <View style={{ width: size, height: size, overflow: 'hidden', direction: 'ltr' }}>+ <View style={{ position: 'absolute', left: size * 0.1, top: size * 0.1, width: size * 0.8, height: size * 0.8, borderRadius: size, backgroundColor: color }} />+ <View style={{ position: 'absolute', left: size * 0.36, top: size * 0.02, width: size * 0.66, height: size * 0.66, borderRadius: size, backgroundColor: bg }} />+ </View>+ );+}++// A sun (Night Light): a disc with eight short rays.+export function SunGlyph({ color, size = 16 }) {+ const ray = (deg) => (+ <View key={deg} style={{ position: 'absolute', left: size / 2 - 0.75, top: 0, width: 1.5, height: size, transform: `rotate(${deg}deg)` }}>+ <View style={{ height: size * 0.18, borderRadius: 1, backgroundColor: color }} />+ <View style={{ flex: 1 }} />+ <View style={{ height: size * 0.18, borderRadius: 1, backgroundColor: color }} />+ </View>+ );+ return (+ <View style={{ width: size, height: size }}>+ {[0, 45, 90, 135].map(ray)}+ <View style={{ position: 'absolute', left: size * 0.3, top: size * 0.3, width: size * 0.4, height: size * 0.4, borderRadius: size, backgroundColor: color }} />+ </View>+ );+}++// Half a disc (light / dark).+export function ContrastGlyph({ color, size = 16 }) {+ return (+ <View style={{ width: size, height: size, borderRadius: size, border: `1.5px solid ${color}`, overflow: 'hidden', direction: 'ltr' }}>+ <View style={{ position: 'absolute', left: size / 2 - 1.5, top: 0, bottom: 0, right: 0, backgroundColor: color }} />+ </View>+ );+}++// Two overlapping panes (transparency).+export function LayersGlyph({ color, size = 16 }) {+ return (+ <View style={{ width: size, height: size }}>+ <View style={{ position: 'absolute', left: size * 0.05, top: size * 0.05, width: size * 0.6, height: size * 0.6, borderRadius: 2, border: `1.4px solid ${color}` }} />+ <View style={{ position: 'absolute', left: size * 0.35, top: size * 0.35, width: size * 0.6, height: size * 0.6, borderRadius: 2, backgroundColor: color, opacity: 0.45 }} />+ </View>+ );+}++// The Bluetooth rune, drawn as a stem with two folds.+export function BluetoothGlyph({ color, size = 16 }) {+ const s = size, line = 1.5;+ const seg = (x, y, len, deg) => <View style={{ position: 'absolute', left: x, top: y, width: len, height: line, borderRadius: 1, backgroundColor: color, transform: `rotate(${deg}deg)`, transformOrigin: 'left center' }} />;+ return (+ <View style={{ width: s, height: s, direction: 'ltr' }}>+ <View style={{ position: 'absolute', left: s * 0.47, top: s * 0.06, width: line, height: s * 0.88, backgroundColor: color, borderRadius: 1 }} />+ {seg(s * 0.5, s * 0.06, s * 0.31, 45)}+ {seg(s * 0.72, s * 0.28, s * 0.62, 135)}+ {seg(s * 0.5, s * 0.94, s * 0.31, -45)}+ {seg(s * 0.72, s * 0.72, s * 0.62, -135)}+ </View>+ );+}++// A chevron pointing `dir` ('right' | 'left' | 'up' | 'down').+export function Chevron({ color, size = 8, dir = 'right' }) {+ const deg = { right: -45, down: 45, left: 135, up: -135 }[dir];+ return (+ <View style={box(size * 1.6)}>+ <View style={{ width: size, height: size, borderRightWidth: 1.5, borderBottomWidth: 1.5, borderColor: color, transform: `rotate(${deg}deg)` }} />+ </View>+ );+}++// A folder and a page, for search results.+export function FolderGlyph({ color, size = 20 }) {+ return (+ <View style={{ width: size, height: size }}>+ <View style={{ position: 'absolute', left: size * 0.06, top: size * 0.16, width: size * 0.4, height: size * 0.2, borderTopLeftRadius: 2, borderTopRightRadius: 2, backgroundColor: color, opacity: 0.8 }} />+ <View style={{ position: 'absolute', left: size * 0.06, top: size * 0.26, width: size * 0.88, height: size * 0.6, borderRadius: 2, backgroundColor: color }} />+ </View>+ );+}+export function PageGlyph({ color, size = 20 }) {+ return (+ <View style={{ width: size, height: size, alignItems: 'center' }}>+ <View style={{ width: size * 0.66, height: size * 0.86, marginTop: size * 0.07, borderRadius: 2, border: `1.4px solid ${color}`, paddingTop: size * 0.18, paddingHorizontal: size * 0.12, gap: size * 0.1 }}>+ {[1, 0.8, 0.9].map((k, i) => <View key={i} style={{ height: 1.2, width: `${k * 100}%`, backgroundColor: color, opacity: 0.7 }} />)}+ </View>+ </View>+ );+}++// The Trash: a small bin, with a paper when it isn't empty.+export function TrashGlyph({ size: s, full, dark }) {+ const line = dark ? 'rgba(255,255,255,0.78)' : 'rgba(30,34,44,0.7)';+ return (+ <View style={{ width: s, height: s }}>+ {full && <View style={{ position: 'absolute', left: s * 0.3, top: s * 0.02, width: s * 0.4, height: s * 0.24, borderRadius: 2,+ backgroundColor: dark ? '#d9dde6' : '#ffffff', border: `1px solid ${line}`, transform: 'rotate(-10deg)' }} />}+ <View style={{ position: 'absolute', left: s * 0.18, top: s * 0.18, width: s * 0.64, height: s * 0.07, backgroundColor: line, borderRadius: 1 }} />+ <View style={{ position: 'absolute', left: s * 0.24, top: s * 0.28, width: s * 0.52, height: s * 0.62, border: `1.5px solid ${line}`,+ borderBottomLeftRadius: s * 0.08, borderBottomRightRadius: s * 0.08 }}>+ {[0.3, 0.6].map((k) => <View key={k} style={{ position: 'absolute', top: s * 0.08, bottom: s * 0.08, left: s * 0.52 * k - 1, width: 1.5, backgroundColor: line }} />)}+ </View>+ </View>+ );+}++// The snap layouts, in miniature: each zone of `cells` ([[x, y, w, h] in 0..1]) is a tile.+export function LayoutGlyph({ cells, w = 60, h = 40, color, hoverIndex, accent, onPick, onHover }) {+ return (+ <View style={{ width: w, height: h, direction: 'ltr' }}>+ {cells.map(([x, y, cw, ch], i) => (+ <View key={i} onClick={() => onPick?.(i)} onMouseEnter={() => onHover?.(i)} onMouseLeave={() => onHover?.(-1)}+ style={{ position: 'absolute', left: x * w + 1.5, top: y * h + 1.5, width: cw * w - 3, height: ch * h - 3, borderRadius: 3,+ backgroundColor: hoverIndex === i ? accent : 'transparent', border: `1px solid ${hoverIndex === i ? accent : color}` }} />+ ))}+ </View>+ );+}diff --git a/themes/classic/index.jsx b/themes/classic/index.jsxindex af6044d..71d754e 100644--- a/themes/classic/index.jsx+++ b/themes/classic/index.jsx@@ -1,41 +1,34 @@-// "Classic" theme — TEMPLATE for creating new themes. The whole desktop in one file:-// 1. tokens (colors that apps also use via useTheme)-// 2. window frame-// 3. taskbar + start menu-// 4. App: wallpaper + windows + bar-// Copy this folder, change theme.json and start modifying.+// "Classic" theme — the second full appearance of LordOS: a centered taskbar with a start menu,+// pinned and open apps, a tray with quick settings and a notification panel, window snapping+// (halves, thirds, quarters) and a task view. The apps are the same as in Lord Default: this theme+// only supplies the window frame and the shell, and restyles the SDK's shared controls through its+// tokens (tokens.js), so every app adapts on its own. See themes/README.md and docs/DESIGN.md.+//+// tokens.js colors, materials and the shape tokens of the shared controls+// glyphs.jsx drawn icons (window buttons, tray, quick settings)+// components/Window.jsx the frame: title at the start, buttons at the end, snap layouts+// components/Taskbar.jsx start, search, task view, apps, Trash, tray+// components/StartMenu.jsx search, pinned, recent, all apps, user and power+// components/QuickSettings.jsx, NotificationCenter.jsx, TaskView.jsx, Menu.jsximport {- startShell, settings, View, Text, screen, addListener, ThemeProvider, useSettings, useWindows, useClock,- configureWindows, getApp, wm, AppHost, session, windowTitle, t as tr, formatTime,- ScrollView, useLauncherApps, launchApp, windowIcon, APP_CATEGORIES, appCategory, useDockEntries, dockActivate, dockMenu,- DesktopWidgets, PrivacyIndicators, registerGestureActions, WindowShell, StatusItems, dockPrefs, mainDisplay,- useStore, dock, dockIdOf, dockDrag, dockPoof, beginDockDrag, registerDockTarget, dockDragJustEnded, useTrash, openTrash, emptyTrash, trashMenu,- refreshTrash, ConfirmDialog, takeTextFocus, releaseTextFocus, Layer, PowerDialog,+ startShell, settings, View, Image, Layer, screen, addListener, ThemeProvider, useSettings, useWindows, useStore, configureWindows,+ getApp, wm, t as tr, DesktopWidgets, registerGestureActions, dockPrefs, mainDisplay, screenDisplays, dockDrag, dockPoof,+ emptyTrash, ConfirmDialog, PowerDialog, findWallpaper, wallpaperSrc, snapPreview, notifyHistory, setBannerPlacement, Text, direction,} from '@lordos/sdk';import { apps } from '@lordos/apps';import { useEffect, useRef, useState } from 'react';+import { makeTheme } from './tokens.js';+import { Window, TITLE_H } from './components/Window.jsx';+import { Taskbar, BAR_H, barSize } from './components/Taskbar.jsx';+import { StartMenu, startBox } from './components/StartMenu.jsx';+import { QuickSettings } from './components/QuickSettings.jsx';+import { NotificationCenter } from './components/NotificationCenter.jsx';+import { taskViewLayout, TaskViewBackdrop, TaskViewLabels, useTaskViewKeys } from './components/TaskView.jsx';+import { Menu } from './components/Menu.jsx';++// The taskbar's alignment (Settings → Desktop & Dock): 'center' (default) or 'start'.+const alignOf = (s) => (s.taskbarAlign === 'start' ? 'start' : 'center');-// ---- 1. tokens -----const ACCENTS = { azul: '#2f6fed', violeta: '#8b5cf6', rosa: '#e11d74', naranja: '#ea7a0c', verde: '#16a34a', grafito: '#6b7280' };--function makeTheme({ mode, accent }) {- const dark = mode === 'dark';- return {- mode, accents: ACCENTS, accent: ACCENTS[accent] || ACCENTS.azul, wallpapers: [],- text: dark ? '#e8eaf0' : '#14161c', textDim: dark ? '#8b90a0' : '#646a78',- windowBg: dark ? '#1b1e25' : '#f7f8fa', sidebarBg: dark ? '#20242c' : '#eceef2',- separator: dark ? '#2d323d' : '#d7dae1', hover: dark ? '#262b35' : '#e3e6ec',- control: dark ? '#2d323d' : '#d7dae1', inputBg: dark ? '#14161c' : '#ffffff',- desktop: dark ? '#0f2537' : '#3a7ca5', bar: dark ? '#14171d' : '#e9ecf1', titleBg: dark ? '#232833' : '#dfe3ea',- gtkButtons: ':minimize,maximize,close', // GTK apps: buttons on the right, like this frame- };-}--const BAR_H = 44; // bar at the top or bottom-const BAR_W = 64; // bar on the left or right (icons only)-// Bar position (Settings → Desktop & Dock: taskbarPosition). Left and right are physical-// sides of the screen, also in Arabic or Hebrew. side() gives where each panel attaches.-const barSize = (pos) => (pos === 'left' || pos === 'right' ? BAR_W : BAR_H);// Several displays (docs/DISPLAYS.md): the bar is on the main one; the others are all work area.function workAreaFor(pos, d = mainDisplay()) {const a = { x: d.x, y: d.y, w: d.w, h: d.h };@@ -45,358 +38,26 @@ function workAreaFor(pos, d = mainDisplay()) {return a;}const areaFn = (d) => workAreaFor(dockPrefs(settings.get()).taskbarPosition, d);-// Style to attach a panel next to the bar (start menu, jump list).-function nextToBar(pos, along) {- const b = barSize(pos) + 6;- if (pos === 'top') return { left: along, top: b };- if (pos === 'left') return { left: b, top: along };- if (pos === 'right') return { right: b, top: along };- return { left: along, bottom: b };-}-// The bar's box in screen coordinates (main display), so a menu drawn in another layer can still-// be placed against the bar with nextToBar.-function barBox(pos, m = mainDisplay()) {- const b = barSize(pos);- if (pos === 'left' || pos === 'right') return { left: m.x + (pos === 'right' ? m.w - b : 0), top: m.y, width: b, height: m.h };- return { left: m.x, top: m.y + (pos === 'top' ? 0 : m.h - b), width: m.w, height: b };-}-// A menu next to the bar: in the popover layer (sdk/layers.js), above the bar and the windows.-function NextToBar({ pos, children }) {- return (- <Layer name="popover">- <View style={{ position: 'absolute', ...barBox(pos), pointerEvents: 'box-none' }}>{children}</View>- </Layer>- );-}-// Is the point over the bar? (a click there doesn't close the menu: the start button toggles it)++// Is the point over the bar? (a click there doesn't close a panel: its button toggles it)function onBar(pos, x, y) {const b = barSize(pos), m = mainDisplay();x -= m.x; y -= m.y;return pos === 'top' ? y < b : pos === 'left' ? x < b : pos === 'right' ? x >= m.w - b : y >= m.h - b;}-// ---- 2. window frame -----// <WindowShell> (SDK) adds invisible borders for resizing on all 4 sides and 4 corners;-// moving and resizing is done by lord-server in C (wm.beginMove/beginResize, docs/WINDOWS.md). The-// JS drag below is only kept for a maximized window.-function Window({ win, t, focused }) {- const drag = useRef(null);- const geo = wm.frame(win);- const app = getApp(win.id);- useEffect(() => {- const offMove = addListener('pointermove', (e) => {- if (drag.current) wm.move(win.id, e.x - drag.current.dx, e.y - drag.current.dy);- });- const offUp = addListener('pointerup', () => { drag.current = null; });- return () => { offMove(); offUp(); };- }, [win.id]);- const Btn = ({ label, onClick, danger }) => (- <View onMouseDown={(e) => e.stopPropagation()} onClick={onClick} style={{ width: 34, height: 28, alignItems: 'center',- justifyContent: 'center', backgroundColor: danger ? '#c4314b' : 'transparent' }}>- <Text style={{ fontSize: 14, color: danger ? '#fff' : t.text }}>{label}</Text>- </View>- );- if (win.args?.csd) { // Linux app with its own frame (GTK, Chromium)- return (- <WindowShell win={win} onMouseDown={() => wm.focus(win.id)} style={{ boxShadow: '0 8px 24px rgba(0,0,0,0.35)' }}>- <AppHost id={win.id} focused={focused} />- </WindowShell>- );- }- return (- <WindowShell win={win} onMouseDown={() => wm.focus(win.id)} style={{- backgroundColor: app.transparent ? 'transparent' : t.windowBg, border: `1px solid ${focused ? t.accent : t.separator}`,- boxShadow: '0 8px 24px rgba(0,0,0,0.35)' }}>- <View onMouseDown={(e) => { if (!wm.beginMove(win.id)) drag.current = { dx: e.x - geo.x, dy: e.y - geo.y }; }}- onDoubleClick={() => wm.toggleMaximize(win.id)}- style={{ height: 30, flexDirection: 'row', alignItems: 'center', paddingLeft: 10, backgroundColor: focused ? t.titleBg : t.windowBg }}>- <Text style={{ flex: 1, fontSize: 12, fontWeight: 600, color: t.text, whiteSpace: 'nowrap' }}>{windowTitle(win)}</Text>- <Btn label="−" onClick={() => wm.minimize(win.id)} />- <Btn label="□" onClick={() => wm.toggleMaximize(win.id)} />- <Btn label="×" danger={focused} onClick={() => wm.close(win.id)} />- </View>- <View style={{ flex: 1 }}><AppHost id={win.id} focused={focused} /></View>- </WindowShell>- );+// A panel at the tray's end of the bar: quick settings and notifications.+function trayPanel(pos, width, height, m = mainDisplay()) {+ const rtl = direction() === 'rtl' && (pos === 'top' || pos === 'bottom');+ const left = pos === 'left' ? m.x + barSize(pos) + 12 : pos === 'right' || !rtl ? m.x + m.w - (pos === 'right' ? barSize(pos) : 0) - 12 - width : m.x + 12;+ if (pos === 'bottom') return { pos: { left, bottom: screen.height - (m.y + m.h - BAR_H - 12) }, top: m.y + m.h - BAR_H - 12 - height, left, height };+ const top = pos === 'top' ? m.y + BAR_H + 12 : m.y + m.h - 12 - height;+ return { pos: { left, top }, top, left, height };}-// ---- 3. taskbar + start menu ------// The power symbol, drawn (it doesn't depend on the font having ⏻)-function PowerGlyph({ color, bg }) {- return (- <View style={{ width: 14, height: 14 }}>- <View style={{ position: 'absolute', left: 1, top: 2, width: 12, height: 12, borderRadius: 6, border: `1.6px solid ${color}` }} />- <View style={{ position: 'absolute', left: 4, top: 0, width: 6, height: 5, backgroundColor: bg }} />- <View style={{ position: 'absolute', left: 6.2, top: 0, width: 1.6, height: 7, borderRadius: 1, backgroundColor: color }} />- </View>- );-}--// A choice under the power button (Restart…, Shut Down…)-function PowerRow({ t, label, onClick }) {- const [hover, setHover] = useState(false);- return (- <View onClick={onClick} onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}- style={{ padding: 8, paddingLeft: 30, backgroundColor: hover ? t.hover : 'transparent' }}>- <Text style={{ fontSize: 13, color: t.text }}>{label}</Text>- </View>- );-}--// An app is pinned by dragging it onto the bar (the menu closes when the drag starts) or with a-// right click → Pin to taskbar.-function StartMenu({ t, onClose, pos }) {- const ref = useRef(null);- const list = useLauncherApps();- const [ctx, setCtx] = useState(null); // { app, x }- const [power, setPower] = useState(false); // the power button's menu (Restart…, Shut Down…)- const groups = APP_CATEGORIES.map((c) => [c, list.filter((a) => appCategory(a) === c)]).filter(([, items]) => items.length);- useEffect(() => addListener('pointerdown', (e) => {- for (let n = e.target; n; n = n.parent) if (n === ref.current) return;- if (!onBar(pos, e.x, e.y)) onClose();- }), [pos]);- return (- <View ref={ref} style={{ position: 'absolute', ...nextToBar(pos, 6), width: 280, padding: 8, direction: 'ltr',- backgroundColor: t.bar, border: `1px solid ${t.separator}`, boxShadow: '0 10px 30px rgba(0,0,0,0.4)' }}>- <Text style={{ fontSize: 11, fontWeight: 600, color: t.textDim, margin: 6 }}>{tr('shell.start.apps')}</Text>- {/* the list leaves room for the footer (lock, switch user, log out, power and its two choices) */}- <ScrollView style={{ height: Math.min(list.length * 40 + groups.length * 26, screen.height - BAR_H - 200 - (power ? 72 : 0)) }}>- {groups.map(([c, items]) => (- <View key={c}>- <Text style={{ fontSize: 10, fontWeight: 700, color: t.textDim, marginLeft: 6, marginTop: 8, marginBottom: 2 }}>{tr(`shell.category.${c}`)}</Text>- {items.map((a) => (- <View key={a.id} onClick={() => { if (dockDragJustEnded()) return; onClose(); launchApp(a.id); }}- onMouseDown={(e) => { if (!e.button && dockIdOf(a)) beginDockDrag({ id: dockIdOf(a), Icon: a.Icon, x: e.x, y: e.y, source: 'launcher', onStart: onClose }); }}- onContextMenu={(e) => dockIdOf(a) && setCtx({ app: a, x: (pos === 'left' || pos === 'right' ? e.y : e.x) - 20 })}- style={{ flexDirection: 'row', alignItems: 'center', gap: 10, padding: 6 }}>- <a.Icon size={28} />- <Text style={{ fontSize: 13, color: t.text, whiteSpace: 'nowrap' }}>{a.name}</Text>- </View>- ))}- </View>- ))}- </ScrollView>- <View style={{ height: 1, backgroundColor: t.separator, marginVertical: 6 }} />- {session.managed() ? (- <View onClick={() => { onClose(); session.lock(); }} style={{ padding: 8 }}><Text style={{ fontSize: 13, color: t.text }}>{tr('shell.menu.lock')}</Text></View>- ) : null}- {session.managed() ? (- <View onClick={() => { onClose(); session.switchUser(); }} style={{ padding: 8 }}><Text style={{ fontSize: 13, color: t.text }}>{tr('shell.menu.switchUser')}</Text></View>- ) : null}- <View style={{ flexDirection: 'row', alignItems: 'center' }}>- <View onClick={() => session.quit()} style={{ flex: 1, padding: 8 }}><Text style={{ fontSize: 13, color: t.text }}>{tr('shell.menu.logout')}</Text></View>- {session.canPower() ? (- <View onClick={() => setPower((v) => !v)} style={{ flexDirection: 'row', alignItems: 'center', gap: 6, paddingVertical: 6,- paddingHorizontal: 10, borderRadius: 4, backgroundColor: power ? t.hover : 'transparent' }}>- <PowerGlyph color={t.text} bg={power ? t.hover : t.bar} />- <Text style={{ fontSize: 13, color: t.text }}>{tr('shell.menu.power')}</Text>- </View>- ) : null}- </View>- {power ? [['restart', () => session.restart()], ['shutdown', () => session.shutdown()]].map(([k, go]) => (- <PowerRow key={k} t={t} label={tr(`shell.menu.${k}`)} onClick={() => { onClose(); go(); }} />- )) : null}- {ctx && (- <PopupMenu t={t} pos={pos} x={ctx.x} onClose={() => setCtx(null)} items={[- { label: tr('shell.dock.open'), onClick: () => { onClose(); launchApp(ctx.app.id); } },- dock.isPinned(ctx.app)- ? { label: tr('shell.dock.unpin'), disabled: !dock.canRemove(ctx.app), onClick: () => dock.unpin(ctx.app) }- : { label: tr('shell.dock.pin'), onClick: () => dock.pin(ctx.app) },- ]} />- )}- </View>- );-}--// A small menu next to the bar (the jump list, the Trash's and the start menu's right click).-// Keyboard: ↑/↓, Enter, Escape.-function PopupMenu({ t, items, x, onClose, pos }) {- const ref = useRef(null);- const [active, setActive] = useState(-1);- const st = useRef({});- st.current = { items, active };- const ok = (it) => it && it !== '-' && !it.disabled;- useEffect(() => {- const offPtr = addListener('pointerdown', (e) => {- for (let n = e.target; n; n = n.parent) if (n === ref.current) return;- onClose();- });- const tok = {};- takeTextFocus(tok, (e) => {- const { items: list, active: a } = st.current;- const step = (d) => { for (let k = 1; k <= list.length; k++) { const i = ((a < 0 && d < 0 ? 0 : a) + d * k + list.length * 2) % list.length; if (ok(list[i])) { setActive(i); return; } } };- if (e.key === 'Escape') onClose();- else if (e.key === 'ArrowDown') step(1);- else if (e.key === 'ArrowUp') step(-1);- else if ((e.key === 'Enter' || e.key === ' ') && ok(list[a])) { onClose(); list[a].onClick?.(); }- });- return () => { offPtr(); releaseTextFocus(tok); };- }, []);- const W = 250;- const H = items.reduce((h, it) => h + (it === '-' ? 9 : 28), 8);- const maxH = screen.height - BAR_H - 20;- const rows = items.map((it, i) => (it === '-'- ? <View key={i} style={{ height: 1, backgroundColor: t.separator, marginVertical: 4 }} />- : (- <View key={i} onMouseEnter={() => setActive(ok(it) ? i : -1)} onClick={() => { if (it.disabled) return; onClose(); it.onClick?.(); }}- style={{ flexDirection: 'row', alignItems: 'center', height: 28, paddingHorizontal: 8, backgroundColor: i === active ? t.hover : 'transparent' }}>- <Text style={{ width: 18, fontSize: 12, color: t.accent }}>{it.checked ? '✓' : ''}</Text>- <Text style={{ flex: 1, fontSize: 13, color: it.disabled ? t.textDim : t.text, whiteSpace: 'nowrap', overflow: 'hidden' }}>{it.label}</Text>- </View>- )));- return (- <View ref={ref} style={{ position: 'absolute', ...nextToBar(pos, pos === 'left' || pos === 'right' ? Math.max(4, Math.min(x, screen.height - Math.min(H, maxH) - 8))- : Math.max(4, Math.min(x, screen.width - W - 4))), width: W, padding: 4, direction: 'ltr',- backgroundColor: t.bar, border: `1px solid ${t.separator}`, boxShadow: '0 10px 30px rgba(0,0,0,0.4)' }}>- {H > maxH ? <ScrollView style={{ height: maxH }}>{rows}</ScrollView> : rows}- </View>- );-}--// The bar's right-click menu (a jump list): the SDK's items (dockMenu), with submenus flattened-// and taskbar wording.-function JumpList({ t, entry, x, onClose, pos }) {- const items = [];- for (const it of dockMenu(entry, { keepLabel: tr('shell.dock.pin'), removeLabel: tr('shell.dock.unpin') })) {- if (it !== '-' && it.submenu) items.push(...it.submenu);- else if (it !== '-' && it.label === tr('shell.dock.quit')) items.push({ ...it, label: tr('shell.dock.closeAll') });- else if (it !== '-' && it.label === tr('shell.dock.hide')) continue;- else items.push(it);- }- return <PopupMenu t={t} items={items} x={x} pos={pos} onClose={onClose} />;-}--// Taskbar: Files first, the pinned and open apps (one per app: windows of the same app are-// grouped), then the Trash, always last. The same rules and SDK calls as the default theme's Dock-// (sdk/dock.js): drag a button to reorder it (a line shows where it lands), drag it off the bar and-// hold to unpin it, drop apps from the start menu; Files and Settings can't be unpinned.-// Click: opens the app or brings its window (if it was already in front, minimizes it); right click: JumpList.-function Taskbar({ t, onStart, pos, onEmptyTrash }) {- const clock = useClock((d) => formatTime(d, { seconds: !!settings.get().clock?.seconds }), 1000); // Settings → Date & Time- const entries = useDockEntries(['files', 'terminal', 'store', 'settings']);- const { focused } = useWindows();- const [jump, setJump] = useState(null);- const [trashMenuAt, setTrashMenuAt] = useState(null);- const trash = useTrash();- const drag = useStore(dockDrag);- const vert = pos === 'left' || pos === 'right';- const refs = useRef(new Map());- const barRef = useRef(null);- const trashRef = useRef(null);- const click = (e) => {- if (dockDragJustEnded()) return;- const top = e.windows.find((w) => w.id === focused);- if (top && e.windows.length === 1) wm.minimize(top.id); else dockActivate(e);- };- // where the buttons are (global coordinates), for the drop position- const centerOf = (id) => {- const n = refs.current.get(id);- if (!n) return null;- const [x, y, w, h] = lord.getLayout(n.id);- return vert ? y + h / 2 : x + w / 2;- };- const geo = useRef({});- geo.current = { entries, vert, drag };- useEffect(() => registerDockTarget({- hit(x, y) {- const g = geo.current;- if (!barRef.current) return null;- const [bx, by, bw, bh] = lord.getLayout(barRef.current.id);- if (!(x >= bx - 16 && x < bx + bw + 16 && y >= by - 16 && y < by + bh + 16)) return null;- if (trashRef.current) {- const [tx, ty, tw, th] = lord.getLayout(trashRef.current.id);- if (x >= tx && x < tx + tw && y >= ty && y < ty + th) return { trash: true };- }- const a = g.vert ? y : x;- const own = g.drag?.source === 'dock' ? g.drag.id : null;- const cs = g.entries.filter((e) => e.pinned && !e.recent && e.id !== own).map((e) => centerOf(e.id)).filter((c) => c != null);- return { index: cs.filter((c) => c < a).length };- },- near(x, y) {- if (!barRef.current) return false;- const [bx, by, bw, bh] = lord.getLayout(barRef.current.id);- const dx = x < bx ? bx - x : x > bx + bw ? x - bx - bw : 0, dy = y < by ? by - y : y > by + bh ? y - by - bh : 0;- return Math.hypot(dx, dy) <= 60;- },- }), []);- // the drop line: before the pinned button at that index (after the last one at the end)- let dropLine = null;- if (drag && drag.over && drag.over.index != null && barRef.current) {- const own = drag.source === 'dock' ? drag.id : null;- const pinned = entries.filter((e) => e.pinned && !e.recent && e.id !== own);- const k = Math.max(1, Math.min(pinned.length, drag.over.index));- const ref = refs.current.get((pinned[k] || pinned[pinned.length - 1])?.id);- if (ref) {- const [bx, by] = lord.getLayout(barRef.current.id);- const [x, y, w, h] = lord.getLayout(ref.id);- const at = pinned[k] ? (vert ? y - by - 3 : x - bx - 3) : (vert ? y - by + h + 1 : x - bx + w + 1);- dropLine = vert ? { top: at, left: 6, right: 6, height: 2 } : { left: at, top: 6, bottom: 6, width: 2 };- }- }- const btn = (e) => {- const active = e.focused;- const title = e.windows.length ? windowTitle(e.windows.find((w) => w.id === focused) || e.windows[e.windows.length - 1]) : '';- const dragged = drag && drag.source === 'dock' && drag.id === e.id;- return (- <View key={e.id} ref={(n) => { if (n) refs.current.set(e.id, n); else refs.current.delete(e.id); }}- onClick={() => click(e)} onContextMenu={(ev) => setJump({ entry: e, x: (vert ? ev.y : ev.x) - 20 })}- onMouseDown={(ev) => { if (!ev.button) beginDockDrag({ id: e.id, Icon: e.Icon, x: ev.x, y: ev.y, source: 'dock' }); }}- style={{ height: vert ? 44 : 32, width: vert ? 52 : undefined, paddingHorizontal: vert ? 0 : e.running ? 10 : 6, flexDirection: 'row',- alignItems: 'center', justifyContent: vert ? 'center' : 'flex-start', gap: 8, opacity: dragged ? 0.35 : 1,- backgroundColor: active ? t.hover : 'transparent', border: `1px solid ${active ? t.accent : 'transparent'}` }}>- {e.running && <View style={{ position: 'absolute', backgroundColor: t.accent, ...(pos === 'top' ? { left: 0, right: 0, top: 0, height: 2 }- : pos === 'left' ? { top: 0, bottom: 0, left: 0, width: 2 } : pos === 'right' ? { top: 0, bottom: 0, right: 0, width: 2 }- : { left: 0, right: 0, bottom: 0, height: 2 }) }} />}- <e.Icon size={vert ? 26 : 20} />- {e.running && !vert && <Text style={{ fontSize: 12, color: t.text, whiteSpace: 'nowrap' }}>{title.slice(0, 24)}</Text>}- {e.windows.length > 1 && <Text style={{ fontSize: 10, fontWeight: 700, color: t.textDim }}>{e.windows.length}</Text>}- </View>- );- };- return (- <View ref={barRef} style={{ position: 'absolute', ...(vert ? { top: 0, bottom: 0, width: BAR_W, [pos]: 0, flexDirection: 'column', paddingVertical: 6 }- : { left: 0, right: 0, height: BAR_H, [pos]: 0, flexDirection: 'row', paddingHorizontal: 6 }), alignItems: 'center',- gap: 4, backgroundColor: t.bar, border: `1px solid ${t.separator}`, direction: 'ltr' }}>- <View onClick={onStart} style={{ height: 32, paddingHorizontal: vert ? 0 : 14, width: vert ? 52 : undefined, alignItems: 'center',- justifyContent: 'center', backgroundColor: t.accent }}>- <Text style={{ fontSize: vert ? 11 : 13, fontWeight: 700, color: '#fff' }}>LordOS</Text>- </View>- {entries.map(btn)}- <View style={vert ? { width: 30, height: 1, backgroundColor: t.separator } : { width: 1, height: 22, backgroundColor: t.separator }} />- <View ref={trashRef} dropTrash onClick={() => { if (!dockDragJustEnded()) openTrash(); }}- onContextMenu={(ev) => setTrashMenuAt((vert ? ev.y : ev.x) - 20)} onMouseUp={() => setTimeout(refreshTrash, 60)}- style={{ height: vert ? 44 : 32, width: vert ? 52 : 34, alignItems: 'center', justifyContent: 'center',- backgroundColor: drag?.over?.trash ? t.hover : 'transparent' }}>- <TrashGlyph size={vert ? 26 : 22} full={trash.full} t={t} />- </View>- <View style={{ flex: 1 }} />- {vert ? null : <StatusItems color={t.text} />}- <PrivacyIndicators />- <Text style={{ fontSize: vert ? 12 : 13, fontWeight: 600, color: t.text, marginRight: vert ? 0 : 10, marginBottom: vert ? 6 : 0 }}>{clock}</Text>- {dropLine && <View style={{ position: 'absolute', ...dropLine, backgroundColor: t.accent, pointerEvents: 'none' }} />}- {jump && <NextToBar pos={pos}><JumpList t={t} pos={pos} entry={entries.find((x) => x.id === jump.entry.id) || jump.entry} x={jump.x} onClose={() => setJump(null)} /></NextToBar>}- {trashMenuAt != null && <NextToBar pos={pos}><PopupMenu t={t} pos={pos} x={trashMenuAt} onClose={() => setTrashMenuAt(null)}- items={trashMenu({ onEmpty: onEmptyTrash }).filter((it) => it !== '-')} /></NextToBar>}- </View>- );-}--// The Trash on the taskbar: a small bin, with papers when it isn't empty.-function TrashGlyph({ size: s, full, t }) {- const line = t.mode === 'dark' ? 'rgba(255,255,255,0.7)' : 'rgba(30,34,44,0.65)';- return (- <View style={{ width: s, height: s }}>- {full && <View style={{ position: 'absolute', left: s * 0.3, top: s * 0.02, width: s * 0.4, height: s * 0.24, borderRadius: 2,- backgroundColor: t.mode === 'dark' ? '#d9dde6' : '#ffffff', border: `1px solid ${line}`, transform: 'rotate(-10deg)' }} />}- <View style={{ position: 'absolute', left: s * 0.18, top: s * 0.18, width: s * 0.64, height: s * 0.07, backgroundColor: line, borderRadius: 1 }} />- <View style={{ position: 'absolute', left: s * 0.24, top: s * 0.28, width: s * 0.52, height: s * 0.62, border: `1.5px solid ${line}`,- borderBottomLeftRadius: s * 0.08, borderBottomRightRadius: s * 0.08 }}>- {[0.3, 0.6].map((k) => <View key={k} style={{ position: 'absolute', top: s * 0.08, bottom: s * 0.08, left: s * 0.52 * k - 1, width: 1.5, backgroundColor: line }} />)}- </View>- </View>- );-}+// chrome: borders (1 + 1) and the title bar of Window.jsx's frame+configureWindows({ apps, workArea: areaFn, chrome: { w: 2, h: TITLE_H + 2 }, snap: true });+wm.open('about');// What is being dragged (from the bar or the start menu), and the remove cue.function DragGhost({ t }) {@@ -406,7 +67,7 @@ function DragGhost({ t }) {<View style={{ position: 'absolute', left: drag.x - 14, top: drag.y - 14, pointerEvents: 'none', opacity: drag.removing ? 0.5 : 0.9, alignItems: 'center' }}>{drag.Icon ? <drag.Icon size={28} /> : null}{drag.removing && (- <View style={{ marginTop: 4, paddingHorizontal: 6, paddingVertical: 2, backgroundColor: t.bar, border: `1px solid ${t.separator}` }}>+ <View style={{ marginTop: 4, paddingHorizontal: 6, paddingVertical: 2, borderRadius: 4, backgroundColor: t.popupBg, border: `1px solid ${t.windowBorder}` }}><Text style={{ fontSize: 11, color: t.text, whiteSpace: 'nowrap' }}>{tr('shell.dock.unpinCue')}</Text></View>)}@@ -434,49 +95,135 @@ function PoofFade() {);}--// ---- 4. App -----configureWindows({ apps, workArea: areaFn, chrome: { w: 2, h: 32 } });-wm.open('about');+// Where a dragged window would snap: a translucent accent rectangle under the window.+function SnapPreview({ t }) {+ const p = useStore(snapPreview);+ if (!p) return null;+ const r = p.rect;+ return (+ <View style={{ position: 'absolute', left: r.x + 6, top: r.y + 6, width: r.w - 12, height: r.h - 12, borderRadius: 8, pointerEvents: 'none',+ backgroundColor: t.mode === 'dark' ? 'rgba(255,255,255,0.10)' : 'rgba(255,255,255,0.35)', border: `2px solid ${t.accent}` }} />+ );+}function App() {const [s] = useSettings();const t = makeTheme(s);const { windows, visible, focused } = useWindows();- const [start, setStart] = useState(false);+ const [panel, setPanel] = useState(null); // 'start' | 'quick' | 'notif' | null+ const [taskView, setTaskView] = useState(false);+ const [tvHover, setTvHover] = useState(null);+ const [desk, setDesk] = useState(null); // the desktop's right-click menuconst [askEmpty, setAskEmpty] = useState(false);+ const history = useStore(notifyHistory);+ const seen = useRef(0);const pos = dockPrefs(s).taskbarPosition;- // the work area follows the bar live- useEffect(() => { configureWindows({ apps, workArea: areaFn }); }, [pos, screen.width, screen.height]);+ const align = alignOf(s);const m = mainDisplay();+ const all = screenDisplays();+ // the work area and the banners follow the bar live+ useEffect(() => {+ configureWindows({ apps, workArea: areaFn });+ setBannerPlacement(pos === 'top' ? 'top' : 'bottom');+ }, [pos, screen.width, screen.height]);+ const toggle = (name) => setPanel((p) => (p === name ? null : name));+ const close = () => setPanel(null);+ if (panel === 'notif' && history.length) seen.current = Math.max(seen.current, history[0].id);+ const unread = history.some((n) => n.id > seen.current);++ // Super alone opens the start menu (only if released without being used in a shortcut);+ // Super+arrows snap the window in front, Super+Tab is the task view, Super+A quick settings,+ // Super+N the notifications, Alt+F4 closes the window in front, Escape closes what is open.+ const st = useRef({});+ st.current = { focused, taskView };+ useEffect(() => {+ let superAlone = false;+ const offDown = addListener('keydown', (e) => {+ const sup = e.code === 125 || e.code === 126;+ if (sup) { if (!e.repeat) superAlone = true; return; }+ superAlone = false;+ const f = st.current.focused;+ if (e.meta && !e.ctrl && !e.alt) {+ const dir = { ArrowLeft: 'left', ArrowRight: 'right', ArrowUp: 'up', ArrowDown: 'down' }[e.key];+ if (dir && f) { wm.snapKey(f, dir); return; } // physical sides, also in right-to-left languages+ if (e.key === 'Tab' && !e.repeat) { setPanel(null); setTaskView((v) => !v); return; }+ const k = String(e.base || e.key || '').toLowerCase();+ if (k === 'a' && !e.repeat) { toggle('quick'); return; }+ if (k === 'n' && !e.repeat) { toggle('notif'); return; }+ }+ if (e.alt && !e.ctrl && !e.meta && e.code === 62 && f) { wm.close(f); return; } // Alt+F4+ if (e.key === 'Escape') { setPanel(null); setDesk(null); }+ });+ const offUp = addListener('keyup', (e) => {+ if ((e.code === 125 || e.code === 126) && superAlone) { setTaskView(false); toggle('start'); }+ superAlone = false;+ });+ return () => { offDown(); offUp(); };+ }, []);// trackpad: a 3-finger swipe up opens the start menu, down closes it (docs/TRACKPAD.md)- useEffect(() => registerGestureActions({ up: () => setStart(true), down: () => setStart(false) }), []);+ useEffect(() => registerGestureActions({ up: () => setPanel('start'), down: () => { setPanel(null); setTaskView(false); } }), []);++ // the task view: every window of the main display (minimized ones too), in a grid+ const area = workAreaFor(pos, m);+ const tvList = taskView ? windows.filter((w) => !w.fullscreen && !w.pip) : [];+ const layout = taskView ? taskViewLayout(tvList, area) : null;+ const pick = (id) => { setTaskView(false); wm.focus(id); };+ useTaskViewKeys(taskView, tvList, tvHover, setTvHover, pick, () => setTaskView(false));+ const shown = taskView ? tvList : visible;++ const wallpaper = findWallpaper(t.wallpapers, s.wallpaper);+ const isOnBar = (x, y) => onBar(pos, x, y);+ const preview = useStore(snapPreview);+ const top = shown[shown.length - 1];+ const qsAt = trayPanel(pos, 360, m.h - BAR_H - 24, m);+ const ncH = Math.min(760, m.h - (pos === 'left' || pos === 'right' ? 0 : BAR_H) - 24);+ const ncAt = trayPanel(pos, 380, ncH, m);return (<ThemeProvider tokens={t}>- <View style={{ width: '100%', height: '100%', backgroundColor: t.desktop }}>- <Text style={{ position: 'absolute', left: m.x + m.w - (pos === 'right' ? BAR_W : 0) - 24 - 170, top: m.y + m.h - (pos === 'bottom' ? BAR_H : 0) - 16 - 50, fontSize: 40, fontWeight: 700, color: 'rgba(255,255,255,0.12)' }}>LordOS</Text>+ <View style={{ width: '100%', height: '100%', backgroundColor: t.mode === 'dark' ? '#101216' : '#c9d3e0' }}>+ {all.map((d) => (+ <Image key={d.id + ':' + d.x} src={wallpaperSrc(wallpaper, d.w * (d.scale || 100) / 100, d.h * (d.scale || 100) / 100)}+ onContextMenu={(e) => setDesk({ x: e.x, y: e.y })}+ style={{ position: 'absolute', left: d.x, top: d.y, width: d.w, height: d.h, objectFit: 'cover' }} />+ ))}<DesktopWidgets layer="below" />- {visible.map((w) => <Window key={w.id} win={w} t={t} focused={w.id === focused} />)}+ {taskView ? <TaskViewBackdrop area={area} empty={!tvList.length} onClose={() => setTaskView(false)} /> : null}+ {shown.map((w) => [+ preview && w === top ? <SnapPreview key="snap" t={t} /> : null,+ <Window key={w.id} win={w} t={t} focused={!taskView && w.id === focused} app={getApp(w.id)}+ tv={layout && layout.get(w.id) ? { ...layout.get(w.id), hover: tvHover === w.id, onPick: () => pick(w.id),+ onEnter: () => setTvHover(w.id), onLeave: () => setTvHover((h) => (h === w.id ? null : h)) } : null} />,+ ])}+ {taskView ? <TaskViewLabels t={t} list={tvList} layout={layout} hover={tvHover} setHover={setTvHover} /> : null}<DesktopWidgets layer="above" />- {/* the bar on the main display, and above it the start menu: each in its layer- (sdk/layers.js, docs/LAYERS.md), so the order and the clicks are the layers' */}+ {/* the bar on the main display and the panels above it: each in its layer (sdk/layers.js,+ docs/LAYERS.md), so the order and the clicks are the layers' */}<Layer name="dock"><View style={{ position: 'absolute', left: m.x, top: m.y, width: m.w, height: m.h, pointerEvents: 'box-none' }}>- <Taskbar t={t} pos={pos} onStart={() => setStart((v) => !v)} onEmptyTrash={() => setAskEmpty(true)} />+ <Taskbar t={t} pos={pos} align={align} start={panel === 'start'} onStart={() => { setTaskView(false); toggle('start'); }}+ onSearch={() => { setTaskView(false); toggle('start'); }} taskView={taskView} onTaskView={() => { setPanel(null); setTaskView((v) => !v); }}+ quick={panel === 'quick'} onQuick={() => toggle('quick')} notif={panel === 'notif'} onNotif={() => toggle('notif')} unread={unread}+ onEmptyTrash={() => setAskEmpty(true)} /></View></Layer>- {start && (- <Layer name="popover">- <View style={{ position: 'absolute', left: m.x, top: m.y, width: m.w, height: m.h, pointerEvents: 'box-none' }}>- <StartMenu t={t} pos={pos} onClose={() => setStart(false)} />- </View>- </Layer>+ {panel === 'start' && <Layer name="popover"><StartMenu t={t} box={startBox(pos, align, m)} onClose={close} isOnBar={isOnBar} /></Layer>}+ {panel === 'quick' && <Layer name="popover"><QuickSettings t={t} at={qsAt} onClose={close} isOnBar={isOnBar} /></Layer>}+ {panel === 'notif' && <Layer name="popover"><NotificationCenter t={t} at={ncAt} onClose={close} isOnBar={isOnBar} /></Layer>}+ {desk && (+ <Menu t={t} x={desk.x} y={desk.y} onClose={() => setDesk(null)} items={[+ { label: tr('shell.classic.taskView'), onClick: () => setTaskView(true) },+ '-',+ { label: tr('shell.classic.personalize'), onClick: () => wm.open('settings', { args: { section: 'appearance' } }) },+ { label: tr('shell.desktop.wallpaper'), onClick: () => wm.open('settings', { args: { section: 'wallpaper' } }) },+ { label: tr('shell.classic.displaySettings'), onClick: () => wm.open('settings', { args: { section: 'displays' } }) },+ ]} />)}<Layer name="drag"><DragGhost t={t} /><PoofFade /></Layer>- <Layer name="modal"><PowerDialog /></Layer> {/* Restart…, Shut Down… (sdk/power.jsx) */}+ {/* Restart…, Shut Down… (sdk/power.jsx) */}+ <Layer name="modal"><PowerDialog /></Layer>{askEmpty && (<Layer name="modal"><ConfirmDialog title={tr('shell.trash.confirmTitle')} detail={tr('shell.trash.confirmDetail')} okLabel={tr('shell.trash.empty')}diff --git a/themes/classic/theme.json b/themes/classic/theme.jsonindex 209bc8c..0fabeab 100644--- a/themes/classic/theme.json+++ b/themes/classic/theme.json@@ -1,4 +1,4 @@{- "name": "Clásico (plantilla)",- "description": "Barra de tareas abajo y menú de inicio. Punto de partida para crear temas."+ "name": "Classic",+ "description": "A centered taskbar with a start menu, quick settings, a notification panel, window snapping and a task view."}diff --git a/themes/classic/tokens.js b/themes/classic/tokens.jsnew file mode 100644index 0000000..8fb6dde--- /dev/null+++ b/themes/classic/tokens.js@@ -0,0 +1,64 @@+// Tokens of the "Classic" theme. The base keys (text, accent, windowBg…) are the contract with the+// apps (sdk/theme.js); the shape keys (controlRadius, menuHighlight, selection, inputFocus,+// buttonBorder, popupBg) restyle the SDK's shared controls, so every app takes this look without+// being changed. The rest belongs to this theme (docs/DESIGN.md, "Classic").+import { lordosWallpapers } from '@lordos/sdk';++// The same names as the default theme's, so the user's accent survives a theme switch.+export const accents = {+ azul: '#2f6fed',+ violeta: '#8b5cf6',+ rosa: '#e11d74',+ naranja: '#ea7a0c',+ verde: '#16a34a',+ grafito: '#6b7280',+};++export const wallpapers = lordosWallpapers;++export function makeTheme({ mode, accent, effects }) {+ const dark = mode === 'dark';+ const glass = effects !== false;+ return {+ mode,+ accent: accents[accent] || accents.azul,+ accents,+ wallpapers,+ effects: glass,+ text: dark ? '#f1f1f4' : '#1b1b20',+ textDim: dark ? 'rgba(241,241,244,0.6)' : 'rgba(27,27,32,0.6)',+ windowBg: dark ? '#202024' : '#fbfbfc',+ sidebarBg: dark ? '#1a1a1e' : '#f2f2f5',+ separator: dark ? 'rgba(255,255,255,0.085)' : 'rgba(0,0,0,0.09)',+ hover: dark ? 'rgba(255,255,255,0.065)' : 'rgba(0,0,0,0.045)',+ control: dark ? '#2c2c32' : '#f4f4f6',+ inputBg: dark ? '#26262b' : '#ffffff',+ radius: 6,+ // shared controls (sdk/theme.js): small radii, bordered buttons, light menu highlight,+ // selection with an accent bar, an accent underline on the focused field+ controlRadius: 4,+ controlRadiusSmall: 4,+ groupRadius: 6,+ menuRadius: 8,+ menuItemRadius: 4,+ menuHighlight: 'subtle',+ selection: 'indicator',+ inputFocus: 'underline',+ buttonBorder: true,+ popupBg: dark ? '#2b2b30' : '#fafafb',+ gtkButtons: ':minimize,maximize,close', // GTK apps: buttons on the right, like this frame+ // This theme's own:+ titleBg: dark ? '#202024' : '#fbfbfc',+ titleBgBlur: dark ? '#1b1b1f' : '#f1f1f4', // the title bar of a window that isn't in front+ windowBorder: dark ? 'rgba(255,255,255,0.11)' : 'rgba(0,0,0,0.13)',+ closeHover: '#d83b33',+ barBg: dark ? (glass ? 'rgba(30,30,35,0.80)' : '#1e1e23') : (glass ? 'rgba(242,243,246,0.82)' : '#eff0f3'),+ barBorder: dark ? 'rgba(255,255,255,0.08)' : 'rgba(0,0,0,0.08)',+ panelBg: dark ? (glass ? 'rgba(38,38,43,0.88)' : '#26262b') : (glass ? 'rgba(248,248,250,0.90)' : '#f6f6f8'),+ panelFoot: dark ? 'rgba(0,0,0,0.18)' : 'rgba(0,0,0,0.035)',+ tile: dark ? 'rgba(255,255,255,0.06)' : 'rgba(255,255,255,0.75)',+ tileBorder: dark ? 'rgba(255,255,255,0.07)' : 'rgba(0,0,0,0.07)',+ blur: glass ? 28 : 0,+ shadow: dark ? '0 16px 40px rgba(0,0,0,0.55)' : '0 16px 40px rgba(0,0,0,0.22)',+ };+}