@@ -411,9 +411,11 @@ def icon_clicked(self, reason):
411411 if reason in (QSystemTrayIcon .ActivationReason .Trigger ,
412412 QSystemTrayIcon .ActivationReason .DoubleClick ,
413413 QSystemTrayIcon .ActivationReason .MiddleClick ):
414- # when green icon is displayed and no popwin is about to pop up show at least menu
415- if get_worst_status () == 'UP' and OS == OS_DARWIN :
416- self .menu .show_at_cursor ()
414+ # when green icon is displayed and no popwin is about to pop up...
415+ if get_worst_status () == 'UP' :
416+ # ...nothing to do except on macOS where menu should be shown
417+ if OS == OS_DARWIN :
418+ self .menu .show_at_cursor ()
417419 else :
418420 # show status window if there is something to tell
419421 if statuswindow .is_shown :
@@ -1678,7 +1680,6 @@ def calculate_size(self):
16781680 # where is the pointer which clicked onto systray icon
16791681 icon_x = systrayicon .geometry ().x ()
16801682 icon_y = systrayicon .geometry ().y ()
1681-
16821683 if OS in OS_NON_LINUX :
16831684 if self .icon_x == 0 :
16841685 self .icon_x = QCursor .pos ().x ()
@@ -1694,6 +1695,7 @@ def calculate_size(self):
16941695
16951696 if icon_y == 0 and self .icon_y == 0 :
16961697 self .icon_y = QCursor .pos ().y ()
1698+
16971699 if OS in OS_NON_LINUX :
16981700 if self .icon_y == 0 :
16991701 self .icon_y = QCursor .pos ().y ()
@@ -1705,6 +1707,7 @@ def calculate_size(self):
17051707 available_height = self .screen ().availableGeometry ().height () - conf .systray_offset
17061708 else :
17071709 available_height = self .screen ().availableGeometry ().height ()
1710+
17081711 available_width = self .screen ().availableGeometry ().width ()
17091712 available_x = self .screen ().availableGeometry ().x ()
17101713 available_y = self .screen ().availableGeometry ().y ()
@@ -1716,8 +1719,6 @@ def calculate_size(self):
17161719 if available_y == 0 :
17171720 available_y = available_height
17181721
1719- # del (screen_or_widget)
1720-
17211722 # take whole screen height into account when deciding about upper/lower-ness
17221723 # add available_y because it might vary on differently setup screens
17231724 # calculate top-ness only if window is closed
@@ -1771,7 +1772,7 @@ def calculate_size(self):
17711772
17721773 # when statusbar hangs around in lowermost part of current screen extend from bottom to top
17731774 else :
1774- # when height is to large for current screen cut it
1775+ # when height is too large for current screen cut it
17751776 if self .y () + self .height () - real_height < available_y :
17761777 height = self .screen ().geometry ().height () - available_y - (
17771778 self .screen ().geometry ().height () - (self .y () + self .height ()))
@@ -1792,19 +1793,26 @@ def calculate_size(self):
17921793 height = available_height - available_y
17931794 # when statusbar hangs around in lowermost part of current screen extend from bottom to top
17941795 else :
1795- # when height is to large for current screen cut it
1796- if self .y () + self .height () - real_height < available_y :
1797- # simply take the available max height if there is no more screen real estate
1798- # possible because systrayicon resides aside from available space, in fact cutting it
1796+ ## when height is too large for current screen cut it
1797+ # if self.y() + self.height() - real_height < available_y:
1798+ # # simply take the available max height if there is no more screen real estate
1799+ # # possible because systrayicon resides aside from available space, in fact cutting it
1800+ # height = available_height
1801+ # y = available_height - height
1802+ # else:
1803+ # if available_height < real_height:
1804+ # y = available_y
1805+ # height = available_height
1806+ # else:
1807+ # y = available_height - real_height
1808+ # height = real_height
1809+
1810+ if available_height < real_height :
1811+ y = available_y
17991812 height = available_height
1800- y = available_height - height
18011813 else :
1802- if available_height < real_height :
1803- y = available_y
1804- height = available_height
1805- else :
1806- y = available_height - real_height
1807- height = real_height
1814+ y = available_height - real_height
1815+ height = real_height
18081816
18091817 return width , height , x , y
18101818
@@ -1914,12 +1922,21 @@ def leaveEvent(self, event):
19141922 """
19151923 check if popup has to be hidden depending on mouse position
19161924 """
1925+ # depending on display mode the leave time offset shall be different because
1926+ # it may be too short in systray mode and lead to flickering window
1927+ if conf .statusbar_floating :
1928+ leave_time_offset = 0.25
1929+ elif conf .icon_in_systray :
1930+ # offset is max 1 and smaller if window is smaller too
1931+ leave_time_offset = self .height () / self .screen ().availableGeometry ().height ()
1932+ else :
1933+ leave_time_offset = 0
19171934
19181935 # check first if popup has to be shown by hovering or clicking
19191936 if conf .close_details_hover and \
19201937 not conf .fullscreen and \
19211938 not conf .windowed and \
1922- self .is_shown_timestamp + 0.25 < time .time ():
1939+ self .is_shown_timestamp + leave_time_offset < time .time ():
19231940 # only hide window if cursor is outside of it
19241941 mouse_x = QCursor .pos ().x ()
19251942 mouse_y = QCursor .pos ().y ()
@@ -1928,8 +1945,6 @@ def leaveEvent(self, event):
19281945 mouse_y <= self .y () or mouse_y >= self .y () + self .height ():
19291946 self .hide_window ()
19301947
1931- del (mouse_x , mouse_y )
1932-
19331948 def closeEvent (self , event ):
19341949 """
19351950 window close
0 commit comments