Wednesday, August 25, 2010

Copy Screen buffer in X Windows

Add the below line in .screenrc file and restart screen. xsel should be installed. Go to copy mode(Ctrl-o-[), select the text ( space, select, space ) and press "Ctrl-o-b"

bind b eval writebuf 'exec /bin/sh -c "xsel -i -b < /tmp/screen-exchange"' 'exec /bin/sh -c "killall xsel"'

Now you can paste the copied buffer from screen in any editor.

Note: For Mac writebuf should be pbcopy
Default screen options are Ctrl-a-. If you use the attached file, it will be Ctrl-o-

autodetach on # Autodetach conference on hangup instead of [.]
escape ^Oo
shelltitle "$ |bash"
vbell off
screen -t rcs 1
startup_message off
defscrollback 5000
hardstatus on
hardstatus alwayslastline
hardstatus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a "
bind b eval writebuf 'exec /bin/sh -c "xsel -i -b < /tmp/screen-exchange"' 'exec /bin/sh -c "killall xsel"'

No comments: