Skip to content

Commit 4e11bb3

Browse files
committed
Add in detection for screen
I did this a while ago, and it seems to be in a branch on two machines, but not in main and not actually in the repo, for some odd reason. Either way, this seems worth having...
1 parent 45f8f12 commit 4e11bb3

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/textual_dev/tools/diagnose.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,17 @@ def _guess_term() -> str:
9393
if term_version is not None:
9494
term_program = f"{term_program} ({term_version})"
9595

96-
return "*Unknown*" if term_program is None else term_program
96+
# Seems we can't work this out.
97+
if term_program is None:
98+
term_program = "*Unknown*"
99+
100+
# Check for running under screen. As you look at this you might think
101+
# "what about tmux too?" -- good point; but we'll be picking up tmux as
102+
# the terminal type, because of how it takes over TERM_PROGRAM.
103+
if "STY" in os.environ:
104+
term_program += " (inside screen)"
105+
106+
return term_program
97107

98108

99109
def _env(var_name: str) -> str:

0 commit comments

Comments
 (0)