You are not logged in.
Pages: 1
Hello, I am new to Arch and am still making configurations to my system. I am trying to write a Bash script in Tilix that would first divide the terminal into two parts vertically left and right. It would then run htop in the right section. Then it would switch back over to the left section, then divide it horizontally into upper and lower terminals. The issue I am having is that I cannot seem to figure out how to enter back into the left section to divide it using Bash. I want to be able to use a script to do this because I want to be able run a single command and have a new tilix session set up the way I need it. I assume that when I am dividing the terminal vertically, the left terminal is a parent of the right terminal. If so, how would I switch over to the parent terminal? If what I stated is not the case, is there another way to switch to the left terminal?
Last edited by Narcher023 (2018-04-18 23:35:28)
Offline
Post your script, you lose control of the bash shell/script as soon as you run htop (unless backgrounded). Any reason you aren't simply doing the reverse? set up the shell parts and then as the final act start htop?
Offline
This is what I have so far.
#!/bin/bash
##################################################
## ##
## Personal Setup for Working in Tilix ##
## Includes htop Window ##
## ##
##################################################
tilix -a app-new-session --profile=Nick_Dark
tilix -a session-add-right -e htop
Here is what I am looking for.
______________________________________________________________________________
| | |
| | |
| ARCH LOGO | |
| AND | |
| SYSTEM INFORMATION | |
| | |
| | |
| | |
| | |
|______________________________________| HTOP |
| | |
| | |
| | |
| | |
| WORK SPACE | |
| | |
| | |
| | |
| | |
|_____________________________________ |_______________________________________|
The problem is:
a) I have to split the screen along the vertical line first.
b) Tilix puts me in the right screen after I split the terminal.
c) I need to be in the left terminal to split that portion horizontally into two parts.
d) I need to end up back in the right screen to start HTOP.
e) I need something that can be done using a scripting language so that I can create
this with a single command. Bash is fine. Python is fine. Even a C executable
would be fine. I just need something that I can create run as a single alias in .bashrc.
What would I need to do to be able to switch terminals using code. Also, would you suggest a different approach for building this?
Offline
Please use [code] tags when posting commands/scripts...
Offline
This has nothing to do with "entering the parent process" nor is it really a scripting issue. This is simply a limitation of tilix. Do you have to do this with tilix? It doesn't have a command (in it's man page, at least) for setting the focus to a different pane/window which is what you would need (that or an "add-left" where it only has "add-right" and "add-down"). This, however, would be trivial with either screen or tmux.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
That's what I was afraid of. I might try with tmux then. Thanks.
Offline
Here it is for tmux
$TERMINAL -e tmux -L $somename new-session -d "htop" \; \
split-window -hb \; \
split-window -b "$info_script" \; \
select-pane -D \; \
attachReplace $TERMINAL with whatever terminal you want to launch this in, or just remove the '$TERMINAL -e' to launch this within the current terminal session.
Replace $somename with any arbitrary name you'd like to give your tmux socket. Strictly speaking, this (with it's -L flag) is optional, but without it weird things can happen if you try to use other instances of tmux on the same machine.
Lastly, replace $info_script with whatever you want running in the upper left pane.
Alternatively, if you don't have any other use for tmux, this can all be done from ~/.tmux.conf instead, then in any terminal, just run `tmux` and you'll start with your pre-defined panes with everything you want running already there.
Last edited by Trilby (2018-04-14 17:48:32)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I got it to work. For some reason it didn't want to open "htop" when opening a new terminal, so I just set it up to run the script inside the terminal I want to run.
Offline
Pages: 1