Islet 0.7.6: a Dynamic Island for notched iPhones

SpringBoard tweak for the iPhone XR on iOS 18.7.1 (Dopamine rootless),
built without Theos using the swift.org clang and linked on the phone.

The island shows music with Apple's audio analyzer and live lyrics, timers,
calls, flashlight, screen recording, accessories and their batteries, calendar,
notifications with actions, and system popups, in portrait and landscape.
Includes a Settings page, a Watch ping hook, an offscreen self test and the
tools that capture the showcase video.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
astar76 2026-11-05 19:03:58 -06:00
commit c88455c759
7 changed files with 4824 additions and 0 deletions

24
tools/build-arch Executable file
View file

@ -0,0 +1,24 @@
#!/bin/bash
# build-arch <arch> <kind:dylib|mini|exe> <out> <srcs...> : compile locally (swift.org clang + iPhoneOS SDK), link with ld64 on the phone.
set -euo pipefail
arch=$1 kind=$2 out=$3; shift 3
SWIFT=${SWIFT:-$HOME/.local/opt/swift/usr/bin}
SDK=${SDK:-$HOME/.local/opt/dl/sdk18/iPhoneOS18.6.sdk}
PH=${IPHONE:[email protected]}; KEY=${IPHONE_KEY:-$HOME/.ssh/iphone_key}
RSDK=/var/mobile/mulberry-build/iPhoneOS18.6.sdk
S=(ssh -i "$KEY" -o BatchMode=yes -o ControlMaster=auto -o ControlPersist=60 -o ControlPath="$HOME/.ssh/cm-islet-%r@%h" "$PH")
tmp=$(mktemp -d); trap 'rm -rf "$tmp"' EXIT
objs=()
for s in "$@"; do
o=$tmp/$(basename "$s").o
"$SWIFT/clang" -target $arch-apple-ios15.0 -isysroot "$SDK" -fobjc-arc -fmodules -O2 -Wall -Wno-deprecated-declarations -Wno-arc-performSelector-leaks -Wno-unguarded-availability-new -Wno-format-security ${EXTRA_CFLAGS:-} -DISLET_VERSION="\"$(cat "$(dirname "$0")/../VERSION")\"" -c "$s" -o "$o"
objs+=("$o")
done
job=/var/mobile/islet-build/$$; "${S[@]}" "mkdir -p $job"
tar -cf - -C "$tmp" . | "${S[@]}" "tar -xf - -C $job"
extra=""; [ "$kind" = dylib ] && extra="-dylib -install_name @rpath/$(basename $out)"
libs="-framework Foundation -framework UIKit -framework QuartzCore -framework CoreGraphics -framework AVFoundation -framework MediaPlayer -framework Network"
[ "$kind" = mini ] && { extra="-dylib -install_name @rpath/$(basename $out)"; libs="-framework Foundation"; } # for daemons: no UIKit
"${S[@]}" "cd $job && ld64 -arch $arch -platform_version ios 15.0 18.6 -syslibroot $RSDK $extra *.o \
$libs -lobjc -lSystem -o out && ldid -S out" 1>&2
"${S[@]}" "cat $job/out; rm -rf $job" > "$out"; chmod +x "$out"

12
tools/fat.py Executable file
View file

@ -0,0 +1,12 @@
#!/usr/bin/env python3
# fat.py out in1 in2 ... : combine thin Mach-O files into a fat binary.
import struct, sys
out, ins = sys.argv[1], sys.argv[2:]
slices = []
for p in ins:
d = open(p, 'rb').read(); ct, cs = struct.unpack('<II', d[4:12]); slices.append((ct, cs, d))
hdr = 8 + 20 * len(slices); off = hdr; ents = b''; body = b''
for ct, cs, d in slices:
al = 14; off = (off + (1 << al) - 1) & ~((1 << al) - 1)
ents += struct.pack('>IIIII', ct, cs, off, len(d), al); body += b'\0' * (off - hdr - len(body)) + d; off += len(d)
open(out, 'wb').write(struct.pack('>II', 0xcafebabe, len(slices)) + ents + body)

13
tools/film Executable file
View file

@ -0,0 +1,13 @@
#!/bin/bash
# Captures the real island animations on the phone, in a throwaway process, to build/film. tools/film-edit.py makes the video.
# The film code is compiled in here only: packages never contain it. ISLET_FILM_SCENES=n stops after n scenes.
set -euo pipefail
cd "$(dirname "$0")/.."
KEY=${IPHONE_KEY:-$HOME/.ssh/iphone_key}; PH=${IPHONE:[email protected]}; T=/var/jb/var/mobile/t
EXTRA_CFLAGS=-DISLET_FILM tools/build-arch arm64e dylib build/Islet-film.dylib src/Islet.m </dev/null
tools/build-arch arm64e exe build/loadtest-e tests/loadtest.m </dev/null
ssh -i "$KEY" "$PH" "rm -rf $T/film; mkdir -p $T/film" </dev/null
scp -q -i "$KEY" build/Islet-film.dylib build/loadtest-e "$PH:$T/" </dev/null
ssh -i "$KEY" "$PH" "cd $T && ldid -S Islet-film.dylib && ISLET_FILM_SCENES=${ISLET_FILM_SCENES:-99} ISLET_FILM=$T/film ./loadtest-e ./Islet-film.dylib 200; ls film | wc -l" </dev/null
rm -rf build/film; mkdir -p build/film
ssh -i "$KEY" "$PH" "tar -cf - -C $T film; rm -rf $T/film" </dev/null | tar -xf - -C build

143
tools/film-edit.py Executable file
View file

@ -0,0 +1,143 @@
#!/usr/bin/env python3
# Turns the frames from tools/film into build/Islet-showcase.mp4: a phone mockup with a title for each scene.
import math, subprocess, sys
from PIL import Image, ImageDraw, ImageFont, ImageFilter, ImageChops
W, H, FPS = 1920, 1080, 30
FRAMES = 'build/film'
OUT = 'build/Islet-showcase.mp4'
FONT = '/usr/share/fonts/TTF/Roboto-%s.ttf'
SCREEN = (760, 1645) # the phone's screen in the video
INTRO, OUTRO = 2.2, 2.6
TINT = {'Battery': (48, 209, 88), 'Accessories': (10, 132, 255), 'Music': (255, 55, 130), 'Activities': (255, 159, 10), 'System': (175, 82, 222),
'Notifications': (64, 200, 224), 'Gestures': (255, 214, 10), 'Landscape': (255, 69, 58)}
def ease(x):
x = max(0, min(1, x)); return 1 - (1 - x) ** 3
def font(style, size): return ImageFont.truetype(FONT % style, size)
scenes, frames = [], []
for line in open(FRAMES + '/frames.txt', encoding='utf-8'):
p = line.split(' ', 3)
if p[0] == 'scene':
group, title = p[3].strip().split('|')
scenes.append(dict(t=float(p[1]), code=int(p[2]), group=group, title=title))
else:
frames.append((float(p[1]), int(p[2])))
end = frames[-1][0]
for i, s in enumerate(scenes): s['end'] = scenes[i + 1]['t'] if i + 1 < len(scenes) else end
def backdrop(c):
im = Image.new('RGB', (W // 8, H // 8), (9, 9, 12))
d = ImageDraw.Draw(im)
d.ellipse((W // 8 - 150, -70, W // 8 + 40, 120), fill=tuple(int(v * 0.36) for v in c))
return im.filter(ImageFilter.GaussianBlur(26)).resize((W, H), Image.BICUBIC)
def phone_parts():
bw, sw, sh = 26, *SCREEN
k = 2
outer = Image.new('RGBA', ((sw + bw * 2) * k, (sh + bw * 2) * k), (0, 0, 0, 0))
d = ImageDraw.Draw(outer)
d.rounded_rectangle((0, 0, outer.width - 1, outer.height - 1), radius=106 * k, fill=(52, 52, 58, 255))
d.rounded_rectangle((4 * k, 4 * k, outer.width - 1 - 4 * k, outer.height - 1 - 4 * k), radius=102 * k, fill=(10, 10, 12, 255))
outer = outer.resize((sw + bw * 2, sh + bw * 2), Image.LANCZOS)
mask = Image.new('L', (sw * k, sh * k), 0)
ImageDraw.Draw(mask).rounded_rectangle((0, 0, sw * k - 1, sh * k - 1), radius=80 * k, fill=255)
return outer, mask.resize((sw, sh), Image.LANCZOS), bw
BODY, MASK, BEZEL = phone_parts()
def caption(s, index, total):
c = TINT[s['group']]
im = Image.new('RGBA', (W, H), (0, 0, 0, 0))
d = ImageDraw.Draw(im)
if s['code'] in (114, 115):
d.text((110, 62), s['group'].upper(), font=font('Medium', 26), fill=c + (255,))
d.text((108, 96), s['title'], font=font('Bold', 72), fill=(255, 255, 255, 255))
else:
x = 960
d.text((x, 408), s['group'].upper(), font=font('Medium', 30), fill=c + (255,))
t, size = s['title'], 96
while font('Bold', size).getlength(t) > W - x - 90: size -= 4
d.text((x - 3, 452), t, font=font('Bold', size), fill=(255, 255, 255, 255))
d.text((x, 590), '%d of %d' % (index + 1, total), font=font('Regular', 26), fill=(255, 255, 255, 110))
return im
CAPTIONS = [caption(s, i, len(scenes)) for i, s in enumerate(scenes)]
BACK = {g: backdrop(c) for g, c in TINT.items()}
PLAIN = backdrop((90, 80, 200))
def angle_for(code): return 90 if code == 114 else -90 if code == 115 else 0
def frame_at(t):
lo, hi = 0, len(frames) - 1
while lo < hi:
mid = (lo + hi + 1) // 2
if frames[mid][0] <= t: lo = mid
else: hi = mid - 1
return Image.open('%s/f%05d.jpg' % (FRAMES, frames[lo][1])).convert('RGB')
def draw_phone(canvas, screen, angle, centre):
body = BODY.copy()
body.paste(screen.resize(SCREEN, Image.BILINEAR), (BEZEL, BEZEL), MASK)
if abs(angle) > 0.01: body = body.rotate(angle, resample=Image.BILINEAR, expand=True)
canvas.paste(body, (int(centre[0] - body.width / 2), int(centre[1] - body.height / 2)), body)
PORTRAIT = (500, 70 + BODY.height // 2)
LAND = (W // 2, 640)
def lerp(a, b, x): return (a[0] + (b[0] - a[0]) * x, a[1] + (b[1] - a[1]) * x)
def titled(lines, alpha):
im = PLAIN.copy()
layer = Image.new('RGBA', (W, H), (0, 0, 0, 0))
d = ImageDraw.Draw(layer)
for text, f, y, fill in lines:
d.text(((W - f.getlength(text)) / 2, y), text, font=f, fill=fill)
layer.putalpha(layer.getchannel('A').point(lambda v: int(v * alpha)))
im.paste(layer, (0, 0), layer)
return im
INTRO_LINES = [('Islet', font('Bold', 170), 380, (255, 255, 255, 255)), ('A Dynamic Island for notched iPhones', font('Light', 48), 590, (255, 255, 255, 200))]
OUTRO_LINES = [('Islet 0.7.6', font('Bold', 120), 370, (255, 255, 255, 255)), ('iPhone XR, iOS 18.7.1, Dopamine rootless', font('Light', 42), 530, (255, 255, 255, 200)),
('Real island code captured on the device. Mock wallpaper and demo content.', font('Regular', 28), 640, (255, 255, 255, 120))]
ff = subprocess.Popen(['ffmpeg', '-y', '-loglevel', 'error', '-f', 'rawvideo', '-pix_fmt', 'rgb24', '-s', '%dx%d' % (W, H), '-r', str(FPS), '-i', '-',
'-c:v', 'libx264', '-preset', 'medium', '-crf', '18', '-pix_fmt', 'yuv420p', '-movflags', '+faststart', OUT], stdin=subprocess.PIPE)
def emit(im): ff.stdin.write(im.tobytes())
for n in range(int(INTRO * FPS)):
t = n / FPS
emit(titled(INTRO_LINES, min(ease(t / 0.5), ease((INTRO - t) / 0.3))))
n, total = 0, int((end - scenes[0]['t']) * FPS)
prev_angle = 0
for i, s in enumerate(scenes):
a0, a1 = prev_angle, angle_for(s['code'])
frames_here = int((s['end'] - s['t']) * FPS)
for k in range(frames_here):
local = k / FPS
t = s['t'] + local
canvas = BACK[s['group']].copy()
x = ease(local / 0.42)
angle = a0 + (a1 - a0) * x
# the phone moves to the middle as it turns
turned = min(abs(angle) / 90, 1)
draw_phone(canvas, frame_at(t), angle, lerp(PORTRAIT, LAND, turned))
fade = ease(local / 0.22)
cap = CAPTIONS[i]
if fade < 1:
cap = cap.copy(); cap.putalpha(cap.getchannel('A').point(lambda v: int(v * fade)))
canvas.paste(cap, (0, int((1 - fade) * 18)), cap)
ImageDraw.Draw(canvas).rectangle((0, H - 6, int(W * (n / max(total, 1))), H), fill=TINT[s['group']])
emit(canvas)
n += 1
prev_angle = a1
print('\r%d/%d' % (n, total), end='', file=sys.stderr)
for k in range(int(OUTRO * FPS)):
t = k / FPS
emit(titled(OUTRO_LINES, min(ease(t / 0.5), ease((OUTRO - t) / 0.4))))
ff.stdin.close(); ff.wait()
print('\nwrote', OUT, file=sys.stderr)

29
tools/lint Executable file
View file

@ -0,0 +1,29 @@
#!/bin/bash
# Checks the rules that break arm64e at runtime and that the compiler can't see. See the notes at the top of src/Islet.m.
cd "$(dirname "$0")/.."
rc=0
fail() { echo "lint: $1"; rc=1; }
# bulk edits once turned @" inside strings into NS(" and left encodings and log formats garbled
grep -nE '%NS\(|"[^"]*NS\("[^"]*$' src/Islet.m src/IsletPrefs.m && fail 'garbled format string'
grep -n 'class_addMethod' src/Islet.m src/IsletPrefs.m | grep -vE '"[vB@Q][@:{}=dqCGPoint]*"' && fail 'garbled type encoding'
# @"..." literals and class definitions are only allowed in arm64 tools and tests
grep -nE '(^|[ (\[{,=])@"|^@implementation' src/Islet.m src/IsletPrefs.m | grep -v '^[^:]*:[0-9]*: *//' && fail 'static ObjC literal or class'
# every selector a gesture targets has to exist on the runtime class
for s in $(grep -oE 'action:@selector\([a-zA-Z]+:\)' src/Islet.m | sed 's/action:@selector(\(.*\))/\1/' | sort -u); do
grep -q "class_addMethod(c, @selector($s)" src/Islet.m || fail "gesture selector $s isn't registered"
done
# Reset to Recommended only means something if Settings shows the same defaults the tweak uses
python3 - <<'PY' || rc=1
import plistlib, re, sys
code = {}
for m in re.finditer(r'Pref(?:Bool|Num)\(NS\("(\w+)"\), ([^)]+?)\)', open('src/Islet.m').read()):
code.setdefault(m.group(1), set()).add(m.group(2))
bad = 0
for x in plistlib.load(open('pkg/prefs/Root.plist', 'rb'))['items']:
k = x.get('key')
if not k or k == 'notchWidth': continue # depends on the screen; Root.plist carries the XR's value
v = x.get('default'); v = 'YES' if v is True else 'NO' if v is False else str(v)
if code.get(k) != {v}: print('lint: default of', k, 'differs:', code.get(k), v); bad = 1
sys.exit(bad)
PY
exit $rc

36
tools/package.sh Executable file
View file

@ -0,0 +1,36 @@
#!/bin/bash
# Builds build/com.astar76.islet_<VERSION>_iphoneos-arm64.deb (rootless). Needs the phone for linking/signing.
set -euo pipefail
cd "$(dirname "$0")/.."
tools/lint
V=${VERSION_OVERRIDE:-$(cat VERSION)}; D=build/deb; KEY=${IPHONE_KEY:-$HOME/.ssh/iphone_key}; PH=${IPHONE:-mobile@192.168.1.94}
L=$D/var/jb/Library/MobileSubstrate/DynamicLibraries; B=$D/var/jb/Library/PreferenceBundles/IsletPrefs.bundle; E=$D/var/jb/Library/PreferenceLoader/Preferences
rm -rf $D; mkdir -p $D/DEBIAN $L $B $E $D/var/jb/usr/bin
for a in arm64 arm64e; do
tools/build-arch $a dylib build/Islet-$a.dylib src/Islet.m
tools/build-arch $a dylib build/IsletPrefs-$a src/IsletPrefs.m
tools/build-arch $a mini build/IsletPing-$a.dylib src/IsletPing.m
done
tools/build-arch arm64 exe build/isletctl src/isletctl.m
python3 tools/fat.py $L/Islet.dylib build/Islet-arm64.dylib build/Islet-arm64e.dylib
python3 tools/fat.py $B/IsletPrefs build/IsletPrefs-arm64 build/IsletPrefs-arm64e
python3 tools/fat.py $L/IsletPing.dylib build/IsletPing-arm64.dylib build/IsletPing-arm64e.dylib
# re-sign the fat binaries on the phone (ldid there)
for f in $L/Islet.dylib $L/IsletPing.dylib $B/IsletPrefs; do
scp -q -i "$KEY" $f $PH:/var/mobile/.islet-sign && ssh -i "$KEY" $PH 'ldid -S /var/mobile/.islet-sign'
scp -q -i "$KEY" $PH:/var/mobile/.islet-sign $f; ssh -i "$KEY" $PH 'rm /var/mobile/.islet-sign'
done
chmod 755 $B/IsletPrefs
cp build/isletctl $D/var/jb/usr/bin/isletctl
cp ${PLIST:-pkg/Islet.plist} $L/Islet.plist
cp pkg/IsletPing.plist $L/IsletPing.plist
cp pkg/prefs/Root.plist pkg/prefs/Info.plist pkg/prefs/[email protected] pkg/prefs/[email protected] $B/
cp pkg/prefs/entry.plist $E/IsletPrefs.plist
sed "s/@VERSION@/$V/" pkg/control > $D/DEBIAN/control
install -m755 pkg/postinst $D/DEBIAN/postinst; install -m755 pkg/postrm $D/DEBIAN/postrm
tar --owner=0 --group=0 -czf build/control.tar.gz -C $D/DEBIAN .
tar --owner=0 --group=0 -cJf build/data.tar.xz -C $D var
echo 2.0 > build/debian-binary
OUT=build/com.astar76.islet_${V}_iphoneos-arm64.deb; rm -f $OUT
(cd build && ar rc ../$OUT debian-binary control.tar.gz data.tar.xz)
ls -la $OUT

13
tools/selftest Executable file
View file

@ -0,0 +1,13 @@
#!/bin/bash
# Renders every island state offscreen on the phone (a throwaway process, never SpringBoard) and pulls the result to
# build/selftest. Needs tools/package.sh to have built build/Islet-arm64e.dylib.
set -euo pipefail
cd "$(dirname "$0")/.."
KEY=${IPHONE_KEY:-$HOME/.ssh/iphone_key}; PH=${IPHONE:[email protected]}
SWIFT=${SWIFT:-$HOME/.local/opt/swift/usr/bin}
tools/build-arch arm64e exe build/loadtest-e tests/loadtest.m
ssh -i "$KEY" "$PH" 'rm -rf /var/jb/var/mobile/t/selftest; mkdir -p /var/jb/var/mobile/t/selftest'
scp -q -i "$KEY" build/Islet-arm64e.dylib build/loadtest-e "$PH:/var/jb/var/mobile/t/"
ssh -i "$KEY" "$PH" 'cd /var/jb/var/mobile/t && ldid -S Islet-arm64e.dylib && ISLET_SELFTEST=/var/jb/var/mobile/t/selftest ./loadtest-e ./Islet-arm64e.dylib 90'
rm -rf build/selftest; scp -rq -i "$KEY" "$PH:/var/jb/var/mobile/t/selftest" build/selftest
cat build/selftest/status.txt