Skip to content

Commit

Permalink
Micro-simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
wnob committed Jul 26, 2023
1 parent 037d6a1 commit 4fb5b34
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions terminalle/terminalle.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

from os import system
from functools import partial
from math import inf
from typing import Callable, Dict, Tuple

import gi
Expand Down Expand Up @@ -176,7 +177,7 @@ def move(self, axis: int, direction: int):
curr_geometry.y + 0.5 * curr_geometry.height)
curr_mid_on = mid[axis]
curr_mid_off = mid[1 - axis]
best_gain = None
best_gain = inf
best_monitor = None
for i in range(display.get_n_monitors()):
geometry = display.get_monitor(i).get_geometry()
Expand All @@ -185,8 +186,7 @@ def move(self, axis: int, direction: int):
mid_on = mid[axis]
mid_off = mid[1 - axis]
gain = (mid_on - curr_mid_on) * direction
if gain > 0 and (best_gain is None or gain < best_gain) \
and gain > abs(mid_off - curr_mid_off):
if gain > 0 and gain < best_gain and gain > abs(mid_off - curr_mid_off):
best_gain = gain
best_monitor = i
if best_monitor is not None:
Expand Down

0 comments on commit 4fb5b34

Please sign in to comment.