From e96ff8e8aa389cd19cdb6eeb98eb8c4157153e34 Mon Sep 17 00:00:00 2001 From: "Azalea (on HyDEV-Daisy)" Date: Thu, 18 Aug 2022 01:05:15 -0400 Subject: [PATCH] [O] Optimize terminal size warning --- hyfetch/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hyfetch/main.py b/hyfetch/main.py index c8e05607..799382fc 100755 --- a/hyfetch/main.py +++ b/hyfetch/main.py @@ -89,6 +89,7 @@ def create_config() -> Config: :return: Config object (automatically stored) """ asc = get_distro_ascii() + asc_width, asc_lines = ascii_size(asc) title = 'Welcome to &b&lhy&f&lfetch&r! Let\'s set up some colors first.' clear_screen(title) @@ -96,7 +97,7 @@ def create_config() -> Config: # 0. Check term size try: term_len, term_lines = os.get_terminal_size().columns, os.get_terminal_size().lines - if term_len < 110 or term_lines < 30: + if term_len < 2 * asc_width + 4 or term_lines < 30: printc(f'&cWarning: Your terminal is too small ({term_len} * {term_lines}). \n' f'Please resize it for better experience.') input('Press any key to ignore...') @@ -246,7 +247,6 @@ def create_config() -> Config: fore_back = get_fore_back() # Calculate amount of row/column that can be displayed on screen - asc_width, asc_lines = ascii_size(asc) ascii_per_row = term_size()[0] // (asc_width + 2) ascii_rows = max(1, (term_size()[1] - 8) // asc_lines)