From 7ecf9c7d0a356dd9ad3a4afb77194ebccbb5c265 Mon Sep 17 00:00:00 2001 From: Henrik Klee Date: Sun, 22 Nov 2026 04:24:58 +0800 Subject: [PATCH 1/2] Scale every Apple panel at login, at the scale iOS gives it The login scaling knew only the iPad 6/7 and iPhone 7 panels, so an iPod touch 6 (640x1136) and every other phone or iPad stayed at scale 1. omarchy-panel-scale lists the built-in panels of the iPads, iPhones and iPod touches with iOS's scale (2, 3 for the 3x iPhones, 2.5 for the Plus panels, 1 for iPad 2/mini); scale-output and the phone check of the window rules both use it. --- desktop/configuration/scale-output | 10 +++---- desktop/shell/bin/omarchy-labwc-window-rules | 4 ++- desktop/shell/bin/omarchy-panel-scale | 30 ++++++++++++++++++++ tests/test_menu_toggles.py | 11 ++++++- tests/test_monitor_scaling.py | 8 +++++- 5 files changed, 55 insertions(+), 8 deletions(-) create mode 100755 desktop/shell/bin/omarchy-panel-scale diff --git a/desktop/configuration/scale-output b/desktop/configuration/scale-output index 093d870e..8c9d28fb 100644 --- a/desktop/configuration/scale-output +++ b/desktop/configuration/scale-output @@ -1,19 +1,19 @@ #!/bin/bash -# Scale the single native panel (the iPads' and the iPhone 7's), accepting both -# current/preferred flag lists. +# Scale the single built-in panel of an iPad, iPhone or iPod touch, accepting +# both current/preferred flag lists. # Never change its timing or force the VM's Virtual-1 mode. # The scale is the one omarchy-hyprland-monitor-persist saved for this output # (upstream Omarchy's monitors/settings file, scale in the third field, the -# output last), else 2. +# output last), else the one iOS gives that panel (omarchy-panel-scale). set -euo pipefail state=$(wlr-randr) mapfile -t outputs < <(awk '/^[^[:space:]]/ {print $1}' <<< "$state") +mode=$(awk '/^[[:space:]]+[0-9]+x[0-9]+ px, .*current/ {print $1; exit}' <<< "$state") if (( ${#outputs[@]} != 1 )) || ! grep -q ' Enabled: yes' <<< "$state" || - ! grep -Eq '^[[:space:]]+(1536x2048|2048x1536|1620x2160|2160x1620|750x1334|1334x750) px, .*current' <<< "$state"; then + ! scale=$(omarchy-panel-scale "${mode:-none}" 2>/dev/null); then echo 'Native single-panel mode not established; left scale unchanged' >&2 exit 0 fi -scale=2 settings="${XDG_STATE_HOME:-${HOME:-}/.local/state}/omarchy/monitors/settings" if [[ -r $settings ]]; then saved=$(awk -F'\t' -v output="${outputs[0]}" '$NF == output { scale = $3 } END { print scale }' "$settings") diff --git a/desktop/shell/bin/omarchy-labwc-window-rules b/desktop/shell/bin/omarchy-labwc-window-rules index 1dc442d6..9ad60da2 100755 --- a/desktop/shell/bin/omarchy-labwc-window-rules +++ b/desktop/shell/bin/omarchy-labwc-window-rules @@ -17,7 +17,8 @@ rules=$HOME/.local/state/omarchy/xdg-config/labwc/rc.xml # A phone: the panel's short side under 480 logical pixels (the shell's # narrow bar), at the scale omarchy-hyprland-monitor-persist saved for it, -# else 2 (as scale-output). Read from the kernel: at login labwc is not up. +# else the panel's own (omarchy-panel-scale, as scale-output), else 2. Read +# from the kernel: at login labwc is not up. phone() { local modes mode short scale=2 settings for modes in "${OMARCHY_DRM_ROOT:-/sys/class/drm}"/card*-*/modes; do @@ -25,6 +26,7 @@ phone() { mode=$(head -1 "$modes") [[ $mode =~ ^([0-9]+)x([0-9]+) ]] || continue short=$(( BASH_REMATCH[1] < BASH_REMATCH[2] ? BASH_REMATCH[1] : BASH_REMATCH[2] )) + scale=$(omarchy-panel-scale "${BASH_REMATCH[1]}x${BASH_REMATCH[2]}" 2>/dev/null) || scale=2 settings=$HOME/.local/state/omarchy/monitors/settings if [[ -r $settings ]]; then local saved diff --git a/desktop/shell/bin/omarchy-panel-scale b/desktop/shell/bin/omarchy-panel-scale new file mode 100755 index 00000000..91c25789 --- /dev/null +++ b/desktop/shell/bin/omarchy-panel-scale @@ -0,0 +1,30 @@ +#!/bin/bash + +# omarchy:summary=Print the scale an Apple panel starts at, by its mode +# omarchy:args=WIDTHxHEIGHT +# omarchy:hidden=true + +# The built-in panels of the iPads, iPhones and iPod touches, each with the +# scale iOS gives it (its points), so a screen starts at the size it has +# under iOS. Either orientation. An unknown mode (a VM, an external monitor) +# prints nothing and fails: callers leave such a screen alone. +# The iPhone Plus panels: iOS draws them at 3x and shrinks the picture to the +# panel, about 2.61 here; 2.5 is the nearest scale that splits the panel into +# whole pixels. +set -euo pipefail +[[ ${1:-} =~ ^([0-9]+)x([0-9]+)$ ]] || { echo "Usage: omarchy-panel-scale WIDTHxHEIGHT" >&2; exit 2; } +w=${BASH_REMATCH[1]} h=${BASH_REMATCH[2]} +(( w <= h )) || { t=$w; w=$h; h=$t; } +case ${w}x$h in + # iPad 2, iPad mini. + 768x1024) echo 1 ;; + # iPads: 9.7" and 7.9", 10.2", 10.5", 11", 12.9", 10.9", 8.3", 11" and 13" (M4). + 1536x2048 | 1620x2160 | 1668x2224 | 1668x2388 | 2048x2732 | 1640x2360 | 1488x2266 | 1668x2420 | 2064x2752) echo 2 ;; + # iPhone 4s; iPhone 5 to SE and iPod touch 5 to 7; iPhone 6 to 8 and SE 2/3; iPhone XR and 11. + 640x960 | 640x1136 | 750x1334 | 828x1792) echo 2 ;; + # iPhone 6 Plus to 8 Plus. + 1080x1920) echo 2.5 ;; + # iPhone X to 16 and their Max, Pro and mini models. + 1125x2436 | 1242x2688 | 1080x2340 | 1170x2532 | 1284x2778 | 1179x2556 | 1290x2796 | 1206x2622 | 1320x2868) echo 3 ;; + *) exit 1 ;; +esac diff --git a/tests/test_menu_toggles.py b/tests/test_menu_toggles.py index 0078fd47..7de47656 100644 --- a/tests/test_menu_toggles.py +++ b/tests/test_menu_toggles.py @@ -18,7 +18,8 @@ def setUp(self): # An iPad's panel unless a test says otherwise (the host's own is not asked). self.drm = self.home / 'drm' self.panel('1536x2048') - self.env = {**os.environ, 'HOME': str(self.home), 'OMARCHY_DRM_ROOT': str(self.drm)} + self.env = {**os.environ, 'HOME': str(self.home), 'OMARCHY_DRM_ROOT': str(self.drm), + 'PATH': f'{BIN}:{os.environ["PATH"]}'} def panel(self, mode): modes = self.drm / 'card0-DSI-1/modes' @@ -90,6 +91,14 @@ def test_on_a_phone_about_and_omacalc_fill_the_screen_too(self): self.run_bin('omarchy-toggle-maximize-windows', '--apply') self.assert_maximizes(rules) + def test_a_3x_iphone_is_a_phone_at_its_own_scale(self): + # 1125 wide is a tablet at 2, but the iPhone X starts at 3: 375. + rules = self.home / '.local/state/omarchy/xdg-config/labwc/rc.xml' + self.panel('1125x2436') + result = self.run_bin('omarchy-toggle-maximize-windows', '--apply') + self.assertEqual(result.returncode, 0, result.stderr) + self.assert_maximizes(rules, phone=True) + def test_the_on_flag_from_before_the_default_goes(self): legacy = self.home / '.local/state/omarchy/toggles/maximize-windows' legacy.parent.mkdir(parents=True) diff --git a/tests/test_monitor_scaling.py b/tests/test_monitor_scaling.py index 35946be3..bd423657 100644 --- a/tests/test_monitor_scaling.py +++ b/tests/test_monitor_scaling.py @@ -158,7 +158,7 @@ def run_script(self, mode='1536x2048', settings=None): (state / 'omarchy/monitors').mkdir(parents=True) (state / 'omarchy/monitors/settings').write_text(settings) log = root / 'randr.log' - env = {**os.environ, 'PATH': f'{stubs}:{os.environ["PATH"]}', 'XDG_STATE_HOME': str(state), + env = {**os.environ, 'PATH': f'{stubs}:{BIN}:{os.environ["PATH"]}', 'XDG_STATE_HOME': str(state), 'RANDR_LOG': str(log), 'RANDR_TEXT': str(text)} subprocess.run([BASH, str(SCALE_OUTPUT)], env=env, check=True, capture_output=True) return log.read_text().splitlines() if log.exists() else [] @@ -167,6 +167,12 @@ def test_nothing_saved_scales_the_native_panel_by_two(self): self.assertEqual(self.run_script(), ['--output Unknown-1 --scale 2']) self.assertEqual(self.run_script(settings='\t\t1.6\t\tDP-1\n'), ['--output Unknown-1 --scale 2']) + def test_every_apple_panel_starts_at_its_ios_scale(self): + # The iPod touch 6 (640x1136) was missing and stayed at 1. + for mode, scale in (('640x1136', '2'), ('1136x640', '2'), ('640x960', '2'), ('2224x1668', '2'), + ('2048x2732', '2'), ('768x1024', '1'), ('1080x1920', '2.5'), ('1125x2436', '3')): + self.assertEqual(self.run_script(mode=mode), [f'--output Unknown-1 --scale {scale}'], mode) + def test_the_saved_scale_for_the_panel_wins(self): self.assertEqual(self.run_script(mode='2160x1620', settings='\t\t1.66667\t\tUnknown-1\n'), ['--output Unknown-1 --scale 1.66667']) From 19c42ca8f81001138f0102c5cb47858565fbd881 Mon Sep 17 00:00:00 2001 From: Henrik Klee Date: Sun, 22 Nov 2026 04:25:06 +0800 Subject: [PATCH 2/2] Changelog: every Apple panel scaled --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c0b6e950..948bf03b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,9 @@ is missing or empty. ### Desktop +- Every iPad, iPhone and iPod touch screen now starts at the size it has + under iOS. Before, only the iPad 6, iPad 7 and iPhone 7 did; on the others, + such as the iPod touch 6, everything was drawn at half size. - A new launcher replaces the app grid: Home, Super and the bar's logo open apps, actions and (on a phone) the system controls in swipeable tabs, with search, recent apps and files, long-press app menus and full keyboard