gscreen design

In order to make screen and gnome-terminal communicate with each other, we first decided to change the screen program’s code to expose a library interface. However since:

1) screen’s code is old fashioned. i.e. it has many global variables which is not desirable for a shared library and

2) screen and g-t are under different licenses.

It is not feasible to make the screen program as a shared library object.

Thus we decided to have a third program as the messenger between g-t and screen. ”Pipes” (or file descriptors) are going to be used to read/write commands from/to screen. 

The flow would be:

When g-t is loaded, it will create an instance of screen with the pipe fd as its parameter. Screen would be modified so that each time a command is written to the pipe, it would react properly.Each terminal would have one instance of the screen fd. Each screen fd can have multiple sub-screens.

To make the pipe bidirectional we actually need two file descriptors:·  

screen –> g-t for:

o        Scroll back buffer contents,

o        Copy,

o        Get current screens,·

g-t –> screen for:

o        Create a new screen,

o        Switch screen,

o        Search,

 o        Paste,

o        Show tab for current screens

Notes: 

Semaphores will be used to prevent deadlock.

A protocol is also needed to make the communication happen.One endpoint of a pipe will write a command to it, the command will be read and interpreted by the other endpoint and proper reaction would be performed.

Protocol initial design:·

:newScreen  options (readonly/writeonly) \r\n· 

:switchTo  screenID \r\n·        

:copy numberOfChars \r\n data data ….data \r\n·

:paste numberOfChars \r\n data data … data \r\n·        

:find searchLiteral \r\n·        

:getScreens \r\n·        

:showTab screen1 options \r\n screen2 options \r\n  …

(To send commands to screen ‘-X’ option can be used.) 

2 Responses to “gscreen design”

  1. Monia Ghobadi » Blog Archive » Toward gscreen Says:

    [...] In order to use our pipe protocol described in gscreen design, a number of functions has been implemented in screen code so far: [...]

  2. Scrollable screen « Monia Ghobadi Says:

    [...] As shown a GNU Screen program is loaded inside vte and all scrolling features are transparent to vte. Scrolling is done using my implemented functions in screen and our pipe protocol described in gscreen design. [...]

Leave a Reply