Fix toggle mode on set_background_opacity remote_command

This commit is contained in:
Devin Lehmacher 2025-09-22 01:54:02 -04:00
parent 7b0caaa491
commit fd94f2581e

View file

@ -70,7 +70,10 @@ def response_from_kitty(self, boss: Boss, window: Window | None, payload_get: Pa
val: float = payload_get('opacity') or 0.
if payload_get('toggle'):
current = background_opacity_of(os_window_id)
if current == val:
# GLFW represents opacity as a float internally, but python's
# "float" type has double precision, so we can't rely on precise
# equality here
if abs(current - val) <= 0.0001:
val = opts.background_opacity
boss._set_os_window_background_opacity(os_window_id, val)
return None