Leave an auto-scaled internal panel alone in clamshell recovery (#7581)
With the default scale = "auto", sync_internal_scale read the config, rejected "auto" as non-numeric, fell back to the hardcoded default 2, and force-applied it whenever the compositor's auto resolution differed. Since the script runs from omarchy-system-wake after every idle cycle, the panel flapped between 2 and auto's own value (1.5666667 on a 198 DPI panel) on every wake/reload pair. A config without a usable number -- "auto", or an expression only Hyprland's Lua can evaluate -- delegates the scale to the compositor: whatever it resolved for the enabled panel is the configured scale, so there is nothing to correct. Recovery of a disabled panel is unchanged and still re-enables it with the remembered scale, falling back to the historical default 2. Fixes #7265. Also the scale-revert half of #7301. Claude-Session: https://claude.ai/code/session_01L4Z6GimYhR1Kpsir24VAPF Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
ed7bae4ac5
commit
b63616422f
@@ -118,9 +118,17 @@ remember_internal_scale() {
|
||||
store_internal_scale "$scale"
|
||||
}
|
||||
|
||||
# $1 is the configured scale when the caller has already read it, so one sync
|
||||
# does not parse the config twice.
|
||||
read_monitor_scale() {
|
||||
local scale
|
||||
scale=$(configured_monitor_scale)
|
||||
|
||||
if (( $# )); then
|
||||
scale="$1"
|
||||
else
|
||||
scale=$(configured_monitor_scale)
|
||||
fi
|
||||
|
||||
if valid_scale "$scale"; then
|
||||
echo "$scale"
|
||||
return
|
||||
@@ -159,11 +167,25 @@ enable_internal_output() {
|
||||
|
||||
sync_internal_scale() {
|
||||
[[ -n $INTERNAL ]] || return 0
|
||||
local configured_scale
|
||||
local desired_scale
|
||||
local active_scale
|
||||
|
||||
desired_scale=$(read_monitor_scale)
|
||||
configured_scale=$(configured_monitor_scale)
|
||||
active_scale=$(current_internal_scale)
|
||||
|
||||
# A config without a usable number -- the default "auto", or an expression
|
||||
# only Hyprland's Lua can evaluate -- delegates the scale to the compositor,
|
||||
# so whatever it resolved for the enabled panel IS the configured scale.
|
||||
# There is no number to correct it toward: substituting one makes the scale
|
||||
# flap between that number and the compositor's own value on every idle-wake.
|
||||
# Only a panel that is off altogether still gets a hand below, from the
|
||||
# remembered scale.
|
||||
if ! valid_scale "$configured_scale" && valid_scale "$active_scale"; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
desired_scale=$(read_monitor_scale "$configured_scale")
|
||||
scales_match "$active_scale" "$desired_scale" && return 0
|
||||
|
||||
enable_internal_output "$desired_scale"
|
||||
|
||||
Reference in New Issue
Block a user