Wednesday, January 31, 2007

Screen Tabs


Well enough of my ranting about gnome lets get some work done. Lets make Screen functional.
Here is what I can screen tabs. Rather than using hotkeys to switch between screens you can now see all open screen sessions and switch to them with the F keys. (If you choose to do so.)

# binding the F1 - F8 keys to the first 8 screens, F11 = previous | F12 = next
bindkey -k k1 select 0
bindkey -k k2 select 1
bindkey -k k3 select 2
bindkey -k k4 select 3
bindkey -k k5 select 4
bindkey -k k6 select 5
bindkey -k k7 select 6
bindkey -k k8 select 7
bindkey -k F2 next
bindkey -k F1 prev

# Optional name and command to execute
screen -t irssi 1 irssi
screen -t mp3 2 mp3blaster
screen -t linux 3
screen -t linux 4
screen -t user 5
screen -t admin 6 su

# Display $USER and screen titles in a neat way :P
caption always "%{=b dy}{ %{= dm}${USER} %{=b dy}}%={ %?%{= dc}%-Lw%?%{+b dy}(%{-b r}%n:%t%{+b dy})%?(%u)%?%{-dc}%?%{= dc}%+Lw%? %{=b dy}}"


There are pros and cons of using screen this way.
Good: Run multiple screens with one command. Have the screen titles in constant view. Keybindings are always great!
Bad: If you want only one screen session you'll always have the number you put in screenrc. If you assign a command to execute it will execute each and everytime you run screen. If your a KDE user the "F1" key is already reserved. The same might go for other Desktop's.
Also I know there is a application called Screenie, that is a wrapper for screen. It can manage screen but does it in a different way. Visit the link for more info.

2 comments:

Anonymous said...

thanks, good idea. but i have shifted F0¿?->F1, i have to review.

First value i assign a 1, and solved, i don't use the 0 screen terminal.

Best Regards.

Jeff Singleton said...

Thanks for this. A quick search for Screen with Tabs and this page comes right up.

Although, in the screenrc example - you show F1 and F2 and being configured for PREV and NEXT but in the comment above that section you mention F11 and F12.