jbrowser.platform.win
Generated from the source code of JBrowser 2.0.3.
Windows 11 integration via the Win32 / DWM APIs (ctypes).
- The desktop wallpaper (for JBrowser's own Frosted look, ui/frost.py). JBrowser's windows are opaque: it never uses Windows' see-through materials (Mica, Acrylic).
- Custom-drawn title bar that keeps native behaviour: the top caption is removed in WM_NCCALCSIZE while the invisible side/bottom resize borders, drop shadow, rounded corners, Aero Snap and the Windows 11 Snap Layouts flyout (HTMAXBUTTON) all remain.
- DPAPI for protecting local secrets, system accent colour, AppUserModelID.
Constants#
| Name | Value |
|---|---|
IS_WINDOWS |
sys.platform == 'win32' |
WIN_BUILD |
sys.getwindowsversion().build if IS_WINDOWS else 0 |
IS_WIN11 |
WIN_BUILD >= 22000 |
WM_NCACTIVATE |
134 |
WM_NCCALCSIZE |
131 |
WM_NCHITTEST |
132 |
WM_NCMOUSEMOVE |
160 |
WM_NCLBUTTONDOWN |
161 |
WM_NCLBUTTONUP |
162 |
WM_NCLBUTTONDBLCLK |
163 |
WM_NCRBUTTONDOWN |
164 |
WM_NCRBUTTONUP |
165 |
WM_NCMOUSELEAVE |
674 |
WM_SETTINGCHANGE |
26 |
WM_DWMCOLORIZATIONCOLORCHANGED |
800 |
WM_THEMECHANGED |
794 |
HTCLIENT |
1 |
HTCAPTION |
2 |
HTMAXBUTTON |
9 |
DWMWA_CLOAK |
13 |
DWMWA_USE_IMMERSIVE_DARK_MODE |
20 |
DWMWA_USE_IMMERSIVE_DARK_MODE_OLD |
19 |
DWMWA_WINDOW_CORNER_PREFERENCE |
33 |
DWMWCP_ROUND |
2 |
SWP_FRAMECHANGED_FLAGS |
1 | 2 | 4 | 16 | 32 |
SPI_GETDESKWALLPAPER |
115 |
DEFAULT_HANDLERS |
{'browser': ('https', 'JBrowserURL'), 'pdf': ('.pdf', 'JBrowserPDF')} |
NCCALCSIZE_PARAMS#
class NCCALCSIZE_PARAMS(ctypes.Structure)source
APPBARDATA#
class APPBARDATA(ctypes.Structure)source
DATA_BLOB#
class DATA_BLOB(ctypes.Structure)source
NativeFrame#
class NativeFramesource
NativeFrame(hwnd_getter: Callable[[], int], dpr_getter: Callable[[], float], hit_test: Callable[[QPoint], int], on_max_hover: Callable[[bool], None], on_max_press: Callable[[bool], None], on_max_click: Callable[[], None])
Implements the non-client behaviour for a custom-titlebar top-level window.
hit_test(local_logical_point) -> int is supplied by the window and returns
HTCAPTION for drag regions, HTMAXBUTTON over the maximise button, else HTCLIENT.
Attributes
| Name | Value |
|---|---|
RESIZE_BORDER |
6 |
CORNER |
14 |
NativeFrame.handle#
handle(msg_ptr: int) -> tuple[bool, int]source
Functions#
set_dark_title#
set_dark_title(hwnd: int, dark: bool) -> Nonesource
set_caption_colors#
set_caption_colors(hwnd: int, background: QColor, text: QColor) -> Nonesource
Tint a native title bar (Windows 11) so it matches the window content.
set_corner_preference#
set_corner_preference(hwnd: int, preference: int=DWMWCP_ROUND) -> Nonesource
Rounded corners (2 = round, 3 = small) for windows, popups, menus and tooltips.
refresh_frame#
refresh_frame(hwnd: int) -> Nonesource
set_transitions#
set_transitions(hwnd: int, enabled: bool) -> Nonesource
Windows' minimise / maximise / restore animations for this window (DWMWA_TRANSITIONS_FORCEDISABLED).
set_cloak#
set_cloak(hwnd: int, cloaked: bool) -> boolsource
Hide (or show again) a window from the screen without hiding it from Windows: a new window is cloaked until its first frame is painted, so it never flashes white or black.
wallpaper_path#
wallpaper_path() -> strsource
The desktop wallpaper's image file, or "" (a solid colour, or not Windows).
desktop_color#
desktop_color() -> QColor | Nonesource
Settings → Personalisation → Background → Solid colour, or None.
is_maximized#
is_maximized(hwnd: int) -> boolsource
set_app_user_model_id#
set_app_user_model_id(app_id: str) -> Nonesource
system_accent_color#
system_accent_color() -> QColor | Nonesource
system_animations_enabled#
system_animations_enabled() -> boolsource
dpapi_protect#
dpapi_protect(data: bytes, entropy: bytes=b'JBrowser') -> bytessource
dpapi_unprotect#
dpapi_unprotect(data: bytes, entropy: bytes=b'JBrowser') -> bytessource
registered_with_windows#
registered_with_windows() -> str | Nonesource
Where the installer registered JBrowser for "Default apps": "user", "machine", or None.
handles_pdf#
handles_pdf() -> boolsource
Whether this installation offers JBrowser for PDF files (installed by 2.0.1 or later).
default_handler#
default_handler(kind: str) -> str | Nonesource
The handler Windows uses for links ("browser") or PDF files ("pdf"), or None if unknown. Newer Windows 11 builds keep the user's choice in UserChoiceLatest, older ones in UserChoice.
is_default#
is_default(kind: str) -> boolsource
open_default_apps#
open_default_apps() -> Nonesource
Windows Settings → Default apps, on JBrowser's own page when Windows knows about it.
running_as_admin#
running_as_admin() -> boolsource
True when this process runs elevated (as administrator).
authenticode#
authenticode(path: str) -> tuple[str, str]source
The Authenticode signature of a file: (status, signer subject), e.g. ("Valid", "CN=…") or ("NotSigned", ""). ("Unknown", "") when it can't be checked. Takes about half a second.
reveal_in_explorer#
reveal_in_explorer(path: str) -> Nonesource