From 1f81caf29f8a3cc1a1d34228c704367ad4b5cdbd Mon Sep 17 00:00:00 2001 From: SpookyDervish <78246495+SpookyDervish@users.noreply.github.com> Date: Sun, 26 Oct 2025 19:39:14 +1100 Subject: [PATCH] inbuilt terminal emulator is better on linux/macos now i need to test this on mac actually --- .gitignore | 3 +++ assets/style.tcss | 6 ++++++ main.py | 17 ++++++++++++----- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 36b13f1..49cf36b 100644 --- a/.gitignore +++ b/.gitignore @@ -174,3 +174,6 @@ cython_debug/ # PyPI configuration file .pypirc + +# virtual environment i use for testing +berry-venv \ No newline at end of file diff --git a/assets/style.tcss b/assets/style.tcss index ad0d123..5bf3f16 100644 --- a/assets/style.tcss +++ b/assets/style.tcss @@ -53,6 +53,12 @@ ContentSwitcher Vertical { } } +#terminal { + height: 35%; + min-height: 12; + margin: 1; +} + #find-window { width: 45; height: 11; diff --git a/main.py b/main.py index 7111f98..10d1f3c 100644 --- a/main.py +++ b/main.py @@ -7,6 +7,7 @@ from textual import on from assets.theme_mappings import theme_mappings from textual_fspicker import FileOpen, FileSave +from textual_terminal import Terminal import subprocess import os @@ -46,9 +47,12 @@ class Berry(App): ) yield TextArea.code_editor(placeholder="This file is empty.", language="python", theme="css", id="code-editor", disabled=True) - with Vertical(id="console-container"): - yield RichLog(id="console") - yield Input(placeholder="> ", id="console-input") + if os.name == "nt": + with Vertical(id="console-container"): + yield RichLog(id="console") + yield Input(placeholder="> ", id="console-input") + else: + yield Terminal(command="bash", id="terminal") yield Footer() @@ -270,8 +274,11 @@ class Berry(App): self.unsaved_files = {} # list of paths self.switching = False self.file_clicked = False - self.query_one("#console").write("Run a command below.") - + + if os.name == "nt": + self.query_one("#console").write("Run a command below.") + else: + self.query_one("#terminal").start() if __name__ == "__main__":