summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2022-08-23 17:58:09 +0200
committerFlorian Bruhin <me@the-compiler.org>2022-08-23 17:58:09 +0200
commit3dd969e731cdac7bf3bdccc38d779390297966af (patch)
tree3db8d4b4583c3d3042875c266d25e99e2a087c10
parent6195cfabdbd78d283ea0451fc2668a76b8c2f58e (diff)
parent389eac1bb3a193362aaa73811db0239de13e2cf4 (diff)
downloadqutebrowser-3dd969e731cdac7bf3bdccc38d779390297966af.tar.gz
qutebrowser-3dd969e731cdac7bf3bdccc38d779390297966af.zip
Merge remote-tracking branch 'origin/pr/7293'
-rw-r--r--.mypy.ini8
-rw-r--r--README.asciidoc4
-rw-r--r--misc/requirements/requirements-qutebrowser.txt-raw6
-rw-r--r--qutebrowser/mainwindow/mainwindow.py9
-rw-r--r--qutebrowser/misc/earlyinit.py4
-rw-r--r--qutebrowser/utils/version.py1
-rw-r--r--requirements.txt2
-rw-r--r--scripts/dev/changelog_urls.json4
-rw-r--r--tests/unit/utils/test_version.py1
9 files changed, 38 insertions, 1 deletions
diff --git a/.mypy.ini b/.mypy.ini
index b347323f5..820b2f966 100644
--- a/.mypy.ini
+++ b/.mypy.ini
@@ -39,6 +39,14 @@ ignore_missing_imports = True
# https://github.com/pygments/pygments/issues/1189
ignore_missing_imports = True
+[mypy-objc]
+# https://github.com/ronaldoussoren/pyobjc/issues/417
+ignore_missing_imports = True
+
+[mypy-AppKit]
+# https://github.com/ronaldoussoren/pyobjc/issues/417
+ignore_missing_imports = True
+
[mypy-qutebrowser.browser.browsertab]
disallow_untyped_defs = True
diff --git a/README.asciidoc b/README.asciidoc
index 76f46484f..d68268316 100644
--- a/README.asciidoc
+++ b/README.asciidoc
@@ -100,6 +100,10 @@ On older Python versions (3.7/3.8), the following backports are also required:
* https://importlib-resources.readthedocs.io/[importlib_resources]
+On macOS, the following libraries are also required:
+
+* https://pyobjc.readthedocs.io/en/latest/[pyobjc-core and pyobjc-framework-Cocoa]
+
The following libraries are optional:
* https://pypi.org/project/adblock/[adblock] (for improved adblocking using ABP syntax)
diff --git a/misc/requirements/requirements-qutebrowser.txt-raw b/misc/requirements/requirements-qutebrowser.txt-raw
index 2025280fc..c628f528a 100644
--- a/misc/requirements/requirements-qutebrowser.txt-raw
+++ b/misc/requirements/requirements-qutebrowser.txt-raw
@@ -1,6 +1,10 @@
Jinja2
PyYAML
+## Only used on macOS to make borderless windows resizable
+pyobjc-core
+pyobjc-framework-Cocoa
+
## stdlib backports
importlib-resources
@@ -16,3 +20,5 @@ typing_extensions # from importlib-metadata
#@ markers: importlib-resources python_version=="3.7.*" or python_version=="3.8.*"
#@ markers: importlib-metadata python_version=="3.7.*"
#@ markers: typing_extensions python_version<"3.8"
+#@ markers: pyobjc-core sys_platform=="darwin"
+#@ markers: pyobjc-framework-Cocoa sys_platform=="darwin"
diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py
index 22245d8c1..0fa8ed875 100644
--- a/qutebrowser/mainwindow/mainwindow.py
+++ b/qutebrowser/mainwindow/mainwindow.py
@@ -569,6 +569,15 @@ class MainWindow(QWidget):
if hidden:
window_flags |= Qt.CustomizeWindowHint | Qt.NoDropShadowWindowHint
self.setWindowFlags(window_flags)
+
+ if utils.is_mac and hidden:
+ from ctypes import c_void_p
+ # pylint: disable=import-error
+ from objc import objc_object
+ from AppKit import NSWindowStyleMaskResizable
+ win = objc_object(c_void_p=c_void_p(int(self.winId()))).window()
+ win.setStyleMask_(win.styleMask() | NSWindowStyleMaskResizable)
+
if refresh_window:
self.show()
diff --git a/qutebrowser/misc/earlyinit.py b/qutebrowser/misc/earlyinit.py
index 4b3df4db2..286d4f071 100644
--- a/qutebrowser/misc/earlyinit.py
+++ b/qutebrowser/misc/earlyinit.py
@@ -243,6 +243,10 @@ def check_libraries():
if sys.version_info < (3, 9):
# Backport required
modules['importlib_resources'] = _missing_str("importlib_resources")
+ if sys.platform.startswith('darwin'):
+ # Used for resizable hide_decoration windows on macOS
+ modules['objc'] = _missing_str("pyobjc-core")
+ modules['AppKit'] = _missing_str("pyobjc-framework-Cocoa")
_check_modules(modules)
diff --git a/qutebrowser/utils/version.py b/qutebrowser/utils/version.py
index bf6b49fa6..550388285 100644
--- a/qutebrowser/utils/version.py
+++ b/qutebrowser/utils/version.py
@@ -407,6 +407,7 @@ MODULE_INFO: Mapping[str, ModuleInfo] = collections.OrderedDict([
('PyQt5.QtWebEngineWidgets', []),
('PyQt5.QtWebEngine', ['PYQT_WEBENGINE_VERSION_STR']),
('PyQt5.QtWebKitWidgets', []),
+ ('objc', ['__version__']),
]
])
diff --git a/requirements.txt b/requirements.txt
index 24c60963f..fe6001ae4 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -7,6 +7,8 @@ importlib-resources==5.9.0 ; python_version=="3.7.*" or python_version=="3.8.*"
Jinja2==3.1.2
MarkupSafe==2.1.1
Pygments==2.13.0
+pyobjc-core==8.5 ; sys_platform=="darwin"
+pyobjc-framework-Cocoa==8.5 ; sys_platform=="darwin"
PyYAML==6.0
typing_extensions==4.3.0 ; python_version<"3.8"
zipp==3.8.1
diff --git a/scripts/dev/changelog_urls.json b/scripts/dev/changelog_urls.json
index 22d1a1aaf..bcf30fc78 100644
--- a/scripts/dev/changelog_urls.json
+++ b/scripts/dev/changelog_urls.json
@@ -154,5 +154,7 @@
"PyJWT": "https://github.com/jpadilla/pyjwt/blob/master/CHANGELOG.rst",
"commonmark": "https://github.com/readthedocs/commonmark.py/blob/master/CHANGELOG.md",
"rich": "https://github.com/Textualize/rich/blob/master/CHANGELOG.md",
- "ply": "https://github.com/dabeaz/ply/blob/master/CHANGES"
+ "ply": "https://github.com/dabeaz/ply/blob/master/CHANGES",
+ "pyobjc-core": "https://pyobjc.readthedocs.io/en/latest/changelog.html",
+ "pyobjc-framework-Cocoa": "https://pyobjc.readthedocs.io/en/latest/changelog.html"
}
diff --git a/tests/unit/utils/test_version.py b/tests/unit/utils/test_version.py
index 64df0ece2..12ae1fd73 100644
--- a/tests/unit/utils/test_version.py
+++ b/tests/unit/utils/test_version.py
@@ -751,6 +751,7 @@ class TestModuleVersions:
('adblock', True),
('dataclasses', False),
('importlib_resources', False),
+ ('objc', True),
])
def test_existing_attributes(self, name, has_version):
"""Check if all dependencies have an expected __version__ attribute.