DontZap
in my XF86Config, I figured I would just use screen to compensate. This wasn't
enough, seeing as xterm -e screen would just start up a new screen
session completely ignoring the current detached ones and thus defeating the
purpose of using screen for convenience. Thus, I wrote a two line script to fix
this problem:
#!/bin/sh
SESSION=`screen -ls | grep '(Detached)$' | sed -ne '1p' | awk '{print $1}'`
[ -z "$SESSION" ] && screen || screen -x "$SESSION"
What this does is look for the first detached screen session listed by
screen -ls and use it to attach to. If there are no
currently-detached screen sessions running it'll start up a new one and running
your default shell.
Ok, so how is this useful? Put the script above in a file called "attach" and throw it in ~/bin/ (make that directory if you have to). Make sure you chmod 755 ~/bin/attach! Now change the way you open terminals in your windowmanager to:
xterm -e ~/bin/attach [other xterm opts here]
And you're good to go :)