|
3 | 3 | # Copyright (C) 2022 |
4 | 4 | # Licensed under the GPLv3 or later. |
5 | 5 | # |
6 | | -import os, random, shutil, socket, subprocess, threading, time |
| 6 | +import multiprocessing, os, random, shutil, socket, subprocess, threading, time |
7 | 7 |
|
8 | 8 | from tkinter import * |
9 | 9 | from PIL import Image, ImageTk |
@@ -173,21 +173,18 @@ def __init__(self, targetHost: str, targetPort: int, log: LoggerAdapter): |
173 | 173 | self._launch_rdp_server() |
174 | 174 |
|
175 | 175 | def _launch_display(self, width=1920, height=1080): |
176 | | - self.display = Display( |
177 | | - backend="xephyr", |
178 | | - size=(width, height), |
179 | | - extra_args=["-no-host-grab", "-noreset"], |
180 | | - ) # noreset for xsetroot required |
| 176 | + self.display = Display(backend="xvfb", size=(width, height)) |
181 | 177 | self.display.start() |
| 178 | + # activate environment variables |
182 | 179 | self.display.env() |
183 | 180 | # set background to windows blue |
184 | | - self.xsetroot_process = subprocess.Popen( |
185 | | - [ |
186 | | - shutil.which("xsetroot"), |
187 | | - "-solid", |
188 | | - BACKGROUND_COLOR, |
189 | | - ] |
190 | | - ) |
| 181 | + def background(): |
| 182 | + tk = Tk() |
| 183 | + tk.geometry(f"{width}x{height}") |
| 184 | + tk.configure(bg=BACKGROUND_COLOR) |
| 185 | + tk.mainloop() |
| 186 | + |
| 187 | + multiprocessing.Process(target=background).start() |
191 | 188 |
|
192 | 189 | def _launch_rdp_server(self): |
193 | 190 | # TODO check if port is not already taken |
|
0 commit comments