Skip to content

Commit 2e2f2d5

Browse files
committed
Adding button to toggle fullscreen in noVNC console
1 parent f38db8a commit 2e2f2d5

1 file changed

Lines changed: 22 additions & 13 deletions

File tree

systemvm/agent/noVNC/vnc_lite.html

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,13 @@
4141
#status {
4242
text-align: center;
4343
}
44-
#sendCtrlAltDelButton {
45-
position: fixed;
46-
top: 0px;
47-
right: 0px;
48-
border: 1px outset;
49-
padding: 5px 5px 4px 5px;
50-
cursor: pointer;
44+
#container {
45+
display: flex;
46+
justify-content: space-between;
5147
}
52-
#sendCtrlEscButton {
53-
position: fixed;
54-
top: 0px;
55-
left: 0px;
48+
#sendCtrlAltDelButton, #sendCtrlEscButton, #toggleFullScreenButton {
49+
vertical-align: top;
50+
display: inline-block;
5651
border: 1px outset;
5752
padding: 5px 5px 4px 5px;
5853
cursor: pointer;
@@ -88,6 +83,7 @@
8883

8984
let rfb;
9085
let desktopName;
86+
let fullScreen = false;
9187

9288
// When this function is called we have
9389
// successfully connected to a server
@@ -130,6 +126,12 @@
130126
return false;
131127
}
132128

129+
function toggleFullScreen() {
130+
fullScreen = !fullScreen
131+
rfb.scaleViewport = fullScreen
132+
return false;
133+
}
134+
133135
// Show a status text in the top bar
134136
function status(text) {
135137
document.getElementById('status').textContent = text;
@@ -162,6 +164,9 @@
162164
document.getElementById('sendCtrlEscButton')
163165
.onclick = sendCtrlEsc;
164166

167+
document.getElementById('toggleFullScreenButton')
168+
.onclick = toggleFullScreen;
169+
165170
// Read parameters specified in the URL query string
166171
// By default, use the host and port of server that served this file
167172
const host = readQueryVariable('host', window.location.hostname);
@@ -209,8 +214,12 @@
209214
<body>
210215
<div id="top_bar">
211216
<div id="status">Loading</div>
212-
<div id="sendCtrlAltDelButton">Send CtrlAltDel</div>
213-
<div id="sendCtrlEscButton">Send CtrlEsc</div>
217+
<br />
218+
<div id="container" >
219+
<div id="sendCtrlAltDelButton">Send CtrlAltDel</div>
220+
<div id="toggleFullScreenButton">Toggle Fullscreen</div>
221+
<div id="sendCtrlEscButton">Send CtrlEsc</div>
222+
</div>
214223
</div>
215224
<div id="screen">
216225
<!-- This is where the remote screen will appear -->

0 commit comments

Comments
 (0)