Skip to content

Commit fd94f25

Browse files
committed
Fix toggle mode on set_background_opacity remote_command
1 parent 7b0caaa commit fd94f25

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

kitty/rc/set_background_opacity.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ def response_from_kitty(self, boss: Boss, window: Window | None, payload_get: Pa
7070
val: float = payload_get('opacity') or 0.
7171
if payload_get('toggle'):
7272
current = background_opacity_of(os_window_id)
73-
if current == val:
73+
# GLFW represents opacity as a float internally, but python's
74+
# "float" type has double precision, so we can't rely on precise
75+
# equality here
76+
if abs(current - val) <= 0.0001:
7477
val = opts.background_opacity
7578
boss._set_os_window_background_opacity(os_window_id, val)
7679
return None

0 commit comments

Comments
 (0)