Skip to content

Commit 89832e9

Browse files
committed
Merge branch 'master' of https://github.com/Kalmat/EWMHlib
2 parents 66c6223 + d62dd4d commit 89832e9

13 files changed

Lines changed: 424 additions & 339 deletions

File tree

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
0.3, 2026/XX/XX -- Replaced bare `except:` clauses with `except Exception:`, preventing accidental suppression of system-exit signals (KeyboardInterrupt, SystemExit) during error handling.
2+
Removed dependency on `typing_extensions`
23
0.2, 2024/04/17 -- Improved getPropertyValue()
34
0.1, 2023/05/22 -- Initial version

README.md

Lines changed: 363 additions & 292 deletions
Large diffs are not rendered by default.
File renamed without changes.

docs/source/conf.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,17 @@
4343
# -- Copy the modules documentation ------------------------------------------
4444
# https://stackoverflow.com/questions/66495200/is-it-possible-to-include-external-rst-files-in-my-documentation
4545
from urllib.request import urlretrieve
46+
import os
4647

4748
urlretrieve(
4849
"https://raw.githubusercontent.com/kalmat/ewmhlib/master/README.md",
4950
"index.md"
5051
)
52+
53+
os.mkdir("docs")
54+
os.chdir("docs")
5155
urlretrieve(
52-
"https://raw.githubusercontent.com/kalmat/ewmhlib/master/docstrings.md",
56+
"https://raw.githubusercontent.com/kalmat/ewmhlib/master/docs/docstrings.md",
5357
"docstrings.md"
5458
)
59+
os.chdir("..")

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ classifiers = [
4545
]
4646
dependencies = [
4747
"python-xlib>=0.21; sys_platform == 'linux'",
48-
"typing_extensions>=4.4.0",
4948
]
5049

5150
[dependency-groups]

src/ewmhlib/Props/__init__.py

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

3-
from ._props import (Root, DesktopLayout, Window, WindowType, State, StateAction,
4-
MoveResize, DataFormat, Mode, StackMode, HintAction)
3+
from ._props import (Root as Root, DesktopLayout as DesktopLayout, Window as Window, WindowType as WindowType, State as State, StateAction as StateAction,
4+
MoveResize as MoveResize, DataFormat as DataFormat, Mode as Mode, StackMode as StackMode, HintAction as HintAction)

src/ewmhlib/Structs/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/python
22

3-
from ._structs import (ScreensInfo, DisplaysInfo, WmHints, Aspect, WmNormalHints)
3+
from ._structs import (ScreensInfo as ScreensInfo, DisplaysInfo as DisplaysInfo, WmHints as WmHints, Aspect as Aspect, WmNormalHints as WmNormalHints)

src/ewmhlib/Structs/_structs.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/usr/bin/python
22

33
from __future__ import annotations
4-
from typing_extensions import TypedDict
5-
from typing import TYPE_CHECKING
4+
from typing import TYPE_CHECKING, TypedDict
65

76
from ctypes import Structure, c_int32, c_ulong, c_uint32
87

src/ewmhlib/__init__.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
#!/usr/bin/python
22
from importlib.metadata import version as _importlib_version
33

4+
from ._main import (displaysCount, getDisplays, getDisplaysInfo, getRoots,
5+
defaultDisplay, defaultScreen, defaultRoot, defaultEwmhRoot,
6+
getDisplayFromRoot, getScreenFromRoot,
7+
getDisplayFromWindow, getScreenFromWindow, getRootFromWindow,
8+
getProperty, getPropertyValue, changeProperty, sendMessage,
9+
EwmhRoot, EwmhWindow,
10+
Props, Structs
11+
)
12+
413
__all__ = [
514
"version", "displaysCount", "getDisplays", "getDisplaysInfo", "getRoots",
615
"defaultDisplay", "defaultScreen", "defaultRoot", "defaultEwmhRoot",
@@ -14,16 +23,7 @@
1423
__version__ = _importlib_version("ewmhlib")
1524

1625

17-
def version(numberOnly: bool = True):
26+
def version(numberOnly: bool = True) -> str:
1827
"""Returns the current version of ewmhlib module, in the form ''x.x.xx'' as string"""
1928
return ("" if numberOnly else "EWMHlib-")+__version__
2029

21-
22-
from ._main import (displaysCount, getDisplays, getDisplaysInfo, getRoots,
23-
defaultDisplay, defaultScreen, defaultRoot, defaultEwmhRoot,
24-
getDisplayFromRoot, getScreenFromRoot,
25-
getDisplayFromWindow, getScreenFromWindow, getRootFromWindow,
26-
getProperty, getPropertyValue, changeProperty, sendMessage,
27-
EwmhRoot, EwmhWindow,
28-
Props, Structs
29-
)

src/ewmhlib/_ewmhlib.py

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
from __future__ import annotations
33

44
import sys
5-
assert sys.platform == "linux"
5+
6+
if sys.platform != "linux":
7+
raise OSError(f"Cannot import {__name__} on {sys.platform}")
68

79
import array
810
import os
@@ -14,14 +16,26 @@
1416
import Xlib.protocol
1517
import Xlib.X
1618
import Xlib.Xatom
17-
import Xlib.Xutil
18-
import Xlib.ext
1919
import Xlib.xobject
20+
import Xlib.Xutil
2021
from Xlib.xobject.drawable import Window as XWindow
2122

22-
from .Props import (Root, DesktopLayout, Window, WindowType, State, StateAction,
23-
MoveResize, DataFormat, Mode, HintAction)
24-
from .Structs import DisplaysInfo, ScreensInfo, WmHints, Aspect, WmNormalHints
23+
from .Props import (
24+
DataFormat,
25+
DesktopLayout,
26+
HintAction,
27+
Mode,
28+
MoveResize,
29+
Root,
30+
State,
31+
StateAction,
32+
Window,
33+
WindowType,
34+
)
35+
from .Structs import Aspect, DisplaysInfo, ScreensInfo, WmHints, WmNormalHints
36+
37+
if TYPE_CHECKING:
38+
from Xlib.protocol.rq import Struct
2539

2640
if TYPE_CHECKING:
2741
from Xlib.protocol.rq import Struct
@@ -2713,7 +2727,7 @@ def findit(hwnd: XWindow) -> None:
27132727
# input_pm: Xlib.xobject.drawable.Pixmap = xWin.create_pixmap(width, height, 1)
27142728
# gc: Xlib.xobject.fontable.GC = input_pm.create_gc(foreground=0, background=0)
27152729
# input_pm.fill_rectangle(gc.id, 0, 0, width, height)
2716-
# xWin.shape_mask(Xlib.ext.shape.SO.Set, Xlib.ext.shape.SK.Input, 0, 0, input_pm) # type: ignore[attr-defined] # pyright: ignore[reportGeneralTypeIssues, reportUnknownMemberType]
2730+
# xWin.shape_mask(Xlib.ext.shape.SO.Set, Xlib.ext.shape.SK.Input, 0, 0, input_pm)
27172731
# # xWin.shape_select_input(0)
27182732
#
27192733
# xWin.map()

0 commit comments

Comments
 (0)