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
30 changed files with 4824 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
build/

65
README.md Normal file
View file

@ -0,0 +1,65 @@
# Islet
Dynamic Island for notched iPhones (built for iPhone XR, iOS 18.7.1, Dopamine rootless). SpringBoard tweak in
Objective-C, no Theos: compiled with the swift.org clang + iPhoneOS 18.6 SDK, linked and signed on the phone.
## What it shows
- **Ongoing:** now playing (artwork, bars driven only by Apple's audio analyzer, controls, lyrics; stays 10 s after pausing), timers (pause, resume, cancel),
calls (answer, decline, mute, end), flashlight with level buttons, screen recording with a stop button, hotspot, screen
mirroring, microphone, upcoming calendar events and reminders.
- **Notifications:** open in the island with the icon, text, photo and action buttons of the stock banner. Hold one for
the stock expanded view with reply. Sticky and critical alerts, and anything arriving while the island is hidden, keep
the stock banner. Other stock banners start below the island.
- **Accessories:** AirPods and other Bluetooth devices connect with their own icon and battery rings (buds, case), and
connected headphones sit in a bubble left of the island. Each device, and each part of it, alerts on its own at 20 and
10%. Apple Watch and AirPods get charging and fully charged popups, the Watch its Low Power Mode too.
- **iPhone battery:** charging, low battery at 20/10/5%, fully charged, Low Power Mode.
- **Short popups:** volume (replaces the stock HUD), silent switch with the swinging bell, Focus (replaces the stock
banner), airplane mode, Wi-Fi, cellular data and Bluetooth toggles, rotation lock, AirDrop visibility, network changes,
an app starting on the camera or microphone, lock and unlock (off by default). Popups dismiss themselves.
## Gestures
| Gesture | Compact | Unfolded | Popup |
| --- | --- | --- | --- |
| Tap | unfold | open the app, fold | open the app or notification |
| Swipe up | hide for 10 s | fold | dismiss |
| Swipe down | unfold | | |
| Swipe sideways | next activity | next activity | |
| Long press | open the app | open the app | stock expanded notification, or open the app |
A touch outside an unfolded card folds it, and cards fold themselves after 8 s. With two activities, the second sits in
a small bubble on the right: tap it to swap. Tap the headphones bubble on the left for their batteries. While hidden only
calls and critical battery popups come through. In landscape the same tab stays along the notch with its contents upright: swipe
into the notch to hide, away from it to unfold, along it to switch. An option hides the island during full-screen video. The media card's devices button opens the stock output picker.
## Settings
Settings > Islet writes `/var/jb/var/mobile/Library/Preferences/com.astar76.islet.plist` and everything applies live.
`isletctl set <key> <value>` does the same from a shell. Switches: enabled, music, musicPeek, realVisualizer, timer,
calls, flashlight, flashlightPeek, recording, calendar, reminders, bluetooth, hideAccessoryBanners, deviceBattery,
audioBubble, lowBattery, charging, lowPowerMode, ringer, volumeHUD, airplane, focus, network, rotationLock, airdrop,
systemActivities, sensorPill, lockPill, hideStockHUD, hideStatusPills, bannerOffset, notifications, hideBanners, bubble,
lyrics, onlineLyrics, neteaseLyrics, watchPing, hideLandscape, hideFullscreenVideo. Numbers: hideSeconds, autoFold, deviceLowLevel, musicLinger, calendarLead, notchWidth, notchHeight, compactExtra. `lyricApps` (array of bundle ids) adds players to lyric detection. `blockedBanners` (array of bundle ids) overrides which requesters' stock banners are dropped.
## Build and test
- `tools/package.sh` builds `build/com.astar76.islet_<VERSION>_iphoneos-arm64.deb`. It runs `tools/lint` first, which
catches the arm64e rule breaks the compiler can't see.
- `tools/selftest` renders every island state offscreen on the phone in a throwaway process, never SpringBoard, runs
the behaviour checks and pulls PNGs and `status.txt` to `build/selftest`.
- `tests/prefstest.m` drives the Settings controller the same way, `tests/loadtest.m` only loads the dylib.
- `tools/film` then `tools/film-edit.py` capture the real animations on the phone in a throwaway process and edit `build/Islet-showcase.mp4`. The film code is compiled in only there, never into a package.
- `isletctl demo <1-36>` triggers any activity on a running island (list in `src/isletctl.m`), `isletctl snap` writes
`/var/jb/var/mobile/islet-snap.png`.
- `isletctl dump` writes `/var/jb/var/mobile/islet-dump.txt` (windows, which hooks installed, state) and
`/var/mobile/islet-batteries.txt`. Each new banner requester is noted in `/var/mobile/islet-banners.log`.
Everything Islet changes lives in memory inside SpringBoard and one daemon: it writes nothing into iOS's own settings, so a
reboot without the jailbreak is plain stock. Switching it off in Settings stands down at once, and while the island is
hidden or stepped aside iOS's own banners, Focus, silent switch and volume indicators show instead. Settings > Islet >
Reset to Recommended Settings (or `isletctl defaults`) puts every setting back.
Two SpringBoard crashes in a row within 30 s of starting turn Islet off until Settings > Islet > Clear Crash Guard,
`isletctl reset` or a reinstall.

1
VERSION Normal file
View file

@ -0,0 +1 @@
0.7.6

3
pkg/Islet-test.plist Normal file
View file

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict><key>Filter</key><dict><key>Bundles</key><array><string>com.apple.Preferences</string></array></dict></dict></plist>

3
pkg/Islet.plist Normal file
View file

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict><key>Filter</key><dict><key>Bundles</key><array><string>com.apple.springboard</string></array></dict></dict></plist>

3
pkg/IsletPing.plist Normal file
View file

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict><key>Filter</key><dict><key>Executables</key><array><string>companionfindlocallyd</string></array></dict></dict></plist>

9
pkg/control Normal file
View file

@ -0,0 +1,9 @@
Package: com.astar76.islet
Name: Islet
Version: @VERSION@
Architecture: iphoneos-arm64
Description: Dynamic Island for notched iPhones: music, timers, calls, AirPods and Watch battery, calendar and system popups.
Maintainer: astar76
Author: astar76
Section: Tweaks
Depends: firmware (>= 15.0), mobilesubstrate, preferenceloader

7
pkg/postinst Normal file
View file

@ -0,0 +1,7 @@
#!/bin/sh
export PATH=/var/jb/usr/bin:/var/jb/bin:/usr/bin:/bin
rm -f /var/jb/var/mobile/Library/Preferences/com.astar76.islet.bootguard
# The Watch ping hook loads into this daemon, which launchd restarts on demand. It ignores SIGTERM, and killall can't name
# it: that matches the kernel's 16-character process name, and this one is longer.
for p in $(ps -Ao pid,comm | grep companionfindlocallyd | awk '{print $1}'); do kill -9 "$p"; done
exit 0

11
pkg/postrm Normal file
View file

@ -0,0 +1,11 @@
#!/bin/sh
export PATH=/var/jb/usr/bin:/var/jb/bin:/usr/bin:/bin
case "$1" in remove|purge)
# the ping hook lives in this daemon until it restarts
for p in $(ps -Ao pid,comm | grep companionfindlocallyd | awk '{print $1}'); do kill -9 "$p"; done
rm -f /var/mobile/islet-banners.log /var/mobile/islet-batteries.txt /var/jb/var/mobile/islet-dump.txt /var/jb/var/mobile/islet-snap.png
rm -f /var/jb/var/mobile/Library/Preferences/com.astar76.islet.bootguard
;;
esac
[ "$1" = purge ] && rm -f /var/jb/var/mobile/Library/Preferences/com.astar76.islet.plist
exit 0

24
pkg/prefs/Info.plist Normal file
View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>IsletPrefs</string>
<key>CFBundleIdentifier</key>
<string>com.astar76.islet.prefs</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>IsletPrefs</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>MinimumOSVersion</key>
<string>15.0</string>
<key>NSPrincipalClass</key>
<string>IsletRootListController</string>
</dict>
</plist>

695
pkg/prefs/Root.plist Normal file
View file

@ -0,0 +1,695 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>footerText</key>
<string>Switching Islet off hands everything back to iOS at once, and on again brings it back. All settings apply live.</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>enabled</string>
<key>label</key>
<string>Enabled</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>footerText</key>
<string>Lyrics appear for music players, not video apps. Tracks in the Music app use timed embedded tags first. Online lookups send the song title and artist to lrclib.net, then NetEase if it has nothing.</string>
<key>label</key>
<string>Activities</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>music</string>
<key>label</key>
<string>Now Playing</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>musicPeek</string>
<key>label</key>
<string>Show New Tracks</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>realVisualizer</string>
<key>label</key>
<string>Live Audio Bars</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>lyrics</string>
<key>label</key>
<string>Lyrics Button</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>onlineLyrics</string>
<key>label</key>
<string>Find Lyrics Online</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>neteaseLyrics</string>
<key>label</key>
<string>NetEase Backup</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>timer</string>
<key>label</key>
<string>Timers</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>calls</string>
<key>label</key>
<string>Calls</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>flashlight</string>
<key>label</key>
<string>Flashlight</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>flashlightPeek</string>
<key>label</key>
<string>Unfold Flashlight Controls</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>recording</string>
<key>label</key>
<string>Screen Recording</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>calendar</string>
<key>label</key>
<string>Calendar Events</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>reminders</string>
<key>label</key>
<string>Reminders</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>footerText</key>
<string>Battery popups go away on their own. The stock AirPods pill is replaced by the island while this is on.</string>
<key>label</key>
<string>Accessories &amp; Battery</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>bluetooth</string>
<key>label</key>
<string>Device Connections</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>hideAccessoryBanners</string>
<key>label</key>
<string>Hide Stock AirPods Pill</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>deviceBattery</string>
<key>label</key>
<string>AirPods &amp; Watch Battery</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>watchPing</string>
<key>label</key>
<string>Watch Ping</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>audioBubble</string>
<key>label</key>
<string>Headphones Beside Island</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>lowBattery</string>
<key>label</key>
<string>iPhone Low Battery</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>charging</string>
<key>label</key>
<string>Charging</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>lowPowerMode</string>
<key>label</key>
<string>Low Power Mode</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>System Popups</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>ringer</string>
<key>label</key>
<string>Silent Switch</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>volumeHUD</string>
<key>label</key>
<string>Volume</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>airplane</string>
<key>label</key>
<string>Airplane Mode</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>focus</string>
<key>label</key>
<string>Focus</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>network</string>
<key>label</key>
<string>Wi‑Fi / Cellular Changes</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>rotationLock</string>
<key>label</key>
<string>Rotation Lock</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>airdrop</string>
<key>label</key>
<string>AirDrop</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>systemActivities</string>
<key>label</key>
<string>Hotspot, Mirroring, Microphone</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>sensorPill</string>
<key>label</key>
<string>Camera &amp; Microphone Use</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<false/>
<key>key</key>
<string>lockPill</string>
<key>label</key>
<string>Lock &amp; Unlock (Face ID)</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Stock Interface</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>hideStockHUD</string>
<key>label</key>
<string>Hide Stock Silent HUD</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>hideStatusPills</string>
<key>label</key>
<string>Hide Coloured Clock Pills</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>bannerOffset</string>
<key>label</key>
<string>Keep Banners Below Island</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>footerText</key>
<string>Notifications open in the island. Hold one for the full stock view with reply. Sticky alerts, critical alerts and anything arriving while the island is hidden keep the stock banner.</string>
<key>label</key>
<string>Notifications</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>notifications</string>
<key>label</key>
<string>Show Notifications in Island</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>hideBanners</string>
<key>label</key>
<string>Replace Stock Banners</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>footerText</key>
<string>Tap unfolds, swipe up hides the compact island, swipe sideways switches activity, long press opens the app or the full notification. Full-screen video counts as a landscape app that also owns Now Playing; calls still come through.</string>
<key>label</key>
<string>Behaviour</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>key</key>
<string>bubble</string>
<key>label</key>
<string>Second Activity Bubble</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<false/>
<key>key</key>
<string>hideLandscape</string>
<key>label</key>
<string>Hide in Landscape</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<false/>
<key>key</key>
<string>hideFullscreenVideo</string>
<key>label</key>
<string>Hide During Full-Screen Video</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Hide After Swipe Up (seconds)</string>
</dict>
<dict>
<key>cell</key>
<string>PSSliderCell</string>
<key>default</key>
<integer>10</integer>
<key>key</key>
<string>hideSeconds</string>
<key>max</key>
<integer>60</integer>
<key>min</key>
<integer>5</integer>
<key>showValue</key>
<true/>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>footerText</key>
<string>0 keeps cards open until you fold them.</string>
<key>label</key>
<string>Fold Unfolded Cards After (seconds)</string>
</dict>
<dict>
<key>cell</key>
<string>PSSliderCell</string>
<key>default</key>
<integer>8</integer>
<key>key</key>
<string>autoFold</string>
<key>max</key>
<integer>30</integer>
<key>min</key>
<integer>0</integer>
<key>showValue</key>
<true/>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>footerText</key>
<string>Each device and each part of it alerts on its own, once on the way down, and again at 10%.</string>
<key>label</key>
<string>Accessory Low Battery (percent)</string>
</dict>
<dict>
<key>cell</key>
<string>PSSliderCell</string>
<key>default</key>
<integer>20</integer>
<key>key</key>
<string>deviceLowLevel</string>
<key>max</key>
<integer>50</integer>
<key>min</key>
<integer>10</integer>
<key>showValue</key>
<true/>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Keep Paused Music For (seconds)</string>
</dict>
<dict>
<key>cell</key>
<string>PSSliderCell</string>
<key>default</key>
<integer>10</integer>
<key>key</key>
<string>musicLinger</string>
<key>max</key>
<integer>60</integer>
<key>min</key>
<integer>0</integer>
<key>showValue</key>
<true/>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Show Events Ahead (minutes)</string>
</dict>
<dict>
<key>cell</key>
<string>PSSliderCell</string>
<key>default</key>
<integer>15</integer>
<key>key</key>
<string>calendarLead</string>
<key>max</key>
<integer>60</integer>
<key>min</key>
<integer>5</integer>
<key>showValue</key>
<true/>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Notch Width</string>
</dict>
<dict>
<key>cell</key>
<string>PSSliderCell</string>
<key>default</key>
<integer>214</integer>
<key>key</key>
<string>notchWidth</string>
<key>max</key>
<integer>250</integer>
<key>min</key>
<integer>180</integer>
<key>showValue</key>
<true/>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Notch Height</string>
</dict>
<dict>
<key>cell</key>
<string>PSSliderCell</string>
<key>default</key>
<integer>30</integer>
<key>key</key>
<string>notchHeight</string>
<key>max</key>
<integer>40</integer>
<key>min</key>
<integer>24</integer>
<key>showValue</key>
<true/>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Extra Tab Width</string>
</dict>
<dict>
<key>cell</key>
<string>PSSliderCell</string>
<key>default</key>
<integer>16</integer>
<key>key</key>
<string>compactExtra</string>
<key>max</key>
<integer>60</integer>
<key>min</key>
<integer>0</integer>
<key>showValue</key>
<true/>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Preview</string>
</dict>
<dict>
<key>action</key>
<string>preview:</string>
<key>cell</key>
<string>PSButtonCell</string>
<key>demo</key>
<integer>19</integer>
<key>label</key>
<string>AirPods</string>
</dict>
<dict>
<key>action</key>
<string>preview:</string>
<key>cell</key>
<string>PSButtonCell</string>
<key>demo</key>
<integer>20</integer>
<key>label</key>
<string>Apple Watch Low Battery</string>
</dict>
<dict>
<key>action</key>
<string>preview:</string>
<key>cell</key>
<string>PSButtonCell</string>
<key>demo</key>
<integer>21</integer>
<key>label</key>
<string>iPhone Low Battery</string>
</dict>
<dict>
<key>action</key>
<string>preview:</string>
<key>cell</key>
<string>PSButtonCell</string>
<key>demo</key>
<integer>24</integer>
<key>label</key>
<string>Hide for a While</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>footerText</key>
<string>Reset puts every switch and slider back to the recommended setting. If SpringBoard crashed twice in a row, Islet turns itself off: Clear Crash Guard undoes that, then respring.</string>
<key>label</key>
<string>Recovery</string>
</dict>
<dict>
<key>action</key>
<string>resetSettings:</string>
<key>cell</key>
<string>PSButtonCell</string>
<key>label</key>
<string>Reset to Recommended Settings</string>
</dict>
<dict>
<key>action</key>
<string>resetGuard:</string>
<key>cell</key>
<string>PSButtonCell</string>
<key>label</key>
<string>Clear Crash Guard</string>
</dict>
</array>
<key>title</key>
<string>Islet</string>
</dict>
</plist>

21
pkg/prefs/entry.plist Normal file
View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>entry</key>
<dict>
<key>bundle</key>
<string>IsletPrefs</string>
<key>cell</key>
<string>PSLinkCell</string>
<key>detail</key>
<string>IsletRootListController</string>
<key>icon</key>
<string>icon.png</string>
<key>isController</key>
<true/>
<key>label</key>
<string>Islet</string>
</dict>
</dict>
</plist>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

3417
src/Islet.m Normal file

File diff suppressed because it is too large Load diff

55
src/IsletPing.m Normal file
View file

@ -0,0 +1,55 @@
// Loaded only into companionfindlocallyd, the daemon that plays the sound when an Apple Watch pings this iPhone. SpringBoard
// never hears about a ping, so this tells the island. Foundation only, and it must stay that small: a daemon has no UIKit.
#import <objc/runtime.h>
#import <notify.h>
#import <mach-o/dyld.h>
#import "common.h"
#define PING_NOTIFICATION "com.astar76.islet.ping"
#define MAX_HOOKS 12
static struct { Method method; IMP orig; } gHooks[MAX_HOOKS];
static int gHookCount, gHooksToken, gFiredToken;
static uint64_t gFired;
// The handlers take one pointer-sized argument or none, so passing two registers through suits all of them.
static void *ping_hook(id self, SEL _cmd, void *a, void *b) {
notify_set_state(gFiredToken, ++gFired);
notify_post(PING_NOTIFICATION);
Method m = class_getInstanceMethod(object_getClass(self), _cmd);
for (int i = 0; i < gHookCount; i++)
if (gHooks[i].method == m) return ((void *(*)(id, SEL, void *, void *))gHooks[i].orig)(self, _cmd, a, b);
return NULL;
}
static void HookClass(Class cls) {
static const char *wanted[] = {"playSound:", "playSoundAndFlash:", "playFindLocallySound", "playNearbySound", "flashLights"};
unsigned n = 0;
Method *list = class_copyMethodList(cls, &n);
for (unsigned i = 0; i < n && gHookCount < MAX_HOOKS; i++)
for (int w = 0; w < 5; w++) {
if (strcmp(sel_getName(method_getName(list[i])), wanted[w])) continue;
gHooks[gHookCount].method = list[i];
gHooks[gHookCount].orig = method_setImplementation(list[i], (IMP)ping_hook);
gHookCount++;
}
free(list);
}
// Every class of this executable, found by path: at load time the image index isn't reliably the main program. The count
// goes out over notify state, 1 meaning loaded and each hook adding one, so `isletctl dump` can show what happened in here.
__attribute__((constructor)) static void islet_ping_init(void) {
notify_register_check("com.astar76.islet.ping.hooks", &gHooksToken);
notify_register_check("com.astar76.islet.ping.fired", &gFiredToken);
notify_set_state(gHooksToken, 1);
char path[1024]; uint32_t size = sizeof(path);
if (_NSGetExecutablePath(path, &size)) return;
unsigned count = 0;
const char **names = objc_copyClassNamesForImage(path, &count);
for (unsigned c = 0; names && c < count; c++) {
Class cls = objc_getClass(names[c]);
if (cls) HookClass(cls);
}
free(names);
notify_set_state(gHooksToken, 1 + gHookCount);
}

87
src/IsletPrefs.m Normal file
View file

@ -0,0 +1,87 @@
// Islet's page in the Settings app. A PreferenceLoader bundle whose list controller, like everything else built with
// this clang, is created at runtime (see the notes at the top of Islet.m). Crashes here only take down Settings.
#import <UIKit/UIKit.h>
#import <objc/runtime.h>
#import <objc/message.h>
#import <dlfcn.h>
#import <notify.h>
#import "common.h"
#define BUNDLE_PATH (getenv("ISLET_PREFS_BUNDLE") ? NS(getenv("ISLET_PREFS_BUNDLE")) : NS("/var/jb/Library/PreferenceBundles/IsletPrefs.bundle"))
static id SpecProp(id spec, const char *key) {
return ((id (*)(id, SEL, id))objc_msgSend)(spec, NSSelectorFromString(NS("propertyForKey:")), NS(key));
}
static NSString *PrefsPath(void) { return getenv("ISLET_PREFS_FILE") ? NS(getenv("ISLET_PREFS_FILE")) : PREFS_PATH; }
// PSListController finds its plist through +bundleForClass:, which knows nothing about a class made at runtime.
static id lc_bundle(id self, SEL _cmd) { return [NSBundle bundleWithPath:BUNDLE_PATH]; }
static id lc_specifiers(id self, SEL _cmd) {
Ivar iv = class_getInstanceVariable(object_getClass(self), "_specifiers");
id cur = iv ? object_getIvar(self, iv) : nil;
if (cur) return cur;
cur = ((id (*)(id, SEL, id, id))objc_msgSend)(self, NSSelectorFromString(NS("loadSpecifiersFromPlistName:target:")), NS("Root"), self);
if (iv) object_setIvarWithStrongDefault(self, iv, cur);
return cur;
}
static id lc_read(id self, SEL _cmd, id spec) {
id v = [NSDictionary dictionaryWithContentsOfFile:PrefsPath()][SpecProp(spec, "key")];
return v ?: SpecProp(spec, "default");
}
static void lc_write(id self, SEL _cmd, id value, id spec) {
NSMutableDictionary *d = [NSMutableDictionary dictionaryWithContentsOfFile:PrefsPath()] ?: [NSMutableDictionary new];
d[SpecProp(spec, "key")] = value;
if (![d writeToFile:PrefsPath() atomically:YES]) NSLog(NS("[Islet] can't write prefs"));
notify_post(PREFS_NOTIFICATION);
}
static void lc_preview(id self, SEL _cmd, id spec) {
int t = 0;
notify_register_check("com.astar76.islet.demo", &t);
notify_set_state(t, [SpecProp(spec, "demo") intValue]);
notify_post("com.astar76.islet.demo");
notify_cancel(t);
}
static void lc_resetGuard(id self, SEL _cmd, id spec) {
[NSFileManager.defaultManager removeItemAtPath:GUARD_PATH error:nil];
}
// Everything back to recommended: with no plist, every setting falls to the defaults in the tweak and in Root.plist, which
// tools/lint keeps equal. The crash guard is its own button and stays as it is.
static void lc_resetNow(id self, SEL _cmd) {
[NSFileManager.defaultManager removeItemAtPath:PrefsPath() error:nil];
notify_post(PREFS_NOTIFICATION);
((void (*)(id, SEL))objc_msgSend)(self, NSSelectorFromString(NS("reloadSpecifiers")));
}
static void lc_resetSettings(id self, SEL _cmd, id spec) {
int _islet_z = 0; (void)_islet_z;
UIAlertController *a = [UIAlertController alertControllerWithTitle:NS("Reset All Settings?") message:NS("Every switch and slider goes back to the recommended setting.") preferredStyle:UIAlertControllerStyleAlert];
[a addAction:[UIAlertAction actionWithTitle:NS("Cancel") style:UIAlertActionStyleCancel handler:nil]];
[a addAction:[UIAlertAction actionWithTitle:NS("Reset") style:UIAlertActionStyleDestructive handler:HB(^(UIAlertAction *x) { (void)_islet_z;
((void (*)(id, SEL))objc_msgSend)(self, NSSelectorFromString(NS("resetNow")));
})]];
[(UIViewController *)self presentViewController:a animated:YES completion:nil];
}
__attribute__((constructor)) static void islet_prefs_init(void) {
dlopen("/System/Library/PrivateFrameworks/Preferences.framework/Preferences", RTLD_NOW);
Class super_ = NSClassFromString(NS("PSListController"));
if (!super_ || objc_getClass("IsletRootListController")) return;
Class c = objc_allocateClassPair(super_, "IsletRootListController", 0);
if (!c) return;
class_addMethod(c, NSSelectorFromString(NS("bundle")), (IMP)lc_bundle, "@@:");
class_addMethod(c, NSSelectorFromString(NS("specifiers")), (IMP)lc_specifiers, "@@:");
class_addMethod(c, NSSelectorFromString(NS("readPreferenceValue:")), (IMP)lc_read, "@@:@");
class_addMethod(c, NSSelectorFromString(NS("setPreferenceValue:specifier:")), (IMP)lc_write, "v@:@@");
class_addMethod(c, NSSelectorFromString(NS("preview:")), (IMP)lc_preview, "v@:@");
class_addMethod(c, NSSelectorFromString(NS("resetGuard:")), (IMP)lc_resetGuard, "v@:@");
class_addMethod(c, NSSelectorFromString(NS("resetSettings:")), (IMP)lc_resetSettings, "v@:@");
class_addMethod(c, NSSelectorFromString(NS("resetNow")), (IMP)lc_resetNow, "v@:");
objc_registerClassPair(c);
}

16
src/common.h Normal file
View file

@ -0,0 +1,16 @@
// Shared by the tweak, the Settings bundle and isletctl.
#pragma once
#import <Foundation/Foundation.h>
#include <Block.h>
// String literals (@"...") are constant CFStrings whose isa the arm64e runtime rejects when built with this clang:
// build every string at runtime instead.
static inline NSString *NS(const char *c) { return [NSString stringWithUTF8String:c]; }
// Blocks built by this clang carry an unsigned isa on arm64e; callees that msgSend them (MediaRemote, UIKit) trap.
// A heap copy made by the runtime has a properly signed isa, so every block handed out goes through HB().
#define HB(...) ((__typeof__(__VA_ARGS__))CFBridgingRelease(_Block_copy((__bridge const void *)(__VA_ARGS__))))
#define PREFS_PATH NS("/var/jb/var/mobile/Library/Preferences/com.astar76.islet.plist")
#define GUARD_PATH NS("/var/jb/var/mobile/Library/Preferences/com.astar76.islet.bootguard")
#define PREFS_NOTIFICATION "com.astar76.islet.prefs"

38
src/isletctl.m Normal file
View file

@ -0,0 +1,38 @@
// isletctl demo <n> | snap | dump | reset | defaults | get [key] | set <key> <value>
// demo: 1 notification, 2 timer, 3 music, 4 charging, 5 silent, 6 clear, 7/8/10 open timer/music/call, 9 call,
// 12 airplane, 13 focus, 14 flashlight on, 15 cellular, 16 flashlight off, 17 recording, 18 Bluetooth pill,
// 19 AirPods, 20 Watch low battery, 21 iPhone low battery, 22 fully charged, 23 calendar, 24 hide, 25 low power, 26 unlock,
// 27 hotspot, 28 mirroring, 29 microphone, 30 volume, 31 ring bell, 32 rotation lock, 33 AirDrop, 34 headphones bubble, 35 Watch ping, 36 lyrics
#import <Foundation/Foundation.h>
#import <notify.h>
#import <stdio.h>
#import "common.h"
static id ParseValue(const char *v) {
if (!strcmp(v, "true") || !strcmp(v, "on")) return @YES;
if (!strcmp(v, "false") || !strcmp(v, "off")) return @NO;
char *end; double d = strtod(v, &end);
return *end ? (id)NS(v) : (id)@(d);
}
int main(int argc, char **argv) {
if (argc >= 3 && !strcmp(argv[1], "demo")) {
int t; notify_register_check("com.astar76.islet.demo", &t);
notify_set_state(t, atoi(argv[2])); notify_post("com.astar76.islet.demo"); return 0;
}
if (argc >= 2 && !strcmp(argv[1], "reset")) { [NSFileManager.defaultManager removeItemAtPath:GUARD_PATH error:nil]; return 0; }
if (argc >= 2 && !strcmp(argv[1], "defaults")) { [NSFileManager.defaultManager removeItemAtPath:PREFS_PATH error:nil]; notify_post(PREFS_NOTIFICATION); return 0; }
if (argc >= 2 && !strcmp(argv[1], "dump")) { notify_post("com.astar76.islet.dump"); return 0; }
if (argc >= 2 && !strcmp(argv[1], "snap")) { notify_post("com.astar76.islet.snap"); return 0; }
if (argc >= 2 && !strcmp(argv[1], "get")) {
NSDictionary *d = [NSDictionary dictionaryWithContentsOfFile:PREFS_PATH];
printf("%s\n", [[NSString stringWithFormat:@"%@", argc >= 3 ? d[NS(argv[2])] : d] UTF8String]); return 0;
}
if (argc >= 4 && !strcmp(argv[1], "set")) {
NSMutableDictionary *d = [NSMutableDictionary dictionaryWithContentsOfFile:PREFS_PATH] ?: [NSMutableDictionary new];
d[NS(argv[2])] = ParseValue(argv[3]);
if (![d writeToFile:PREFS_PATH atomically:YES]) { fprintf(stderr, "can't write prefs\n"); return 1; }
notify_post(PREFS_NOTIFICATION); return 0;
}
fprintf(stderr, "usage: isletctl demo <1-36> | snap | dump | reset | defaults | get [key] | set <key> <value>\n"); return 1;
}

21
src/probe.m Normal file
View file

@ -0,0 +1,21 @@
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
#import <objc/message.h>
#import <dlfcn.h>
int main(int argc,char**argv){@autoreleasepool{
for(int i=1;i<argc;i++) if(strchr(argv[i],'/')) dlopen(argv[i],RTLD_NOW);
for(int i=1;i<argc;i++){ if(strchr(argv[i],'/'))continue;
if(!strncmp(argv[i],"proto:",6)){ unsigned n; Protocol*__unsafe_unretained*ps=objc_copyProtocolList(&n);
for(unsigned k=0;k<n;k++){ const char*pn=protocol_getName(ps[k]); if(!strstr(pn,argv[i]+6))continue; printf("## protocol %s\n",pn);
for(int req=1;req>=0;req--){ unsigned m; struct objc_method_description*d=protocol_copyMethodDescriptionList(ps[k],req,YES,&m); for(unsigned j=0;j<m;j++)printf(" %s -%s %s\n",req?"req":"opt",sel_getName(d[j].name),d[j].types); free(d);} }
continue; }
if(!strncmp(argv[i],"call:",5)){ NSArray*p=[[NSString stringWithUTF8String:argv[i]+5] componentsSeparatedByString:@"."]; Class c=NSClassFromString(p[0]); SEL s=NSSelectorFromString(p[1]);
printf("%s = %s\n",argv[i]+5,(c&&[c respondsToSelector:s])?[[NSString stringWithFormat:@"%@",((id(*)(id,SEL))objc_msgSend)(c,s)] UTF8String]:"(unavailable)"); continue; }
if(!strncmp(argv[i],"like:",5)){ unsigned n; Class*cs=objc_copyClassList(&n); for(unsigned k=0;k<n;k++){const char*cn=class_getName(cs[k]); if(strstr(cn,argv[i]+5)) printf("%s\n",cn);} free(cs); continue; }
if(!strncmp(argv[i],"sym:",4)){ printf("sym %s = %p\n",argv[i]+4,dlsym(RTLD_DEFAULT,argv[i]+4)); continue; }
unsigned n; Class *cs=objc_copyClassList(&n);
for(unsigned k=0;k<n;k++){ const char*cn=class_getName(cs[k]); if(strcmp(cn,argv[i]))continue;
printf("## %s (super %s)\n",cn,class_getName(class_getSuperclass(cs[k])));
unsigned m; Method*ms=class_copyMethodList(object_getClass(cs[k]),&m); for(unsigned j=0;j<m;j++)printf(" +%s %s\n",sel_getName(method_getName(ms[j])),method_getTypeEncoding(ms[j])); free(ms);
ms=class_copyMethodList(cs[k],&m); for(unsigned j=0;j<m;j++)printf(" -%s %s\n",sel_getName(method_getName(ms[j])),method_getTypeEncoding(ms[j])); free(ms);} free(cs);}
}return 0;}

Some files were not shown because too many files have changed in this diff Show more