Skip to content

Commit 6193f47

Browse files
committed
Additional fixes for WSLg and Ubuntu 20.04
1 parent d9b0adb commit 6193f47

File tree

4 files changed

+11
-21
lines changed

4 files changed

+11
-21
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ To understand how to use AutoSplit and how it works in-depth, please read the [t
4343
### Compatibility
4444

4545
- Windows 10 and 11.
46-
- Linux (still in early development) <!-- (Only tested on Ubuntu 22.04) -->
46+
- Linux (still in early development)
47+
- Should work on Ubuntu 20.04+ (Only tested on Ubuntu 22.04)
4748
- Wayland is not currently supported
4849
- WSL2/WSLg requires an additional Desktop Environment, external X11 server, and/or systemd
4950
- Python 3.10+ (Not required for normal use. Refer to the [build instructions](/docs/build%20instructions.md) if you'd like run the application directly in Python).

scripts/install.ps1

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ $dev = If ($Env:GITHUB_JOB -eq 'Build') { '' } Else { '-dev' }
3434
If ($IsLinux) {
3535
If (-not $Env:GITHUB_JOB -or $Env:GITHUB_JOB -eq 'Build') {
3636
sudo apt-get update
37-
# python3-tk for splash screen the rest for PySide6
38-
sudo apt-get install -y python3-pip python3-tk libegl1 libxkbcommon0
37+
# python3-tk for splash screen, libxcb-cursor-dev for QT_QPA_PLATFORM=xcb, the rest for PySide6
38+
sudo apt-get install -y python3-pip python3-tk libxcb-cursor-dev libegl1 libxkbcommon0
3939
# having issues with npm for pyright, maybe let users take care of it themselves? (pyright from pip)
4040
}
4141
}
@@ -52,13 +52,6 @@ If ($IsLinux) {
5252
# Even then, PyPI with Pillow>=7.2.0 will install 0.1.3 instead of 0.1.5
5353
&"$python" -m pip install PyAutoGUI "D3DShot>=0.1.5 ; sys_platform == 'win32'" --no-deps --upgrade
5454

55-
# Because Ubuntu 22.04 is forced to use an older version of PySide6, we do a dirty typing patch
56-
# https://bugreports.qt.io/browse/QTBUG-114635
57-
If ($IsLinux) {
58-
$libPath = &"$python" -c 'import PySide6 as _; print(_.__path__[0])'
59-
(Get-Content "$libPath/QtWidgets.pyi").replace('-> Tuple:', '-> Tuple[str, ...]:') |
60-
Set-Content "$libPath/QtWidgets.pyi"
61-
}
6255
# Uninstall optional dependencies if PyAutoGUI or D3DShot was installed outside this script
6356
# PyScreeze -> pyscreenshot -> mss deps call SetProcessDpiAwareness, used to be installed on Windows
6457
# Pillow, pygetwindow, pymsgbox, pytweening, MouseInfo are picked up by PySide6

src/AutoSplit.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/python3
22

3+
import os
34
import sys
45

56
# Prevent PyAutoGUI and pywinctl from setting Process DPI Awareness, which Qt tries to do then throws warnings about it.
@@ -15,14 +16,16 @@
1516
ctypes.windll.shcore.SetProcessDpiAwareness = ( # pyright: ignore[reportAttributeAccessIssue]
1617
lambda _: None # pyright: ignore[reportUnknownLambdaType]
1718
)
19+
if sys.platform == "linux":
20+
# Fixes "undefined symbol: wl_proxy_marshal_flags": https://bugreports.qt.io/browse/QTBUG-114635
21+
os.environ.setdefault("QT_QPA_PLATFORM", "xcb")
1822

19-
import os
2023
import signal
2124
from collections.abc import Callable
2225
from copy import deepcopy
2326
from time import time
2427
from types import FunctionType
25-
from typing import NoReturn, cast
28+
from typing import NoReturn
2629

2730
import cv2
2831
from cv2.typing import MatLike
@@ -967,8 +970,7 @@ def set_preview_image(qlabel: QLabel, image: MatLike | None):
967970
capture = image
968971

969972
qimage = QtGui.QImage(
970-
# Try to update PySide6, see https://bugreports.qt.io/browse/QTBUG-114635
971-
cast(bytes, capture.data) if sys.platform == "linux" else capture.data,
973+
capture.data,
972974
width,
973975
height,
974976
width * channels,

src/region_selection.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os
21
import sys
32
from math import ceil
43
from typing import TYPE_CHECKING
@@ -8,6 +7,7 @@
87
from cv2.typing import MatLike, Point
98
from PySide6 import QtCore, QtGui, QtWidgets
109
from PySide6.QtTest import QTest
10+
from pywinctl import getTopWindowAt
1111
from typing_extensions import override
1212

1313
import error_messages
@@ -33,12 +33,6 @@
3333
if sys.platform == "linux":
3434
from Xlib.display import Display
3535

36-
# This variable may be missing in desktopless environment. x11 | wayland
37-
os.environ.setdefault("XDG_SESSION_TYPE", "x11")
38-
39-
# Must come after the linux XDG_SESSION_TYPE environment variable is set
40-
from pywinctl import getTopWindowAt
41-
4236
if TYPE_CHECKING:
4337
from AutoSplit import AutoSplit
4438

0 commit comments

Comments
 (0)