Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to run streamripper in its own X Terminal (window), then split the terminal horizontally, and then run mplayer in the lower half.
This is simple enough to do manually, but getting a script to do it eludes me.

mplayer cannot be allowed to run immediately. It needs to wait for stream data, so a test for this would be better than "wait x seconds" (which is effectively what the manual method does.

If the terminal is significant to this, anything will do, but I currently have installed konsole, gnome-terminal, and terminator (in Ubuntu)

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Although some terminal programs have support for splitting, you won't be able to access this functionality from the shell which is running in a different layer and doesn't have access to the software displaying it.

What you can do is use a terminal multiplexer such as GNU Screen or tmux that allow you to run multiple shells in "panes" inside a console.

Screen has been around since the dawn of time and works, but lately the project has falled into dis-repair and it's not being well maintained. Tmux is kind of a new player on the scene but the code is very clean and mature, it has a few more features than screen, and it's a good deal easier to learn and configure. Even though I still use screen out of force of habit, I highly recomend you use tmux for this.

You should be able to write a script that launches a tmux session, runs your streamripper code in one pane, waits for a condition, then adds another pane to the same session, displays it as a split screen, then runs mplayer in the new pane.

share|improve this answer
    
If I have time later I'll add some sample code for a script that does something like this in tmux. –  Caleb Jul 1 '11 at 8:27
    
I'm quite new to screen, but I have tried it. My impression is that even when the console is closed, any running shell app keeps running. Is there some way to avoid this behaviour (maybe it is just a simple screen option), because I don't want to inadvertently have streamripper chugging away "windowless" because I forgot it was running as a screen session.. It can chew up a lot of data over a few days... –  Peter.O Jul 1 '11 at 8:41
    
I've just read your info about tmux...I'll have a look at it... –  Peter.O Jul 1 '11 at 8:45
    
@fred: I'm not sure about screen since I would never dream of killing a screen session if the terminal goes way, but I'm pretty sure I saw something like that when I was reviewing tmux docs. Basically an action to run when the session gets detached. You could always script this too ... it's easy to get a list of detached sessions and you could use a cron job to clean them up or warn you about them so you could choose to let them run or reconnect to close them. –  Caleb Jul 1 '11 at 8:53
    
Thanks... It seems that I got that minor phobia from when I first experimented with screen, when I actually wanted a detachment... I've briefly tried both screen and tmux again with this in mind.. and it seems fine; as you mentioned. It requires actual and obvious action on my part to either kill or detach the session, –  Peter.O Jul 1 '11 at 9:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.