My OS is Linux. I use FISH shell with Alacritty terminal emulator. I want to write a Python code which splits the terminal in two, separating them with "|" characters, and having user be prompted on both sides. Kind of like how Tilix does it, I want it all to be text because I have old PC with Arch Linux on it and no DE or WM, just the terminal. I want to use tiling functionality there.
I have tried: os.system("fish")
to prompt the user but I want to be able to manipulate the terminal output. It would be useful to somehow run the command In background using Python threading library and constantly read the command output, modify it and output it to the user. I have tried: os.popen("echo hi").read()
which returns "hi\n" but when I tried os.popen("cmatrix")
the program just hangs. os.popen waits for the command to finish executing. I want to get the output during its runtime.
Is it possible to achieve that? My biggest problem is reading the output of running commands. Its not required to use os library.