Skip to content

Commit

Permalink
fix console behaviour (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeon0 authored Nov 11, 2023
1 parent 310bede commit d7c5b8e
Showing 1 changed file with 17 additions and 23 deletions.
40 changes: 17 additions & 23 deletions src/overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,30 +136,24 @@ def hide_canvas(self, event):
self.hide_id = self.root.after(3000, lambda: self.root.attributes("-alpha", Config().general["hidden_transparency"]))

def toggle_size(self):
if lock.acquire(blocking=False):
try:
if not self.is_minimized:
self.canvas.config(height=self.initial_height, width=self.initial_width)
self.root.geometry(
f"{self.initial_width}x{self.initial_height}+{self.screen_width//2 - self.initial_width//2 + self.screen_off_x}+{self.screen_height - self.initial_height + self.screen_off_y}"
)
else:
self.canvas.config(height=self.maximized_height, width=self.maximized_width)
self.root.geometry(
f"{self.maximized_width}x{self.maximized_height}+{self.screen_width//2 - self.maximized_width//2 + self.screen_off_x}+{self.screen_height - self.maximized_height + self.screen_off_y}"
)
self.is_minimized = not self.is_minimized
if self.is_minimized:
self.hide_canvas(None)
self.toggle_button.config(text="max")
else:
self.show_canvas(None)
self.toggle_button.config(text="min")
move_window_to_foreground()
finally:
lock.release()
if not self.is_minimized:
self.canvas.config(height=self.initial_height, width=self.initial_width)
self.root.geometry(
f"{self.initial_width}x{self.initial_height}+{self.screen_width//2 - self.initial_width//2 + self.screen_off_x}+{self.screen_height - self.initial_height + self.screen_off_y}"
)
else:
return
self.canvas.config(height=self.maximized_height, width=self.maximized_width)
self.root.geometry(
f"{self.maximized_width}x{self.maximized_height}+{self.screen_width//2 - self.maximized_width//2 + self.screen_off_x}+{self.screen_height - self.maximized_height + self.screen_off_y}"
)
self.is_minimized = not self.is_minimized
if self.is_minimized:
self.hide_canvas(None)
self.toggle_button.config(text="max")
else:
self.show_canvas(None)
self.toggle_button.config(text="min")
move_window_to_foreground()

def filter_items(self):
if lock.acquire(blocking=False):
Expand Down

0 comments on commit d7c5b8e

Please sign in to comment.