Skip to main content

Module screen

Module screen 

Source
Expand description

Screen mode: a Browser pane whose browser is an ordinary, visible Chrome on a virtual X screen, with nothing attached to it. The pane gets the same frames and sends the same messages as the streamed browser (pane.rs, protocol.rs), but a frame is the whole screen (the browser’s own tab strip and address bar included) and input goes to the screen as a person’s mouse and keyboard would, so the browser does not report itself as remote-controlled (Chromium turns that report on for a debugging pipe, an automation or headless switch). A prototype for the decision in task 48354: no agent driving, no windows list, a US keyboard. The screen follows the pane’s size (randr).

Modules§

clipboard 🔒
The clipboard of the virtual screen (the X selection CLIPBOARD), shared with the person’s own on their say-so only. A paste from the person is offered here as the screen’s clipboard and Ctrl+V is pressed, so the browser reads the exact text (any letter, any length up to the limit) instead of having it typed key by key; the offer ends a moment later. A copy is read out only when the person asks for it (they pressed Ctrl+C or Ctrl+X in the pane): the text the browser put on the screen’s clipboard goes to the pane, which puts it on the person’s. Nothing reads the screen’s clipboard on its own, and no agent is involved.
ewmh 🔒
The browser’s window fills the virtual screen, and keeps filling it when the screen changes size. Chrome’s own --start-maximized does not make the window manager’s window maximised here, so a window that is not maximised stays the size it was; the maximise is the window manager’s own request (EWMH _NET_WM_STATE), the same one a person’s maximise button makes. Nothing here reaches into the browser.
frames 🔒
A frame of the virtual screen as the pane wants it: the same kind byte and JPEG the streamed browser sends (pane.rs), made only when the screen changed since the last one that was sent. The screen says which part of it changed (the damage extension), so only that part is read; the picture of the whole screen is kept here and each change is written into it.
held 🔒
The modifier keys the person is holding down on the screen. A paste is typed key by key; with Control held (the paste itself is Ctrl+V) every letter would be a shortcut (a selects all, w closes the tab). So while text is typed the held modifiers are let go, and pressed again after.
keymap 🔒
Keys as the X server numbers them. The pane sends a key’s DOM code (the physical key: KeyA, ArrowLeft); the X server under Xvfb numbers keys as Linux does plus 8. Layout is US: a key is the key at that place, not the letter a layout would give it.
pace 🔒
How often a frame may be made. A screen that does not change makes none; one that does is capped at a steady rate, except just after the person typed or clicked: then the next pictures come at once and quickly for a short while, so the typing is seen as it happens.
policy 🔒
What the browser may open. The streamed pane blocks local files and the browser’s own pages through the debugging channel (pane.rs, BLOCKED_URLS); in screen mode a person has the browser’s own address bar, so the block is the browser’s managed policy, which the browser reads before it starts. Screen mode does not start without it. This server only checks that the policy is there: the file is system-wide (every browser of that kind on the machine reads it), so whoever runs the machine or builds its image installs it.
randr 🔒
A person resizes the pane: the virtual screen follows (the RANDR extension), and the browser’s maximised window with it. Xvfb can make its screen smaller or bigger only up to the size it was started with, so a session starts the screen at MAX_W by MAX_H and sets it to the pane’s size at once, and every later resize is a new mode of that screen. Nothing here attaches to the browser.
session 🔒
One screen-mode session: a virtual X screen, a window manager (when the server has one) and an ordinary Chrome on it, started the way a person starts Chrome: no debugging pipe or port, no automation or headless switch, no script put into a page. The only extra arguments are a window size and the page to open (the network is the browser’s managed policy). The browser’s own sandbox is always on: no switch turns it off, and a server asked to start without it refuses.
watch 🔒
The screen’s windows, as the person would count them. A window the browser opens by itself (a pop-up) shows on the screen as it would on a person’s desktop; what srv adds is what the streamed pane does for the same event (windows.rs): a notice, and the keys held for a moment so what is being typed does not go to the new window by mistake.
wm 🔒
The window manager’s settings. A pane’s client sends keys and mouse buttons at screen level, so whatever the window manager binds to a key or a button, the client can use: a stock Openbox has a root menu that starts programs on the server and an Alt-drag that moves a window. This configuration binds nothing: no keyboard shortcut, no mouse action, an empty menu, and no frame on any window (so there is no title bar to drag and no button to press). The window manager is there to give the browser the focus and to place its windows; the browser is the only program a client can reach.
x 🔒
The virtual X screen: its pixels read out, and pointer and key events sent to it at screen level (the XTEST extension: the same events a person’s mouse and keyboard make). Nothing here attaches to the browser; the browser is a program on a screen.

Structs§

Place 🔒
A place among the open sessions, given back when it is dropped (however the session ended).

Enums§

Typed 🔒
How typing ended: all of the text was typed, or it stopped because the person’s screen changed under it.

Constants§

ADDRESS_BAR_FOCUS_MS 🔒
How long to wait after Ctrl+L before typing an address.
ENABLE_ENV
1 in the environment turns screen mode on (with the streamed browser on, and the pane asking for mode=screen).
FPS 🔒
Frames per second at most; a screen that did not change makes none.
MAX_ENV
The setting that allows more than one screen session at once, up to MAX_SESSIONS (a test host).
MAX_SESSIONS 🔒
At most this many screen panes at once: each is a browser and a screen of its own.
MAX_TYPED 🔒
The longest paste that is typed key by key.

Statics§

OPEN 🔒

Functions§

button_number 🔒
capture 🔒
The screen’s frames, made on a thread of their own (reading and encoding a screen is work that must not hold up input). The screen says when a part of it changed: nothing is read while it is still, so a page that is not moving costs next to nothing. A change is read where it happened and written into the picture of the whole screen, and a frame is made only if some pixel really differs. Frames are at most FPS a second, but come at once and quickly just after the person’s input (pace).
copy_out 🔒
What the browser copied, for the pane (which puts it on the person’s clipboard): asked for by the person (Ctrl+C or Ctrl+X in the pane). None when the browser has copied nothing.
enabled
error 🔒
limit
Screen mode holds its browser’s policy in the folder of the container (or dedicated machine) it runs in, so a server with screen mode on serves no streamed browser (the two would share one policy file) and, by default, one screen session: a hosted task holds one browser. A test host may allow more with MAX_ENV.
navigate 🔒
Back, forward, reload and stop are the browser’s own keys; an address is typed into its address bar.
notches 🔒
How many wheel notches a scroll of delta pixels is (the pane sends 100 to 120 a notch).
on_client 🔒
One message from the pane, sent to the screen. A word for the pane when there is one to say. While keys_held, a key press or a paste is dropped (a window just opened that the person did not choose); a release still goes, so no key is left down.
paste_exact 🔒
Paste text exactly: offer it as the screen’s clipboard and press Ctrl+V (the other modifiers the person holds are let go for the while, and pressed again). The offer ends a moment later, so nothing stays on the screen’s clipboard for the browser to read on its own.
run 🔒
Run one pane until its socket closes, its screen goes, or the sign-in behind it ends.
send_input 🔒
send_without_modifiers 🔒
Send msg with the modifier keys in held let go for the while, then pressed again, so what the person still holds stays held.
size_message 🔒
tap 🔒
Press and release a key, with Shift when it needs it.
type_chars 🔒
The typing itself: stop is asked before every character, press types one key (with Shift or not).
type_text 🔒
Type text key by key. A character with no US key is skipped; the text is cut at MAX_TYPED characters. When a window opens while it is being typed, the rest is dropped: it was meant for the window the person was looking at.
upgrade
Upgrade to the pane’s WebSocket and run a screen session until it ends (or ended does).
watch_windows 🔒
How many windows the screen shows, told whenever it changes: at the moment a window is mapped or unmapped (the screen’s own events, on a thread of its own), so what is typed after a window opens is held from that moment.