You are not logged in.

#1 2018-04-13 03:13:18

Narcher023
Member
Registered: 2018-04-13
Posts: 7

Enter Into Parent Process [SOLVED]

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

#2 2018-04-13 07:20:44

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,435

Re: Enter Into Parent Process [SOLVED]

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

#3 2018-04-14 17:10:05

Narcher023
Member
Registered: 2018-04-13
Posts: 7

Re: Enter Into Parent Process [SOLVED]

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

#4 2018-04-14 17:17:25

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: Enter Into Parent Process [SOLVED]

Please use [code⁣] tags when posting commands/scripts...

CoC - Pasting pictures and code


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#5 2018-04-14 17:25:32

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,543
Website

Re: Enter Into Parent Process [SOLVED]

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

#6 2018-04-14 17:42:30

Narcher023
Member
Registered: 2018-04-13
Posts: 7

Re: Enter Into Parent Process [SOLVED]

That's what I was afraid of.  I might try with tmux then.  Thanks.

Offline

#7 2018-04-14 17:47:11

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,543
Website

Re: Enter Into Parent Process [SOLVED]

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 \; \
    attach

Replace $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

#8 2018-04-14 19:19:11

Narcher023
Member
Registered: 2018-04-13
Posts: 7

Re: Enter Into Parent Process [SOLVED]

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

Board footer

Powered by FluxBB