Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Scripting GNU Screen with Python (interstellr.com)
45 points by kwellman on Oct 11, 2010 | hide | past | favorite | 12 comments


No comments?! Oh come on! Well anyway I wrote quite a complicated configuration for zsh and screen some years ago. It displayed the last executed program as the title on screen, because the overview when pressing ctrl-a " doesn't help u much w/o meaningful titles. I did some more stuff too can't remember it.. anyway somehow I lost my configuration :( so I wonder if anybody is heavily using screen here?


I suppose I use screen heavily — I run it a lot, but usually forget that I am. When I connect to remote hosts, I use a script (which among various other things) runs:

  ssh -t remote.host.net screen -D -R -S "$(hostname)_$PPID"
Then if/when I lose the connection I hit [Up][Enter] to run the previous command. I get logged back in to the same screen session where my terminal session will still be running.

My screen configuration is mostly set up to hide that I'm running screen as much as possible. Rather than using screen's multiple windows I tend to ssh in multiple times and use a tiling window manager to manage the terminal windows. ssh ControlMaster stuff means I can still do everything over one network connection.

PS Whenever screen comes up on HN, someone mentions tmux. I haven't checked it out because my setup works for me, but new users might want to.


I use screen very heavily. One of my favourite although somewhat frivolous uses is running irssi on screen from my home box. I have irssi configured to set my status to away when the screen is detached and having the chat session be persistent is a huge help.

Also I've used screen as a poor mans daemon tools to run various apps in the background as a service. I even at one point had a skeleton init script that used screen to run any command as a daemon. I should see if I can find that actually and get it on github so I can find it the next time I need it.


> I have irssi configured to set my status to away when the screen is detached

How do you do that? I've tried looking at the documentation for irssi, and it's god-awful.


I have .screenrc_im

  source ~/.screenrc
  sessionname im
  bind ^D eval 'at naim stuff "/away Detached!\012"' 'at irssi stuff "/away Detached!\012"' 'detach'
  bind d eval 'at naim stuff "/away Detached!\012"' 'at irssi stuff "/away Detached!\012"' 'detach'
  screen -t naim naim
  screen -t irssi irssi
and a bash alias

  alias im='if detached im; then screen -S im -pirssi -X eval "stuff /away\012"; screen -S im -pnaim -X eval "stuff /away\012"; screen -r im; else screen -x im; fi;'



I would also love to know how you do this. I like being a good irc citizen, and I'm always forgetting to set my status.

[edit: see here - http://news.ycombinator.com/item?id=1781074]


I total agree about the meaningless titles. I ended up using http://www.pastacode.de/extending-gnu-screen-adding-a-taskba... to change the title to the current working directory and the program being executed.

Would be interested to hear your other tricks if you ever remember them ;)


I find more usefull to set title of each window manually because such titles makes more sence to me, especially with lots of windows.


My experience (albeit using screen mostly for horizontal and vertical screen splitting) is that:

screen < tmux < SizeUp (on a Mac)


I use screen in my production configuration. It is a pretty static setup, though. It is particularly essential to monitor production server where I could suddenly get disconnected.


I used to have my own fancy screen script, but now "byobu" does everything I need.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: