Skip to content

Commit

Permalink
Catch exception when init colors in TMUX
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolargo committed May 15, 2024
1 parent d8c5a72 commit 0447e21
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions glances/outputs/glances_curses.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,13 @@ def _init_colors(self):
self.filter_color = curses.color_pair(9) | A_BOLD
self.selected_color = curses.color_pair(10) | A_BOLD
# Define separator line style
curses.init_color(11, 500, 500, 500)
curses.init_pair(11, curses.COLOR_BLACK, -1)
self.separator = curses.color_pair(11)

try:
curses.init_color(11, 500, 500, 500)
curses.init_pair(11, curses.COLOR_BLACK, -1)
self.separator = curses.color_pair(11)
except Exception:
# Catch exception in TMUX
pass
else:
# The screen is NOT compatible with a colored design
# switch to B&W text styles
Expand Down

0 comments on commit 0447e21

Please sign in to comment.