Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/pywinbox/_pywinbox_linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
from __future__ import annotations

import sys
if sys.platform != "linux":
raise OSError(f"Cannot import {__name__} on {sys.platform}")
Comment on lines +5 to +6

@Avasam Avasam Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍
I'm surprised I hadn't done this change in this repo, I think I did so everywhere else.

Anyway it's more explicit, and won't get stripped out with python -O

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not discard it was myself messing around with updates, pushes, PRs, new branches... I am trying to learn as fast as I can (e.g. I was completely terrified when I made this PR... it's the first time I do it, so I was really scared to break something). Thank you for your patience!


import os

from ._main import Box

try:
# TypeAlias does not exist in typing for Python3.9
from typing import TypeAlias
except Exception:
from typing import TYPE_CHECKING
Expand All @@ -13,12 +19,8 @@
from typing import Union

from Xlib.xobject.drawable import Window as XWindow

from ._main import Box
from ewmhlib import EwmhWindow

assert sys.platform == "linux"


_HandleTypeIn: TypeAlias = Union[int, XWindow, None]
_HandleTypeOut: TypeAlias = Union[EwmhWindow, None]
Expand Down
11 changes: 7 additions & 4 deletions src/pywinbox/_pywinbox_macos.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,25 @@
# mypy: disable_error_code = no-any-return
from __future__ import annotations

import subprocess
import sys
if sys.platform != "darwin":
raise OSError(f"Cannot import {__name__} on {sys.platform}")

import subprocess

from ._main import Box

try:
# TypeAlias does not exist in typing for Python3.9
from typing import TypeAlias
except Exception:
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing_extensions import TypeAlias
from typing import NamedTuple, cast, Union
Comment thread
Kalmat marked this conversation as resolved.

from ._main import Box
import AppKit

assert sys.platform == "darwin"


class _macOSNSHandle(NamedTuple):
isNSHandle: bool
Expand Down
12 changes: 7 additions & 5 deletions src/pywinbox/_pywinbox_win.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,24 @@
from __future__ import annotations

import sys
if sys.platform != "win32":
raise OSError(f"Cannot import {__name__} on {sys.platform}")

import ctypes

from ._main import Box

try:
# TypeAlias does not exist in typing for Python3.9
from typing import TypeAlias
except Exception:
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing_extensions import TypeAlias
from typing import Union

import ctypes
import win32gui

from ._main import Box

assert sys.platform == "win32"


# Thanks to poipoiPIO (https://github.com/poipoiPIO) for his HELP!!!
try:
Expand Down
Loading