@@ -129,7 +129,7 @@ func (pm *ProcessManager) Stop() {
129129 pm .mu .Unlock ()
130130}
131131
132- func buildOverlayElement (id string , zIndex int , path string , width , x , y , volume * int ) (string , string , string ) {
132+ func buildOverlayElement (id string , zIndex int , path string , width , height , x , y , volume * int ) (string , string , string ) {
133133 if path == "" {
134134 return "" , "" , ""
135135 }
@@ -148,6 +148,9 @@ func buildOverlayElement(id string, zIndex int, path string, width, x, y, volume
148148 if width != nil {
149149 style += fmt .Sprintf ("width: %dpx; " , * width )
150150 }
151+ if height != nil {
152+ style += fmt .Sprintf ("height: %dpx; " , * height )
153+ }
151154 style += "}\n "
152155
153156 var element string
@@ -199,11 +202,19 @@ func (pm *ProcessManager) manageOverlays(cfg *models.Config) {
199202
200203 if shouldStart {
201204 cs := cfg .Input .ChromiumSource
202- bgColor := "transparent "
205+ bgColor := "#00FF00 "
203206 if cs .Z1BgColor != "" {
204207 bgColor = cs .Z1BgColor
205208 }
206209
210+ resParts := strings .Split (cfg .Input .Resolution , "x" )
211+ resWidth := "1920"
212+ resHeight := "1080"
213+ if len (resParts ) == 2 {
214+ resWidth = resParts [0 ]
215+ resHeight = resParts [1 ]
216+ }
217+
207218 // Generate HTML file
208219 htmlContent := `<!DOCTYPE html>
209220<html>
@@ -217,51 +228,57 @@ func (pm *ProcessManager) manageOverlays(cfg *models.Config) {
217228 var scripts string
218229
219230 if cs .Z1Active {
220- s , e , sc := buildOverlayElement ("z1" , 1 , cs .Z1Path , cs .Z1Width , cs .Z1X , cs .Z1Y , cs .Z1Volume )
231+ s , e , sc := buildOverlayElement ("z1" , 1 , cs .Z1Path , cs .Z1Width , cs .Z1Height , cs . Z1X , cs .Z1Y , cs .Z1Volume )
221232 htmlContent += s
222233 elements += e
223234 scripts += sc
224235 }
225236 if cs .Z2Active {
226- s , e , sc := buildOverlayElement ("z2" , 2 , cs .Z2Path , cs .Z2Width , cs .Z2X , cs .Z2Y , cs .Z2Volume )
237+ s , e , sc := buildOverlayElement ("z2" , 2 , cs .Z2Path , cs .Z2Width , cs .Z2Height , cs . Z2X , cs .Z2Y , cs .Z2Volume )
227238 htmlContent += s
228239 elements += e
229240 scripts += sc
230241 }
231242 if cs .Z3Active {
232- s , e , sc := buildOverlayElement ("z3" , 3 , cs .Z3Path , cs .Z3Width , cs .Z3X , cs .Z3Y , cs .Z3Volume )
243+ s , e , sc := buildOverlayElement ("z3" , 3 , cs .Z3Path , cs .Z3Width , cs .Z3Height , cs . Z3X , cs .Z3Y , cs .Z3Volume )
233244 htmlContent += s
234245 elements += e
235246 scripts += sc
236247 }
237248 if cs .Z4Active {
238- s , e , sc := buildOverlayElement ("z4" , 4 , cs .Z4Path , cs .Z4Width , cs .Z4X , cs .Z4Y , cs .Z4Volume )
249+ s , e , sc := buildOverlayElement ("z4" , 4 , cs .Z4Path , cs .Z4Width , cs .Z4Height , cs . Z4X , cs .Z4Y , cs .Z4Volume )
239250 htmlContent += s
240251 elements += e
241252 scripts += sc
242253 }
243254 if cs .Z5Active {
244- s , e , sc := buildOverlayElement ("z5" , 5 , cs .Z5Path , cs .Z5Width , cs .Z5X , cs .Z5Y , cs .Z5Volume )
255+ s , e , sc := buildOverlayElement ("z5" , 5 , cs .Z5Path , cs .Z5Width , cs .Z5Height , cs . Z5X , cs .Z5Y , cs .Z5Volume )
245256 htmlContent += s
246257 elements += e
247258 scripts += sc
248259 }
249260 if cs .Z6Active {
250- s , e , sc := buildOverlayElement ("z6" , 6 , cs .Z6Path , cs .Z6Width , cs .Z6X , cs .Z6Y , cs .Z6Volume )
261+ s , e , sc := buildOverlayElement ("z6" , 6 , cs .Z6Path , cs .Z6Width , cs .Z6Height , cs . Z6X , cs .Z6Y , cs .Z6Volume )
251262 htmlContent += s
252263 elements += e
253264 scripts += sc
254265 }
255266 if cs .Z7Active {
256- s , e , sc := buildOverlayElement ("z7" , 7 , cs .Z7Path , cs .Z7Width , cs .Z7X , cs .Z7Y , cs .Z7Volume )
267+ s , e , sc := buildOverlayElement ("z7" , 7 , cs .Z7Path , cs .Z7Width , cs .Z7Height , cs .Z7X , cs .Z7Y , cs .Z7Volume )
268+ htmlContent += s
269+ elements += e
270+ scripts += sc
271+ }
272+ if cs .Z8Active {
273+ s , e , sc := buildOverlayElement ("z8" , 8 , cs .Z8Path , cs .Z8Width , cs .Z8Height , cs .Z8X , cs .Z8Y , cs .Z8Volume )
257274 htmlContent += s
258275 elements += e
259276 scripts += sc
260277 }
261278
262279 htmlContent += `</style>
263280</head>
264- <body style="margin: 0; padding: 0;">
281+ <body style="margin: 0; padding: 0; width: ` + resWidth + `px; height: ` + resHeight + `px; ">
265282`
266283 htmlContent += elements
267284 if scripts != "" {
@@ -295,18 +312,10 @@ func (pm *ProcessManager) manageOverlays(cfg *models.Config) {
295312 }
296313 }
297314
298- resParts := strings .Split (cfg .Input .Resolution , "x" )
299- width := "1920"
300- height := "1080"
301- if len (resParts ) == 2 {
302- width = resParts [0 ]
303- height = resParts [1 ]
304- }
305-
306- cmd := exec .Command ("xvfb-run" , serverNum , fmt .Sprintf ("--server-args=-screen 0 %sx%sx24 -ac" , width , height ),
315+ cmd := exec .Command ("xvfb-run" , serverNum , fmt .Sprintf ("--server-args=-screen 0 %sx%sx24 -ac" , resWidth , resHeight ),
307316 chromeBin , "--kiosk" , "--disable-infobars" , "--disable-extensions" , "--test-type" ,
308- fmt .Sprintf ("--window-size=%s,%s" , width , height ), "--window-position=0,0" , "--hide-scrollbars" ,"--no-sandbox" , "--disable-dev-shm-usage" ,
309- "--autoplay-policy=no-user-gesture-required" , fileURL )
317+ fmt .Sprintf ("--window-size=%s,%s" , resWidth , resHeight ), "--window-position=0,0" , "--hide-scrollbars" ,"--no-sandbox" , "--disable-dev-shm-usage" ,
318+ "--autoplay-policy=no-user-gesture-required" , "--force-device-scale-factor=1" , fileURL )
310319
311320 err = cmd .Start ()
312321 if err != nil {
0 commit comments