Repository navigation
omamobile-settings 0.1.1: a Display page, brightness and refresh rate - #628
Conversation
The first settings page on the foundation, opened as the display page
(org.omamobile.Settings.Open("display")). Brightness is the backlight
through brightnessctl, on the device omarchy-hw-display names, in steps of
10, 25, 50, 75 and 100 percent (never below 10). The refresh rate lists the
rates the built-in monitor offers at its current size and applies the one
tapped live, through hyprctl eval hl.monitor with the monitor's own name,
size, position, scale and transform; the page hides the rate buttons when
there is only one. It changes the running session only.
The page runs backends/display.sh through a small ActionRunner: a fixed
tool list, at most three arguments of [a-z0-9] up to 16 characters, no
shell string, a 20 s kill, and the result as one line of JSON delivered
from the event loop. Values taken from hyprctl are checked before they
reach the eval string.
Tested on a Pixel 8 Pro: test/all passes on the phone (the new backend
test included), the page renders, 60 and 120 Hz apply and read back, and
brightness changes when the app is started by the compositor (from an ssh
login the logind brightness call is refused, which is expected).
Not tested on any other phone.
Signed-off-by: Lef <me@lefteros.com>
9d8a5be to
6a2fb99
Compare
|
@Somnius thank you for this, it's a good first page on the Settings foundation and a careful one. I read the runner, the backend and the page, and replayed the whole stack (#628, #629, #630) onto today's main: One thing has to change, and it is not your doing: #643 landed a few hours after you opened this and took omamobile-settings 0.1.1 (Back goes up one page, and home from the top level). Your branch has the same version line, so git sees no conflict and it would merge silently under a version that is already published. This one becomes 0.1.2; I'll set the file and the title when I merge, so no push is needed just for that, and #629 and #630 then take 0.1.3 and 0.1.4. Smaller things, for this PR or the next push of the stack:
I haven't run it on the Pixel 7 Pro yet. Nothing installs Settings by default, so that doesn't hold the merge; I'll try the rate buttons there (60 and back to 120, a rotation, a lock and unlock) before Settings goes into an image and report here. For the stack: once this is merged, please rebase the next one with |
… Back on the Display page Auto-rotate applies the monitor's preferred mode each time the phone is turned, so a chosen rate lasts only until then: the README, the script header and the page's status line say so. A core test goes to the display page and back to the root.
|
@Somnius thank you, both points are in: the README, the script header and the page's status line now say that turning the phone brings the preferred rate back, and I'm setting the version to 0.1.2 on your branch and merging it under that number, as promised. For the stack, once this is in: I still owe the run on my Pixel 7 Pro (60 and back to 120, a rotation, a lock and unlock) before Settings goes into an image, and I'll report it here. |
…derekross#628) The Settings app gets its first page: brightness in fixed steps through brightnessctl, and the built-in panel's refresh rate applied live through `hyprctl eval` with every value from `hyprctl monitors` checked first. The page runs `backends/display.sh` through a fixed-argument runner with no shell string. The rate changes the running session only: a rotation, a session restart or a config reload brings the preferred mode back. Tested on a Pixel 8 Pro; not yet run on the Pixel 7 Pro. Signed-off-by: Lef <me@lefteros.com>
@derekross, @marselnenaj, this is a first page for the Settings app on the foundation that just merged (#526), following the decision there that pages live in the app. It's the Display page: brightness in steps of 10, 25, 50, 75 and 100 percent, and the refresh rate, which lists the rates the built-in monitor offers at its current size and applies the tapped one live. The rate buttons are hidden if there is only one rate. The rate changes the running session only, so a restart or a config reload sets the configured mode again. The page opens with
org.omamobile.Settings.Open("display").How it works: the page runs
backends/display.shthrough a small ActionRunner. The runner has a fixed list of tools, at most three arguments of lowercase letters and digits, no shell string, a 20 s kill, and it hands the one line of JSON back from the event loop. Brightness goes through brightnessctl on the deviceomarchy-hw-displaynames, the same as the shell's keys. The refresh rate useshyprctl eval hl.monitor{...}with the monitor's own name, size, position, scale and transform, and the values read from hyprctl are checked before they get anywhere near the eval string. The monitor is the built-in panel (DSI or eDP), else the only one, else the focused one. Without a monitor the brightness still works.The package now also depends on brightnessctl, python and bash. The version is 0.1.1, and the README says what the page changes. I kept the PIN and haptics pages out of this one on purpose; they would each be their own PR.
What I tested, on a Pixel 8 Pro: test/all passes on the phone, with a new test for the backend that fakes the monitor and the brightness (two monitors, one rate, a bad monitor name, no monitor). The page renders. 60 and 120 Hz both apply and read back, and a rate the monitor doesn't list is refused. A tap on 50% changed the backlight when the app was started by the compositor. Started from an ssh login it said it couldn't set the brightness, because logind refuses the call there, so that's how I launched it the first time and not a page problem.
What I didn't test: any other phone. Your 7 Pro would be the check, mainly that the rates list and the rotation survive a rate change. I haven't tried a rate change while the screen is rotated, and I don't know whether the success output of
hyprctl evalis the same on every Hyprland version, so the script only looks for the word "error".