Bring up SSD2092 display/touch, USB NCM, HiDPI XLibre/DWM, and USB charging
This commit is contained in:
1 parent
034c1f61b1
commit
9db15e30ce
150 files changed
+2356
-446
No files matched your search
@@ -135,6 +135,9 @@ if command -v glib-compile-schemas >/dev/null 2>&1 && \
|
||||
fi
|
||||
|
||||
rm -f "$TARGET_ROOTFS/etc/runlevels/sysinit/hwdrivers"
|
||||
if [ -f "$TARGET_ROOTFS/etc/inittab" ]; then
|
||||
sed -i 's/^tty1::respawn:/#tty1::respawn:/' "$TARGET_ROOTFS/etc/inittab"
|
||||
fi
|
||||
|
||||
if [ -e "$TARGET_ROOTFS/usr/lib/dri/libdril_dri.so" ]; then
|
||||
ln -sfn libdril_dri.so "$TARGET_ROOTFS/usr/lib/dri/simpledrm_dri.so"
|
||||
|
||||
@@ -42,6 +42,11 @@ apk add --no-cache python3 kmod openssl glib >/dev/null
|
||||
|
||||
echo "[3/8] Installing the Geminux aarch64 package set..."
|
||||
PKGS="$(grep -v '^[[:space:]]*#' "$PKGS_FILE" | grep -v '^[[:space:]]*$' | tr '\n' ' ')"
|
||||
if [ -f "$ROOTFS/etc/apk/world" ]; then
|
||||
grep -v -E '^geminux-(kernel-modules|xlibre|suckless|dunst|ui|config)(@|=|$)' \
|
||||
"$ROOTFS/etc/apk/world" > "$ROOTFS/etc/apk/world.tmp" || true
|
||||
mv "$ROOTFS/etc/apk/world.tmp" "$ROOTFS/etc/apk/world"
|
||||
fi
|
||||
"$REPO/scripts/prune-rootfs-packages.sh" "$ROOTFS" world
|
||||
if [ ! -f "$ROOTFS/lib/apk/db/installed" ]; then
|
||||
# shellcheck disable=SC2086
|
||||
|
||||
+11
-2
@@ -50,9 +50,18 @@ EOF
|
||||
echo "[1b/5] Cloning X11Libre/xserver..."
|
||||
rm -rf "$XLIBRE_SRC"
|
||||
git clone --depth 1 https://github.com/X11Libre/xserver.git "$XLIBRE_SRC"
|
||||
fi
|
||||
XLIBRE_STAMP="$XLIBRE_SRC/.geminux-patches-sha"
|
||||
XLIBRE_PATCH_SHA="$( { sha256sum /geminux/patches/xlibre/*.patch 2>/dev/null || echo "no-patches"; } | sha256sum | awk "{print \$1}" )"
|
||||
if [ "${FORCE_REBUILD:-0}" = "1" ] || [ ! -f "$XLIBRE_STAMP" ] || [ "$(cat "$XLIBRE_STAMP" 2>/dev/null || true)" != "$XLIBRE_PATCH_SHA" ]; then
|
||||
echo "[1b-2/5] Applying XLibre patch series..."
|
||||
if [ -d "$XLIBRE_SRC/.git" ]; then
|
||||
git -c safe.directory="$XLIBRE_SRC" -C "$XLIBRE_SRC" checkout -- .
|
||||
fi
|
||||
for p in /geminux/patches/xlibre/*.patch; do
|
||||
[ -f "$p" ] && patch -d "$XLIBRE_SRC" -p1 < "$p"
|
||||
done
|
||||
printf "%s\n" "$XLIBRE_PATCH_SHA" > "$XLIBRE_STAMP"
|
||||
fi
|
||||
|
||||
XF86_LIBINPUT_SRC="/geminux/build-cache/xf86-input-libinput"
|
||||
@@ -157,7 +166,7 @@ EOF
|
||||
-Dgbm=true \
|
||||
-Dudev=true \
|
||||
-Dudev_kms=true \
|
||||
-Dsystemd_logind=true \
|
||||
-Dsystemd_logind=false \
|
||||
-Dseatd_libseat=false \
|
||||
-Dsuid_wrapper=false \
|
||||
-Dpciaccess=true \
|
||||
@@ -186,7 +195,7 @@ EOF
|
||||
-Dxkb_dir=/usr/share/X11/xkb \
|
||||
-Dxkb_output_dir=/tmp \
|
||||
-Dxkb_bin_dir=/usr/bin \
|
||||
-Dlog_dir=/tmp
|
||||
-Dlog_dir=/var/log
|
||||
|
||||
ninja -C /tmp/build-xlibre -j"$(nproc)"
|
||||
rm -rf /geminux/prebuilt/xlibre
|
||||
|
||||
@@ -189,14 +189,32 @@ for line in kcfg.splitlines():
|
||||
break
|
||||
else:
|
||||
raise SystemExit(f"FAIL: {sys.argv[3]} missing CONFIG_CMDLINE")
|
||||
if "CONFIG_REGULATOR_FIXED_VOLTAGE=y" not in kcfg.splitlines():
|
||||
raise SystemExit(f"FAIL: {sys.argv[3]} missing CONFIG_REGULATOR_FIXED_VOLTAGE=y")
|
||||
|
||||
rootfs = sys.argv[4]
|
||||
for req_rel in ("etc/pam.d/autologin", "etc/init.d/geminux-hwinit",
|
||||
"usr/lib/dri/simpledrm_dri.so", "etc/runlevels/boot/geminux-usb-gadget"):
|
||||
"usr/lib/dri/simpledrm_dri.so", "etc/runlevels/boot/geminux-usb-gadget",
|
||||
"usr/share/X11/xkb/types/custom", "usr/sbin/dnsmasq"):
|
||||
if not os.path.lexists(os.path.join(rootfs, req_rel)):
|
||||
raise SystemExit(f"FAIL: missing required path {os.path.join(rootfs, req_rel)}")
|
||||
if os.path.lexists(os.path.join(rootfs, "etc/runlevels/sysinit/hwdrivers")):
|
||||
raise SystemExit("FAIL: hwdrivers must not be enabled in sysinit")
|
||||
with open(os.path.join(rootfs, "etc/inittab"), "r", encoding="utf-8") as f:
|
||||
for line in f:
|
||||
if line.startswith("tty1::respawn:"):
|
||||
raise SystemExit("FAIL: rootfs/etc/inittab must not run getty on tty1 (reserved for tinydm/XLibre)")
|
||||
for rel, needle in (
|
||||
("etc/X11/xorg.conf.d/10-geminux-gpu.conf", 'Option "AccelMethod" "none"'),
|
||||
("etc/X11/xorg.conf.d/10-geminux-gpu.conf", 'Option "ShadowFB" "true"'),
|
||||
("etc/X11/xorg.conf.d/30-geminux-keyboard.conf", "custom:types"),
|
||||
("etc/X11/xorg.conf.d/20-geminux-touch.conf", "0 -1 1 1 0 0 0 0 1"),
|
||||
("etc/conf.d/geminux-hwinit", 'GEMINUX_ENABLE_MEDIATEK_DRM="yes"'),
|
||||
):
|
||||
p = os.path.join(rootfs, rel)
|
||||
with open(p, "r", encoding="utf-8") as f:
|
||||
if needle not in f.read():
|
||||
raise SystemExit(f"FAIL: {p} missing '{needle}'")
|
||||
xorg_mode = os.stat(os.path.join(rootfs, "usr/bin/Xorg")).st_mode & 0o7777
|
||||
if xorg_mode != 0o4755:
|
||||
raise SystemExit(f"FAIL: rootfs/usr/bin/Xorg mode is {oct(xorg_mode)}, expected 0o4755")
|
||||
@@ -223,7 +241,7 @@ if missing:
|
||||
print(f"OK (kernel_addr=0x40080000, noautodetect, {len(names)} BusyBox applets linked)")
|
||||
PYEOF
|
||||
|
||||
docker run --rm -v "$IMAGES_DIR:/images:ro" -v "$BASE_DIR/prebuilt/kernel/boot:/kboot:ro" alpine:3.24 sh -eu -c '
|
||||
docker run --rm -i -v "$IMAGES_DIR:/images:ro" -v "$BASE_DIR/prebuilt/kernel/boot:/kboot:ro" alpine:3.24 sh -eu <<'SH_EOF'
|
||||
apk add --no-cache e2fsprogs e2fsprogs-extra dtc >/dev/null
|
||||
e2fsck -fn /images/geminux-rootfs.img
|
||||
debugfs -R "stat /usr/bin/Xorg" /images/geminux-rootfs.img | grep -qE "Mode:[[:space:]]*04755\b" || {
|
||||
@@ -248,7 +266,60 @@ docker run --rm -v "$IMAGES_DIR:/images:ro" -v "$BASE_DIR/prebuilt/kernel/boot:/
|
||||
echo "FAIL: DTB contains static memory@7df00000 that triggers LK reserved_memory_conflict_check" >&2
|
||||
exit 1
|
||||
fi
|
||||
'
|
||||
printf "%s\n" "$DTS_OUT" | grep -q 'compatible = "pwm-backlight";' || {
|
||||
echo "FAIL: DTB missing pwm-backlight node" >&2
|
||||
exit 1
|
||||
}
|
||||
printf "%s\n" "$DTS_OUT" | awk '
|
||||
/^\ti2c@11007000 \{/ { in_i2c=1; depth=1; next }
|
||||
in_i2c {
|
||||
if ($0 ~ /\{/) depth++
|
||||
if ($0 ~ /\}/) { depth--; if (depth == 0) in_i2c=0 }
|
||||
if (in_i2c && depth == 1 && $0 ~ /status = "okay";/) found_ok=1
|
||||
if (in_i2c && depth == 1 && $0 ~ /status = "disabled";/) found_dis=1
|
||||
}
|
||||
/^\tpwm@1100f000 \{/ { in_pwm=1; depth_p=1; next }
|
||||
in_pwm {
|
||||
if ($0 ~ /\{/) depth_p++
|
||||
if ($0 ~ /\}/) { depth_p--; if (depth_p == 0) in_pwm=0 }
|
||||
if (in_pwm && depth_p == 1 && $0 ~ /status = "okay";/) pwm_ok=1
|
||||
if (in_pwm && depth_p == 1 && $0 ~ /status = "disabled";/) pwm_dis=1
|
||||
if (in_pwm && depth_p == 1 && $0 ~ /power-domains[[:space:]]*=/) pwm_pd=1
|
||||
}
|
||||
/^\tusb@11271000 \{/ { in_usb=1; depth_u=1; next }
|
||||
in_usb {
|
||||
if ($0 ~ /\{/) depth_u++
|
||||
if ($0 ~ /\}/) { depth_u--; if (depth_u == 0) in_usb=0 }
|
||||
if (in_usb && depth_u == 1 && $0 ~ /dr_mode = "peripheral";/) usb_periph=1
|
||||
if (in_usb && depth_u == 1 && $0 ~ /usb-role-switch/) usb_rolesw=1
|
||||
}
|
||||
/ldo-vusb33 \{/ { in_vusb=1; next }
|
||||
in_vusb && /\};/ { in_vusb=0 }
|
||||
in_vusb && /regulator-always-on;/ { found_vusb=1 }
|
||||
END {
|
||||
if (!found_ok || found_dis) {
|
||||
print "FAIL: DTB i2c@11007000 (&i2c0) must have status = \"okay\"" > "/dev/stderr"
|
||||
exit 1
|
||||
}
|
||||
if (!found_vusb) {
|
||||
print "FAIL: DTB ldo-vusb33 must have regulator-always-on" > "/dev/stderr"
|
||||
exit 1
|
||||
}
|
||||
if (!pwm_ok || pwm_dis || pwm_pd) {
|
||||
print "FAIL: DTB pwm@1100f000 (&disp_pwm) must be okay without power-domains" > "/dev/stderr"
|
||||
exit 1
|
||||
}
|
||||
if (!usb_periph || usb_rolesw) {
|
||||
print "FAIL: DTB usb@11271000 (&ssusb) must have dr_mode = \"peripheral\" and no usb-role-switch" > "/dev/stderr"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
'
|
||||
SH_EOF
|
||||
if readelf -Ws "$ROOTFS_DIR/usr/bin/Xorg" | grep -q systemd_logind_take_fd; then
|
||||
echo "FAIL: rootfs/usr/bin/Xorg was still built with systemd_logind support" >&2
|
||||
exit 1
|
||||
fi
|
||||
(cd "$IMAGES_DIR" && sha256sum -c SHA256SUMS)
|
||||
|
||||
echo "[8/8] Running all 5 Python unit/verification suites..."
|
||||
|
||||
Executable
+397
@@ -0,0 +1,397 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Generate Geminux crisp HiDPI X11 Xcursor theme under overlay/rootfs/usr/share/icons/default."""
|
||||
|
||||
import math
|
||||
import os
|
||||
import struct
|
||||
import sys
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
DEFAULT_OUT = os.path.join(
|
||||
BASE_DIR, "overlay", "rootfs", "usr", "share", "icons", "default"
|
||||
)
|
||||
|
||||
SIZES = (32, 48, 64)
|
||||
XCURSOR_MAGIC = b"Xcur"
|
||||
XCURSOR_VERSION = 0x00010000
|
||||
XCURSOR_IMAGE_TYPE = 0xFFFD0002
|
||||
XCURSOR_IMAGE_VERSION = 1
|
||||
|
||||
|
||||
def point_in_poly(px, py, poly):
|
||||
inside = False
|
||||
n = len(poly)
|
||||
j = n - 1
|
||||
for i in range(n):
|
||||
xi, yi = poly[i]
|
||||
xj, yj = poly[j]
|
||||
if ((yi > py) != (yj > py)) and (
|
||||
px < (xj - xi) * (py - yi) / ((yj - yi) or 1e-12) + xi
|
||||
):
|
||||
inside = not inside
|
||||
j = i
|
||||
return inside
|
||||
|
||||
|
||||
def dist_point_to_seg(px, py, ax, ay, bx, by):
|
||||
vx = bx - ax
|
||||
vy = by - ay
|
||||
l2 = vx * vx + vy * vy
|
||||
if l2 <= 1e-12:
|
||||
return math.hypot(px - ax, py - ay)
|
||||
t = ((px - ax) * vx + (py - ay) * vy) / l2
|
||||
if t < 0.0:
|
||||
t = 0.0
|
||||
elif t > 1.0:
|
||||
t = 1.0
|
||||
dx = px - (ax + t * vx)
|
||||
dy = py - (ay + t * vy)
|
||||
return math.hypot(dx, dy)
|
||||
|
||||
|
||||
def dist_to_poly_edges(px, py, poly):
|
||||
best = 1e9
|
||||
n = len(poly)
|
||||
for i in range(n):
|
||||
ax, ay = poly[i]
|
||||
bx, by = poly[(i + 1) % n]
|
||||
d = dist_point_to_seg(px, py, ax, ay, bx, by)
|
||||
if d < best:
|
||||
best = d
|
||||
return best
|
||||
|
||||
|
||||
def signed_dist_polys(px, py, polys):
|
||||
"""Signed distance (<0 inside any polygon, >0 outside)."""
|
||||
best_abs = 1e9
|
||||
inside = False
|
||||
for poly in polys:
|
||||
if point_in_poly(px, py, poly):
|
||||
inside = True
|
||||
d = dist_to_poly_edges(px, py, poly)
|
||||
if d < best_abs:
|
||||
best_abs = d
|
||||
return -best_abs if inside else best_abs
|
||||
|
||||
|
||||
def signed_dist_capsules(px, py, capsules):
|
||||
"""Signed distance to union of rounded line segments (ax, ay, bx, by, r)."""
|
||||
best = 1e9
|
||||
for ax, ay, bx, by, r in capsules:
|
||||
d = dist_point_to_seg(px, py, ax, ay, bx, by) - r
|
||||
if d < best:
|
||||
best = d
|
||||
return best
|
||||
|
||||
|
||||
def blend_over(dst, src):
|
||||
sa, sr, sg, sb = src
|
||||
if sa <= 0.0:
|
||||
return dst
|
||||
da, dr, dg, db = dst
|
||||
inv = 1.0 - sa
|
||||
oa = sa + da * inv
|
||||
if oa <= 1e-9:
|
||||
return (0.0, 0.0, 0.0, 0.0)
|
||||
return (
|
||||
oa,
|
||||
sr * sa + dr * inv,
|
||||
sg * sa + dg * inv,
|
||||
sb * sa + db * inv,
|
||||
)
|
||||
|
||||
|
||||
def render_cursor(size, shape_fn, base_hot, outline_w=0.036, shadow_off=(0.024, 0.032)):
|
||||
"""Render an anti-aliased RGBA cursor canvas using 4x4 supersampling."""
|
||||
sub = 4
|
||||
inv_sub2 = 1.0 / (sub * sub)
|
||||
step = 1.0 / sub
|
||||
pixels = bytearray(size * size * 4)
|
||||
|
||||
for y in range(size):
|
||||
for x in range(size):
|
||||
sum_a = 0.0
|
||||
sum_r = 0.0
|
||||
sum_g = 0.0
|
||||
sum_b = 0.0
|
||||
|
||||
for sy in range(sub):
|
||||
ny = (y + (sy + 0.5) * step) / size
|
||||
for sx in range(sub):
|
||||
nx = (x + (sx + 0.5) * step) / size
|
||||
|
||||
sd = shape_fn(nx, ny)
|
||||
sh_sd = shape_fn(nx - shadow_off[0], ny - shadow_off[1])
|
||||
|
||||
col = (0.0, 0.0, 0.0, 0.0)
|
||||
# Subtle drop shadow
|
||||
if sh_sd < outline_w + 0.022:
|
||||
sh_cov = max(0.0, min(1.0, (outline_w + 0.016 - sh_sd) / 0.022))
|
||||
if sh_cov > 0.0:
|
||||
col = blend_over(col, (sh_cov * 0.32, 0.02, 0.03, 0.05))
|
||||
|
||||
# Dark outline
|
||||
aa = 1.1 / size
|
||||
out_cov = max(0.0, min(1.0, (outline_w + aa - sd) / (2.0 * aa)))
|
||||
if out_cov > 0.0:
|
||||
col = blend_over(col, (out_cov, 0.06, 0.08, 0.12))
|
||||
|
||||
# Crisp white fill
|
||||
fill_cov = max(0.0, min(1.0, (aa - sd) / (2.0 * aa)))
|
||||
if fill_cov > 0.0:
|
||||
col = blend_over(col, (fill_cov, 0.98, 0.99, 1.0))
|
||||
|
||||
sum_a += col[0]
|
||||
sum_r += col[1]
|
||||
sum_g += col[2]
|
||||
sum_b += col[3]
|
||||
|
||||
oa = max(0.0, min(1.0, sum_a * inv_sub2))
|
||||
r_p = max(0, min(255, int(round(sum_r * inv_sub2 * 255.0))))
|
||||
g_p = max(0, min(255, int(round(sum_g * inv_sub2 * 255.0))))
|
||||
b_p = max(0, min(255, int(round(sum_b * inv_sub2 * 255.0))))
|
||||
a_u = max(0, min(255, int(round(oa * 255.0))))
|
||||
if r_p > a_u:
|
||||
r_p = a_u
|
||||
if g_p > a_u:
|
||||
g_p = a_u
|
||||
if b_p > a_u:
|
||||
b_p = a_u
|
||||
argb = (a_u << 24) | (r_p << 16) | (g_p << 8) | b_p
|
||||
struct.pack_into("<I", pixels, (y * size + x) * 4, argb)
|
||||
|
||||
xhot = max(0, min(size - 1, int(round(base_hot[0] * size))))
|
||||
yhot = max(0, min(size - 1, int(round(base_hot[1] * size))))
|
||||
return (size, size, xhot, yhot, bytes(pixels))
|
||||
|
||||
|
||||
def shape_left_ptr(nx, ny):
|
||||
arrow = [
|
||||
(0.11, 0.08),
|
||||
(0.11, 0.80),
|
||||
(0.28, 0.64),
|
||||
(0.41, 0.90),
|
||||
(0.53, 0.84),
|
||||
(0.40, 0.59),
|
||||
(0.62, 0.59),
|
||||
]
|
||||
return signed_dist_polys(nx, ny, [arrow])
|
||||
|
||||
|
||||
def shape_xterm(nx, ny):
|
||||
caps = [
|
||||
(0.50, 0.14, 0.50, 0.86, 0.028),
|
||||
(0.35, 0.14, 0.65, 0.14, 0.025),
|
||||
(0.35, 0.86, 0.65, 0.86, 0.025),
|
||||
(0.41, 0.50, 0.59, 0.50, 0.020),
|
||||
]
|
||||
return signed_dist_capsules(nx, ny, caps)
|
||||
|
||||
|
||||
def shape_hand(nx, ny):
|
||||
# Clean stylized pointing hand silhouette
|
||||
hand_poly = [
|
||||
(0.33, 0.10),
|
||||
(0.43, 0.10),
|
||||
(0.45, 0.36),
|
||||
(0.70, 0.39),
|
||||
(0.75, 0.45),
|
||||
(0.75, 0.66),
|
||||
(0.67, 0.88),
|
||||
(0.31, 0.88),
|
||||
(0.20, 0.62),
|
||||
(0.23, 0.52),
|
||||
(0.33, 0.56),
|
||||
]
|
||||
sd_p = signed_dist_polys(nx, ny, [hand_poly])
|
||||
sd_tip = math.hypot(nx - 0.38, ny - 0.11) - 0.052
|
||||
return min(sd_p, sd_tip)
|
||||
|
||||
|
||||
def shape_fleur(nx, ny):
|
||||
caps = [
|
||||
(0.16, 0.50, 0.84, 0.50, 0.030),
|
||||
(0.50, 0.16, 0.50, 0.84, 0.030),
|
||||
]
|
||||
heads = [
|
||||
[(0.50, 0.07), (0.37, 0.23), (0.63, 0.23)],
|
||||
[(0.50, 0.93), (0.37, 0.77), (0.63, 0.77)],
|
||||
[(0.07, 0.50), (0.23, 0.37), (0.23, 0.63)],
|
||||
[(0.93, 0.50), (0.77, 0.37), (0.77, 0.63)],
|
||||
]
|
||||
return min(signed_dist_capsules(nx, ny, caps), signed_dist_polys(nx, ny, heads))
|
||||
|
||||
|
||||
def shape_sb_h(nx, ny):
|
||||
caps = [(0.16, 0.50, 0.84, 0.50, 0.032)]
|
||||
heads = [
|
||||
[(0.07, 0.50), (0.26, 0.34), (0.26, 0.66)],
|
||||
[(0.93, 0.50), (0.74, 0.34), (0.74, 0.66)],
|
||||
]
|
||||
return min(signed_dist_capsules(nx, ny, caps), signed_dist_polys(nx, ny, heads))
|
||||
|
||||
|
||||
def shape_sb_v(nx, ny):
|
||||
caps = [(0.50, 0.16, 0.50, 0.84, 0.032)]
|
||||
heads = [
|
||||
[(0.50, 0.07), (0.34, 0.26), (0.66, 0.26)],
|
||||
[(0.50, 0.93), (0.34, 0.74), (0.66, 0.74)],
|
||||
]
|
||||
return min(signed_dist_capsules(nx, ny, caps), signed_dist_polys(nx, ny, heads))
|
||||
|
||||
|
||||
def shape_bottom_right(nx, ny):
|
||||
caps = [
|
||||
(0.24, 0.24, 0.76, 0.76, 0.030),
|
||||
(0.78, 0.52, 0.78, 0.78, 0.034),
|
||||
(0.52, 0.78, 0.78, 0.78, 0.034),
|
||||
]
|
||||
head = [[(0.14, 0.14), (0.36, 0.18), (0.18, 0.36)]]
|
||||
return min(signed_dist_capsules(nx, ny, caps), signed_dist_polys(nx, ny, head))
|
||||
|
||||
|
||||
def shape_bottom_left(nx, ny):
|
||||
return shape_bottom_right(1.0 - nx, ny)
|
||||
|
||||
|
||||
def shape_crosshair(nx, ny):
|
||||
caps = [
|
||||
(0.14, 0.50, 0.38, 0.50, 0.026),
|
||||
(0.62, 0.50, 0.86, 0.50, 0.026),
|
||||
(0.50, 0.14, 0.50, 0.38, 0.026),
|
||||
(0.50, 0.62, 0.50, 0.86, 0.026),
|
||||
]
|
||||
dot = math.hypot(nx - 0.50, ny - 0.50) - 0.034
|
||||
return min(signed_dist_capsules(nx, ny, caps), dot)
|
||||
|
||||
|
||||
def shape_watch(nx, ny):
|
||||
ring = abs(math.hypot(nx - 0.50, ny - 0.50) - 0.28) - 0.042
|
||||
hands = signed_dist_capsules(
|
||||
nx,
|
||||
ny,
|
||||
[
|
||||
(0.50, 0.50, 0.50, 0.32, 0.026),
|
||||
(0.50, 0.50, 0.64, 0.54, 0.026),
|
||||
],
|
||||
)
|
||||
return min(ring, hands)
|
||||
|
||||
|
||||
def write_xcursor_file(path, frames):
|
||||
"""Write an Xcursor v1.0 multi-size binary file."""
|
||||
ntoc = len(frames)
|
||||
toc_offset = 16
|
||||
data_offset = toc_offset + ntoc * 12
|
||||
|
||||
tocs = []
|
||||
chunks = bytearray()
|
||||
cur_off = data_offset
|
||||
for nom_size, w, h, xhot, yhot, rgba_bytes in frames:
|
||||
tocs.append((XCURSOR_IMAGE_TYPE, nom_size, cur_off))
|
||||
hdr = struct.pack(
|
||||
"<IIIIIIIII",
|
||||
36,
|
||||
XCURSOR_IMAGE_TYPE,
|
||||
nom_size,
|
||||
XCURSOR_IMAGE_VERSION,
|
||||
w,
|
||||
h,
|
||||
xhot,
|
||||
yhot,
|
||||
0,
|
||||
)
|
||||
chunks.extend(hdr)
|
||||
chunks.extend(rgba_bytes)
|
||||
cur_off += len(hdr) + len(rgba_bytes)
|
||||
|
||||
out = bytearray(struct.pack("<4sIII", XCURSOR_MAGIC, 16, XCURSOR_VERSION, ntoc))
|
||||
for typ, sub, pos in tocs:
|
||||
out.extend(struct.pack("<III", typ, sub, pos))
|
||||
out.extend(chunks)
|
||||
|
||||
with open(path, "wb") as f:
|
||||
f.write(out)
|
||||
|
||||
|
||||
def main():
|
||||
out_dir = sys.argv[1] if len(sys.argv) > 1 else DEFAULT_OUT
|
||||
cur_dir = os.path.join(out_dir, "cursors")
|
||||
os.makedirs(cur_dir, exist_ok=True)
|
||||
|
||||
index_path = os.path.join(out_dir, "index.theme")
|
||||
with open(index_path, "w", encoding="utf-8") as f:
|
||||
f.write("[Icon Theme]\nName=Default\nComment=Geminux HiDPI X11 Cursor Theme\n")
|
||||
|
||||
specs = {
|
||||
"left_ptr": (
|
||||
shape_left_ptr,
|
||||
(0.11, 0.08),
|
||||
("default", "arrow", "top_left_arrow", "left_ptr_watch"),
|
||||
),
|
||||
"xterm": (
|
||||
shape_xterm,
|
||||
(0.50, 0.50),
|
||||
("ibeam", "text"),
|
||||
),
|
||||
"hand2": (
|
||||
shape_hand,
|
||||
(0.38, 0.11),
|
||||
("hand1", "pointer", "pointing_hand"),
|
||||
),
|
||||
"fleur": (
|
||||
shape_fleur,
|
||||
(0.50, 0.50),
|
||||
("move", "all-scroll", "grab", "grabbing"),
|
||||
),
|
||||
"sb_h_double_arrow": (
|
||||
shape_sb_h,
|
||||
(0.50, 0.50),
|
||||
("ew-resize", "h_double_arrow", "col-resize"),
|
||||
),
|
||||
"sb_v_double_arrow": (
|
||||
shape_sb_v,
|
||||
(0.50, 0.50),
|
||||
("ns-resize", "v_double_arrow", "row-resize"),
|
||||
),
|
||||
"bottom_right_corner": (
|
||||
shape_bottom_right,
|
||||
(0.78, 0.78),
|
||||
("se-resize", "nwse-resize", "top_left_corner", "sizing"),
|
||||
),
|
||||
"bottom_left_corner": (
|
||||
shape_bottom_left,
|
||||
(0.22, 0.78),
|
||||
("sw-resize", "nesw-resize", "top_right_corner"),
|
||||
),
|
||||
"crosshair": (
|
||||
shape_crosshair,
|
||||
(0.50, 0.50),
|
||||
("tcross", "cross"),
|
||||
),
|
||||
"watch": (
|
||||
shape_watch,
|
||||
(0.50, 0.50),
|
||||
("wait",),
|
||||
),
|
||||
}
|
||||
|
||||
for name, (fn, hot, aliases) in specs.items():
|
||||
frames = []
|
||||
for sz in SIZES:
|
||||
w, h, xhot, yhot, px = render_cursor(sz, fn, hot)
|
||||
frames.append((sz, w, h, xhot, yhot, px))
|
||||
target_path = os.path.join(cur_dir, name)
|
||||
write_xcursor_file(target_path, frames)
|
||||
for alias in aliases:
|
||||
ap = os.path.join(cur_dir, alias)
|
||||
if os.path.lexists(ap):
|
||||
os.unlink(ap)
|
||||
os.symlink(name, ap)
|
||||
|
||||
print(f"[PASS] Generated {len(specs)} multi-size HiDPI cursors ({SIZES}) in {cur_dir}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -19,6 +19,7 @@ curl
|
||||
dbus
|
||||
dbus-libs
|
||||
dbus-openrc
|
||||
dnsmasq
|
||||
doas
|
||||
dosfstools
|
||||
e2fsprogs
|
||||
|
||||
@@ -46,6 +46,8 @@ def main():
|
||||
vals = parse_xres(th)
|
||||
for req in REQUIRED_KEYS:
|
||||
assert req in vals and vals[req], f"Missing {req} in {os.path.basename(th)}"
|
||||
assert int(vals["Xft.dpi"]) >= 168, f"Expected Xft.dpi >= 168 in {os.path.basename(th)}"
|
||||
assert int(vals["theme.baseFontSize"]) >= 28, f"Expected baseFontSize >= 28 in {os.path.basename(th)}"
|
||||
assert "Fira Code" in vals["theme.fontFace"], f"Expected Fira Code in {os.path.basename(th)}"
|
||||
assert "Fira Code" in vals["st.font"], f"Expected Fira Code in st.font of {os.path.basename(th)}"
|
||||
assert "Fira Code" in vals["dmenu.font"], f"Expected Fira Code in dmenu.font of {os.path.basename(th)}"
|
||||
@@ -62,7 +64,7 @@ def main():
|
||||
assert vals["theme.bgMain"] in txt
|
||||
assert vals["theme.dangerBg"] in txt
|
||||
assert "font = Fira Code " in txt
|
||||
assert "width = 560" in txt
|
||||
assert "width = 720" in txt
|
||||
|
||||
print(f"[PASS] Verified {len(themes)} .xth themes and dunst synchronization")
|
||||
return 0
|
||||
|
||||
+14
-12
@@ -16,18 +16,19 @@ cat > /etc/apk/repositories <<EOF
|
||||
https://dl-cdn.alpinelinux.org/alpine/edge/main
|
||||
https://dl-cdn.alpinelinux.org/alpine/edge/community
|
||||
EOF
|
||||
apk add --no-cache xkbcomp setxkbmap xkeyboard-config >/dev/null
|
||||
apk add --no-cache xkbcomp setxkbmap xkeyboard-config xvfb >/dev/null
|
||||
cp -a /geminux-xkb/. /usr/share/X11/xkb/
|
||||
cat > /tmp/gemini.xkb <<'XKB'
|
||||
xkb_keymap {
|
||||
xkb_keycodes { include "evdev+aliases(qwerty)" };
|
||||
xkb_types { include "complete+geminux" };
|
||||
xkb_compat { include "complete" };
|
||||
xkb_symbols { include "pc+planet_vndr/geminux(us)+inet(evdev)" };
|
||||
xkb_geometry { include "pc(pc105)" };
|
||||
};
|
||||
XKB
|
||||
xkbcomp -w 3 -I/usr/share/X11/xkb /tmp/gemini.xkb /tmp/gemini.xkm
|
||||
Xvfb :99 -screen 0 640x480x24 >/dev/null 2>&1 &
|
||||
XPID=$!
|
||||
trap 'kill "$XPID" 2>/dev/null || true' EXIT
|
||||
i=0
|
||||
while [ "$i" -lt 20 ] && [ ! -S /tmp/.X11-unix/X99 ]; do
|
||||
i=$((i + 1))
|
||||
sleep 0.1
|
||||
done
|
||||
DISPLAY=:99 setxkbmap -rules evdev -model pc105 -layout 'planet_vndr/geminux' -variant us -option -option 'custom:types' -print > /tmp/gemini_rmlvo.xkb
|
||||
cat /tmp/gemini_rmlvo.xkb
|
||||
xkbcomp -w 3 -I/usr/share/X11/xkb /tmp/gemini_rmlvo.xkb /tmp/gemini.xkm
|
||||
xkbcomp /tmp/gemini.xkm /tmp/gemini_dump.xkb
|
||||
cat /tmp/gemini_dump.xkb
|
||||
"""
|
||||
@@ -45,7 +46,8 @@ cat /tmp/gemini_dump.xkb
|
||||
checks = [
|
||||
"F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10",
|
||||
"asciitilde", "EuroSign", "Super_L", "ISO_Level3_Shift", "Mod4", "Mod5",
|
||||
"GEMINUX_LALT", "GEMINUX_FN",
|
||||
"GEMINUX_LALT", "GEMINUX_FN", "SetMods(modifiers=Mod4)",
|
||||
'include "complete+custom"',
|
||||
]
|
||||
for token in checks:
|
||||
assert token in dump, f"Expected '{token}' in compiled XKB dump"
|
||||
|
||||
Reference in new issue
Block a user