Repository navigation
phone/dev: fit the phone window to the screen - #329
Merged
Merged
Conversation
run-desktop always floated the nested Hyprland at 600x1300 logical pixels, taller than a 1080p screen at scale 1.25 (864 logical, 840 below Omarchy's bar): the window ran off the top and the bottom and had to be resized by hand (derekross#146). It now takes the largest 6n x 13n (the phone's 13:6 shape) that fits the focused monitor beside its bars, with n a multiple of 10 up to 100, and passes the nested monitor's mode and scale n/80 to hyprland.lua. The shell still sees 480x1040 logical pixels, as on the Pixel 7 Pro, so layouts don't change; n = 100 is the old 600x1300 at 1.25, so screens with room see no change. n is a multiple of 10 because Hyprland keeps a monitor scale only when the logical size comes out whole: a scale that is a multiple of 1/8 always does, while for some even n it comes out a hair off (54: 324 / 0.675 = 479.99999999999994), and Hyprland then substitutes another scale (in a nested Hyprland 0.56.2 at 324x702 and 0.675, 2/3, so the shell would lay out at 486x1053). On a 1080p screen at 1.25 that gives n = 60 (360x780) rather than 62. PHONE_DEV_N=<n>, a multiple of 10 from 40 to 100, forces a size, to compare screenshots across machines or keep the big window on a small screen. Below n = 40 (240x520) the shell is too small to use, so the harness stops with a message, as it does when hyprctl gives no focused monitor to measure. Both checks run before the harness copies or writes anything. Tested on the laptop (Omarchy 4.0.6, Hyprland 0.56.2, 1920x1080 at 1.25): the window is 360x780 at y 54-834, inside the screen; the nested monitor is 360x780 at scale 0.75 (480.0x1040.0 logical), and the shell's bar, home and dock lay out as on the phone. With PHONE_DEV_N=100 the window is 600x1300 at 1.25, as before. A fake hyprctl covered 1080p to 4K, rotated and flipped monitors, the floor, a failing hyprctl and invalid PHONE_DEV_N values. Text is smaller on small screens, and a little soft on a desktop scaled above 1, since the nested output renders at the window's logical size and the desktop scales it up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
robertzas
pushed a commit
to robertzas/omarchy-mobile
that referenced
this pull request
Nov 14, 2026
run-desktop always floated the nested Hyprland at 600x1300 logical pixels, taller than a 1080p screen at scale 1.25 (864 logical, 840 below Omarchy's bar): the window ran off the top and the bottom and had to be resized by hand (derekross#146). It now takes the largest 6n x 13n (the phone's 13:6 shape) that fits the focused monitor beside its bars, with n a multiple of 10 up to 100, and passes the nested monitor's mode and scale n/80 to hyprland.lua. The shell still sees 480x1040 logical pixels, as on the Pixel 7 Pro, so layouts don't change; n = 100 is the old 600x1300 at 1.25, so screens with room see no change. n is a multiple of 10 because Hyprland keeps a monitor scale only when the logical size comes out whole: a scale that is a multiple of 1/8 always does, while for some even n it comes out a hair off (54: 324 / 0.675 = 479.99999999999994), and Hyprland then substitutes another scale (in a nested Hyprland 0.56.2 at 324x702 and 0.675, 2/3, so the shell would lay out at 486x1053). On a 1080p screen at 1.25 that gives n = 60 (360x780) rather than 62. PHONE_DEV_N=<n>, a multiple of 10 from 40 to 100, forces a size, to compare screenshots across machines or keep the big window on a small screen. Below n = 40 (240x520) the shell is too small to use, so the harness stops with a message, as it does when hyprctl gives no focused monitor to measure. Both checks run before the harness copies or writes anything. Tested on the laptop (Omarchy 4.0.6, Hyprland 0.56.2, 1920x1080 at 1.25): the window is 360x780 at y 54-834, inside the screen; the nested monitor is 360x780 at scale 0.75 (480.0x1040.0 logical), and the shell's bar, home and dock lay out as on the phone. With PHONE_DEV_N=100 the window is 600x1300 at 1.25, as before. A fake hyprctl covered 1080p to 4K, rotated and flipped monitors, the floor, a failing hyprctl and invalid PHONE_DEV_N values. Text is smaller on small screens, and a little soft on a desktop scaled above 1, since the nested output renders at the window's logical size and the desktop scales it up. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Closes #146.
run-desktopandhyprland.luaboth hard-coded 600x1300 at scale 1.25, so on a 1920x1080 screen at 1.25 (864 logical pixels high, 840 below Omarchy's bar) the window ran off the top and the bottom.exec.run-desktoptakes the largest 6n x 13n (the phone's 13:6 shape) that fits the focused monitor once its reserved area (the bar) and 24 pixels for the border and gaps are taken off, with width and height swapped for transforms 1, 3, 5 and 7, and n a multiple of 10 (see below) up to 100. It passes the mode and the scale n/80 tohyprland.luathrough the environment (PHONE_DEV_MODE,PHONE_DEV_SCALE) and uses the same numbers for the float resize. The formula is in a comment above the code. The shell always sees 480x1040 logical pixels, as on the Pixel 7 Pro, and a screen with room still gets the old 600x1300 at 1.25 (n = 100).PHONE_DEV_N=<n>, a multiple of 10 from 40 to 100, forces a 6n x 13n window without reading the monitor, so it also works wherehyprctlcan't answer. Any other non-empty value is refused with a message; an empty one counts as unset.PHONE_DEV_Nopens it anyway. It also stops whenhyprctlgives no focused monitor, rather than falling back to 600x1300. Both checks run right after the existing pre-flight checks, before the harness copies or writes anything.phone/README.md: on a desktop scaled above 1, the nested output renders at the window's logical size and the desktop scales it up.One change from my proposal: n is a multiple of 10, not just even. I wrote in the issue that even n was enough for Hyprland to keep the scale. Your arithmetic holds (n/80 = 1.5n/120, so an even n stays on the 1/120 steps), but Hyprland also needs the pixel size divided by the scale to come out whole, and for some even n it comes out a hair off: 54 gives 324 / 0.675 = 479.99999999999994. In a nested Hyprland 0.56.2 started at 324x702 and 0.675, the monitor came up at scale 0.6666667, so the shell would lay out at 486x1053 instead of 480x1040. Between 40 and 100 the even n with that problem are 44, 46, 54, 56, 82, 88, 92 and 98. Others pass: 62 (372x806 at 0.775) kept its scale in the same test. I still went with multiples of 10, because then the scale is a multiple of 1/8, which any floating-point type holds exactly, so the harness doesn't depend on how Hyprland rounds. The cost is a slightly smaller window: on this laptop 360x780 rather than 372x806. If you'd rather have the even n that pass, I can switch, but the harness would then have to copy Hyprland's check.
You offered stacking on #173 or waiting: I waited, and this is rebased onto
mainwith #173 in it. Nothing underpackages/changes, and nothing here runs on a phone.Device and build
4.0.6-1, Hyprland0.56.2, a 1920x1080 screen at 1.25)uname -r): n/a, nothing runs on a phonephone/only)Checks (no phone needed)
tools/pr-checkpasses, against upstreammainat53b906d(myoriginis my fork)tests/allpasses, on the rebased branchtests/packages: n/a, no package touchedversionbumped: n/a, no package touchedCo-Authored-By:trailerOn the phone
hyprctl(below), a rotated, 4K or scale-1 monitor, a screen too small for n = 40, or a failinghyprctluserdata, weakens the storage guard, or reads registers from userspace (AGENTS.md §1): it never runs on a phoneNo
tools/phone-smokereport: nothing here runs on a phone.Tested in the harness
On the laptop above (1920x1080 at 1.25, the bar's 24 pixels reserved at the top):
Default: the window floats at 360x780 at y 54-834, inside the 864-pixel-high screen. In the nested session
hyprctl monitorsreports 360x780 at scale 0.75 (480.0x1040.0 logical), and the shell's bar, home and dock lay out as on the phone.PHONE_DEV_N=100: the nested monitor is 600x1300 at 1.25 (480.0x1040.0 logical), as before; on this screen the window runs from y -206 to 1094, which is what the override is for.With a fake
hyprctlin front ofrun-desktop(and a fakeHyprlandthat prints what it gets), the bar's 24 pixels reserved at the top:A failing
hyprctl, no focused monitor, or a monitor without a reserved area stops with "could not read the focused monitor from hyprctl".PHONE_DEV_N55, 30, 110, 0100, abc, " 100", 100x, 62 and non-ASCII digits are refused. A stop leaves the harness directory as it was, and the resize sent to the desktop always matched the mode passed tohyprland.lua.For every n from 40 to 100 in steps of 10, 6n and 13n divided by the scale come out exactly 480 and 1040.
After the runs, the desktop still had its windows and a single Hyprland instance, and its shell was the same process throughout.
Screenshots
1080p at 1.25: the window as it appears on the desktop (360x780 logical, captured at the screen's 450x975 pixels, so the text is as soft as it looks there):
PHONE_DEV_N=100: captured from the nested compositor itself (600x1300, its own pixels, with no desktop scaling):Not in this PR
QCryptographicHashon Qt Quick's render thread.🤖 Generated with Claude Code