stbdl 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- stbdl-0.1.0/LICENSE +19 -0
- stbdl-0.1.0/MANIFEST.in +5 -0
- stbdl-0.1.0/PKG-INFO +119 -0
- stbdl-0.1.0/README.md +94 -0
- stbdl-0.1.0/setup.cfg +4 -0
- stbdl-0.1.0/setup.py +27 -0
- stbdl-0.1.0/stbdl/__init__.py +229 -0
- stbdl-0.1.0/stbdl/__init__.pyi +13 -0
- stbdl-0.1.0/stbdl/stbdl.exe +0 -0
- stbdl-0.1.0/stbdl/white.png +0 -0
- stbdl-0.1.0/stbdl.egg-info/PKG-INFO +119 -0
- stbdl-0.1.0/stbdl.egg-info/SOURCES.txt +12 -0
- stbdl-0.1.0/stbdl.egg-info/dependency_links.txt +1 -0
- stbdl-0.1.0/stbdl.egg-info/top_level.txt +1 -0
stbdl-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2026 enstarep <enstarep@rncyk.org> and other authors of stbdl
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
stbdl-0.1.0/MANIFEST.in
ADDED
stbdl-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stbdl
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A simple taskbar decoration library
|
|
5
|
+
Home-page: https://github.com/theembodimentofdisharmony/stbdl
|
|
6
|
+
Author: enstarep
|
|
7
|
+
Author-email: enstarep@rncyk.org
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
12
|
+
Requires-Python: >=3.0
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Dynamic: author
|
|
16
|
+
Dynamic: author-email
|
|
17
|
+
Dynamic: classifier
|
|
18
|
+
Dynamic: description
|
|
19
|
+
Dynamic: description-content-type
|
|
20
|
+
Dynamic: home-page
|
|
21
|
+
Dynamic: license
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
Dynamic: requires-python
|
|
24
|
+
Dynamic: summary
|
|
25
|
+
|
|
26
|
+
# stbdl (Simple Taskbar Decoration Library)
|
|
27
|
+
|
|
28
|
+
Document: https://github.com/enstarep/rchp/blob/main/stbdl/README.md
|
|
29
|
+
|
|
30
|
+
Run the following command to install stbdl:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
pip install stbdl
|
|
34
|
+
```
|
|
35
|
+
No dependencies need to be installed.
|
|
36
|
+
|
|
37
|
+
stbdl supports Python 3.x on Windows
|
|
38
|
+
|
|
39
|
+
## Latest Version Changes:
|
|
40
|
+
1. Release 0.1.0 version
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
# stbdl (Simple Taskbar Decoration Library)
|
|
45
|
+
|
|
46
|
+
Run the following command to install stbdl:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
> pip install stbdl
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
No dependencies need to be installed.
|
|
53
|
+
|
|
54
|
+
stbdl supports Python 3.x on Windows 10+.
|
|
55
|
+
|
|
56
|
+
stbdl is a simple taskbar decoration library.
|
|
57
|
+
|
|
58
|
+
It mainly includes the following four functions:
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
def window(path: Optional[str] = None, mode: int = 3) -> None: ...
|
|
62
|
+
def expansion() -> None: ...
|
|
63
|
+
def taskbar_switcher() -> wintypes.HWND: ...
|
|
64
|
+
def border(hwnd: wintypes.HWND) -> None: ...
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
These functions are all under the `stbdl.*` namespace.
|
|
68
|
+
|
|
69
|
+
## `window` function
|
|
70
|
+
|
|
71
|
+
The parameter `path` is the path to the background image, **must be an absolute path**. If no value is provided, it defaults to loading `stbdl\white.png`.
|
|
72
|
+
The parameter `mode` is the dynamic style, with the following meanings:
|
|
73
|
+
```text
|
|
74
|
+
mode=0: Fade in/out
|
|
75
|
+
mode=1: Rotation
|
|
76
|
+
mode=2: Zoom
|
|
77
|
+
mode=3: Four-color cycle (red, green, blue, yellow)
|
|
78
|
+
mode=4: Color cycle
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
If no value is provided, it defaults to 3.
|
|
82
|
+
|
|
83
|
+
Also, the background window needs to be clicked on a blank area of the taskbar to bring the taskbar above it.
|
|
84
|
+
|
|
85
|
+
The `window` function returns no value.
|
|
86
|
+
|
|
87
|
+
**Tip: Do not run the window function multiple times, as this will create multiple stbdl processes (but they can be terminated using `taskkill /im stbdl.exe`)**
|
|
88
|
+
|
|
89
|
+
## `expansion` function
|
|
90
|
+
|
|
91
|
+
Enables the stbdl taskbar extension. The actual effect depends on system support. It prioritizes the mica effect (requires Windows 11), then the acrylic effect (requires Windows 10), and finally the blur effect.
|
|
92
|
+
|
|
93
|
+
The `expansion` function takes no parameters and returns no value.
|
|
94
|
+
|
|
95
|
+
## `taskbar_switcher` function
|
|
96
|
+
|
|
97
|
+
Gets the handle of the task switcher window (class name `MSTaskListWClass`). Returns None if not found.
|
|
98
|
+
|
|
99
|
+
The `taskbar_switcher` function takes no parameters.
|
|
100
|
+
|
|
101
|
+
## `border` function
|
|
102
|
+
|
|
103
|
+
Used to add a border to a specified window. It takes the handle of the target window as a parameter.
|
|
104
|
+
|
|
105
|
+
The `border` function returns no value.
|
|
106
|
+
|
|
107
|
+
## Example
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
import stbdl
|
|
111
|
+
|
|
112
|
+
stbdl.window()
|
|
113
|
+
|
|
114
|
+
stbdl.expansion()
|
|
115
|
+
|
|
116
|
+
h = stbdl.taskbar_switcher()
|
|
117
|
+
|
|
118
|
+
stbdl.border(h)
|
|
119
|
+
```
|
stbdl-0.1.0/README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# stbdl (Simple Taskbar Decoration Library)
|
|
2
|
+
|
|
3
|
+
Document: https://github.com/enstarep/rchp/blob/main/stbdl/README.md
|
|
4
|
+
|
|
5
|
+
Run the following command to install stbdl:
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
pip install stbdl
|
|
9
|
+
```
|
|
10
|
+
No dependencies need to be installed.
|
|
11
|
+
|
|
12
|
+
stbdl supports Python 3.x on Windows
|
|
13
|
+
|
|
14
|
+
## Latest Version Changes:
|
|
15
|
+
1. Release 0.1.0 version
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
# stbdl (Simple Taskbar Decoration Library)
|
|
20
|
+
|
|
21
|
+
Run the following command to install stbdl:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
> pip install stbdl
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
No dependencies need to be installed.
|
|
28
|
+
|
|
29
|
+
stbdl supports Python 3.x on Windows 10+.
|
|
30
|
+
|
|
31
|
+
stbdl is a simple taskbar decoration library.
|
|
32
|
+
|
|
33
|
+
It mainly includes the following four functions:
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
def window(path: Optional[str] = None, mode: int = 3) -> None: ...
|
|
37
|
+
def expansion() -> None: ...
|
|
38
|
+
def taskbar_switcher() -> wintypes.HWND: ...
|
|
39
|
+
def border(hwnd: wintypes.HWND) -> None: ...
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
These functions are all under the `stbdl.*` namespace.
|
|
43
|
+
|
|
44
|
+
## `window` function
|
|
45
|
+
|
|
46
|
+
The parameter `path` is the path to the background image, **must be an absolute path**. If no value is provided, it defaults to loading `stbdl\white.png`.
|
|
47
|
+
The parameter `mode` is the dynamic style, with the following meanings:
|
|
48
|
+
```text
|
|
49
|
+
mode=0: Fade in/out
|
|
50
|
+
mode=1: Rotation
|
|
51
|
+
mode=2: Zoom
|
|
52
|
+
mode=3: Four-color cycle (red, green, blue, yellow)
|
|
53
|
+
mode=4: Color cycle
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
If no value is provided, it defaults to 3.
|
|
57
|
+
|
|
58
|
+
Also, the background window needs to be clicked on a blank area of the taskbar to bring the taskbar above it.
|
|
59
|
+
|
|
60
|
+
The `window` function returns no value.
|
|
61
|
+
|
|
62
|
+
**Tip: Do not run the window function multiple times, as this will create multiple stbdl processes (but they can be terminated using `taskkill /im stbdl.exe`)**
|
|
63
|
+
|
|
64
|
+
## `expansion` function
|
|
65
|
+
|
|
66
|
+
Enables the stbdl taskbar extension. The actual effect depends on system support. It prioritizes the mica effect (requires Windows 11), then the acrylic effect (requires Windows 10), and finally the blur effect.
|
|
67
|
+
|
|
68
|
+
The `expansion` function takes no parameters and returns no value.
|
|
69
|
+
|
|
70
|
+
## `taskbar_switcher` function
|
|
71
|
+
|
|
72
|
+
Gets the handle of the task switcher window (class name `MSTaskListWClass`). Returns None if not found.
|
|
73
|
+
|
|
74
|
+
The `taskbar_switcher` function takes no parameters.
|
|
75
|
+
|
|
76
|
+
## `border` function
|
|
77
|
+
|
|
78
|
+
Used to add a border to a specified window. It takes the handle of the target window as a parameter.
|
|
79
|
+
|
|
80
|
+
The `border` function returns no value.
|
|
81
|
+
|
|
82
|
+
## Example
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
import stbdl
|
|
86
|
+
|
|
87
|
+
stbdl.window()
|
|
88
|
+
|
|
89
|
+
stbdl.expansion()
|
|
90
|
+
|
|
91
|
+
h = stbdl.taskbar_switcher()
|
|
92
|
+
|
|
93
|
+
stbdl.border(h)
|
|
94
|
+
```
|
stbdl-0.1.0/setup.cfg
ADDED
stbdl-0.1.0/setup.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="stbdl",
|
|
5
|
+
version="0.1.0",
|
|
6
|
+
packages=find_packages(),
|
|
7
|
+
include_package_data=True,
|
|
8
|
+
package_data={
|
|
9
|
+
"stbdl": ["*.exe", "*.png"],
|
|
10
|
+
},
|
|
11
|
+
exclude_package_data={
|
|
12
|
+
"": ["*.rc"],
|
|
13
|
+
},
|
|
14
|
+
author="enstarep",
|
|
15
|
+
author_email="enstarep@rncyk.org",
|
|
16
|
+
description="A simple taskbar decoration library",
|
|
17
|
+
long_description=open("README.md", encoding="utf-8").read(),
|
|
18
|
+
long_description_content_type="text/markdown",
|
|
19
|
+
url="https://github.com/theembodimentofdisharmony/stbdl",
|
|
20
|
+
license="MIT",
|
|
21
|
+
classifiers=[
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"License :: OSI Approved :: MIT License",
|
|
24
|
+
"Operating System :: Microsoft :: Windows"
|
|
25
|
+
],
|
|
26
|
+
python_requires=">=3.0",
|
|
27
|
+
)
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
# Copyright (c) 2026 enstarep <enstarep@rncyk.org> and other authors of stbdl
|
|
2
|
+
# License: https://github.com/theembodimentofdisharmony/stbdl/blob/main/LICENSE
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
import subprocess
|
|
6
|
+
import ctypes
|
|
7
|
+
from ctypes import wintypes
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
__version__ = "0.1.0"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def window(path: str = None, mode: int = 3):
|
|
14
|
+
"""
|
|
15
|
+
The background window setting function. If no value is provided, it defaults to 3. Also, the background window needs to be clicked on a blank area of the taskbar to bring the taskbar above it.
|
|
16
|
+
:param path: The parameter `path` is the path to the background image, **must be an absolute path**. If no value is provided, it defaults to loading `stbdl\\white.png`.
|
|
17
|
+
:param mode: The parameter `mode` is the dynamic style, with the following meanings: mode=0: Fade in/out; mode=1: Rotation; mode=2: Zoom; mode=3: Four-color cycle (red, green, blue, yellow); mode=4: Color cycle
|
|
18
|
+
:return: None
|
|
19
|
+
"""
|
|
20
|
+
if path is not None and not isinstance(path, str):
|
|
21
|
+
raise TypeError("The parameter 'path' must be 'str'")
|
|
22
|
+
if not isinstance(mode, int):
|
|
23
|
+
raise TypeError("The parameter 'mode' must be 'int'")
|
|
24
|
+
|
|
25
|
+
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
26
|
+
pro = os.path.join(current_dir, "stbdl.exe")
|
|
27
|
+
file = path if path is not None else os.path.join(current_dir, "white.png")
|
|
28
|
+
subprocess.Popen([pro, file, str(mode)])
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def expansion():
|
|
32
|
+
"""
|
|
33
|
+
Enables the stbdl taskbar extension. The actual effect depends on system support. It prioritizes the mica effect (requires Windows 11), then the acrylic effect (requires Windows 10), and finally the blur effect.
|
|
34
|
+
:return: None
|
|
35
|
+
"""
|
|
36
|
+
class DWM_BLURBEHIND(ctypes.Structure):
|
|
37
|
+
_fields_ = [
|
|
38
|
+
("dwFlags", wintypes.DWORD),
|
|
39
|
+
("fEnable", wintypes.BOOL),
|
|
40
|
+
("hRgnBlur", wintypes.HANDLE),
|
|
41
|
+
("fTransitionOnMaximized", wintypes.BOOL)
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
class ACCENT_POLICY(ctypes.Structure):
|
|
45
|
+
_fields_ = [
|
|
46
|
+
("AccentState", wintypes.DWORD),
|
|
47
|
+
("AccentFlags", wintypes.DWORD),
|
|
48
|
+
("GradientColor", wintypes.DWORD),
|
|
49
|
+
("AnimationId", wintypes.DWORD)
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
class WINDOWCOMPOSITIONATTRIBDATA(ctypes.Structure):
|
|
53
|
+
_fields_ = [
|
|
54
|
+
("Attribute", wintypes.DWORD),
|
|
55
|
+
("Data", ctypes.POINTER(ACCENT_POLICY)),
|
|
56
|
+
("SizeOfData", ctypes.c_size_t)
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
WS_EX_LAYERED = 0x00080000
|
|
60
|
+
GWL_EXSTYLE = -20
|
|
61
|
+
LWA_ALPHA = 0x00000002
|
|
62
|
+
DWMWA_MICA = 1029
|
|
63
|
+
DWM_BB_ENABLE = 0x00000001
|
|
64
|
+
WCA_ACCENT_POLICY = 19
|
|
65
|
+
ACCENT_ENABLE_ACRYLICBLURBEHIND = 3
|
|
66
|
+
|
|
67
|
+
def _enable_blur_behind(hwnd):
|
|
68
|
+
dwmapi.DwmEnableBlurBehindWindow.argtypes = [
|
|
69
|
+
wintypes.HWND,
|
|
70
|
+
ctypes.POINTER(DWM_BLURBEHIND)
|
|
71
|
+
]
|
|
72
|
+
dwmapi.DwmEnableBlurBehindWindow.restype = wintypes.LONG
|
|
73
|
+
blur = DWM_BLURBEHIND()
|
|
74
|
+
blur.dwFlags = DWM_BB_ENABLE
|
|
75
|
+
blur.fEnable = True
|
|
76
|
+
blur.hRgnBlur = None
|
|
77
|
+
blur.fTransitionOnMaximized = False
|
|
78
|
+
dwmapi.DwmEnableBlurBehindWindow(hwnd, ctypes.byref(blur))
|
|
79
|
+
|
|
80
|
+
def _try_acrylic(hwnd):
|
|
81
|
+
try:
|
|
82
|
+
SetWindowCompositionAttribute = ctypes.windll.user32.SetWindowCompositionAttribute
|
|
83
|
+
except AttributeError:
|
|
84
|
+
return False
|
|
85
|
+
|
|
86
|
+
SetWindowCompositionAttribute.argtypes = [
|
|
87
|
+
wintypes.HWND,
|
|
88
|
+
ctypes.POINTER(WINDOWCOMPOSITIONATTRIBDATA)
|
|
89
|
+
]
|
|
90
|
+
SetWindowCompositionAttribute.restype = wintypes.BOOL
|
|
91
|
+
|
|
92
|
+
accent = ACCENT_POLICY()
|
|
93
|
+
accent.AccentState = ACCENT_ENABLE_ACRYLICBLURBEHIND
|
|
94
|
+
accent.GradientColor = 0x99FFFFFF
|
|
95
|
+
attr_data = WINDOWCOMPOSITIONATTRIBDATA()
|
|
96
|
+
attr_data.Attribute = WCA_ACCENT_POLICY
|
|
97
|
+
attr_data.Data = ctypes.pointer(accent)
|
|
98
|
+
attr_data.SizeOfData = ctypes.sizeof(accent)
|
|
99
|
+
|
|
100
|
+
return bool(SetWindowCompositionAttribute(hwnd, ctypes.byref(attr_data)))
|
|
101
|
+
|
|
102
|
+
user32 = ctypes.windll.user32
|
|
103
|
+
dwmapi = ctypes.windll.dwmapi
|
|
104
|
+
kernel32 = ctypes.windll.kernel32
|
|
105
|
+
|
|
106
|
+
user32.FindWindowW.argtypes = [wintypes.LPCWSTR, wintypes.LPCWSTR]
|
|
107
|
+
user32.FindWindowW.restype = wintypes.HWND
|
|
108
|
+
hTaskbar = user32.FindWindowW("Shell_TrayWnd", None)
|
|
109
|
+
if not hTaskbar:
|
|
110
|
+
raise RuntimeError("Cannot find taskbar window")
|
|
111
|
+
|
|
112
|
+
user32.GetWindowLongW.argtypes = [wintypes.HWND, ctypes.c_int]
|
|
113
|
+
user32.GetWindowLongW.restype = wintypes.LONG
|
|
114
|
+
user32.SetWindowLongW.argtypes = [wintypes.HWND, ctypes.c_int, wintypes.LONG]
|
|
115
|
+
user32.SetWindowLongW.restype = wintypes.LONG
|
|
116
|
+
|
|
117
|
+
ex_style = user32.GetWindowLongW(hTaskbar, GWL_EXSTYLE)
|
|
118
|
+
ex_style |= WS_EX_LAYERED
|
|
119
|
+
user32.SetWindowLongW(hTaskbar, GWL_EXSTYLE, ex_style)
|
|
120
|
+
|
|
121
|
+
dwmapi.DwmSetWindowAttribute.argtypes = [
|
|
122
|
+
wintypes.HWND,
|
|
123
|
+
wintypes.DWORD,
|
|
124
|
+
ctypes.c_void_p,
|
|
125
|
+
wintypes.DWORD
|
|
126
|
+
]
|
|
127
|
+
dwmapi.DwmSetWindowAttribute.restype = wintypes.LONG
|
|
128
|
+
mica = wintypes.BOOL(True)
|
|
129
|
+
hr = dwmapi.DwmSetWindowAttribute(
|
|
130
|
+
hTaskbar, DWMWA_MICA,
|
|
131
|
+
ctypes.byref(mica), ctypes.sizeof(wintypes.BOOL)
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
if hr != 0:
|
|
135
|
+
if not _try_acrylic(hTaskbar):
|
|
136
|
+
_enable_blur_behind(hTaskbar)
|
|
137
|
+
|
|
138
|
+
user32.SetLayeredWindowAttributes.argtypes = [
|
|
139
|
+
wintypes.HWND,
|
|
140
|
+
wintypes.COLORREF,
|
|
141
|
+
wintypes.BYTE,
|
|
142
|
+
wintypes.DWORD
|
|
143
|
+
]
|
|
144
|
+
user32.SetLayeredWindowAttributes.restype = wintypes.BOOL
|
|
145
|
+
user32.SetLayeredWindowAttributes(hTaskbar, 0, 220, LWA_ALPHA)
|
|
146
|
+
|
|
147
|
+
return
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
__user32 = ctypes.windll.user32
|
|
151
|
+
|
|
152
|
+
HWND = wintypes.HWND
|
|
153
|
+
LPCWSTR = wintypes.LPCWSTR
|
|
154
|
+
BOOL = wintypes.BOOL
|
|
155
|
+
DWORD = wintypes.DWORD
|
|
156
|
+
LONG_PTR = ctypes.c_ssize_t
|
|
157
|
+
|
|
158
|
+
GWL_STYLE = -16
|
|
159
|
+
WS_BORDER = 0x00800000
|
|
160
|
+
|
|
161
|
+
__user32.FindWindowW.argtypes = [LPCWSTR, LPCWSTR]
|
|
162
|
+
__user32.FindWindowW.restype = HWND
|
|
163
|
+
|
|
164
|
+
__user32.FindWindowExW.argtypes = [HWND, HWND, LPCWSTR, LPCWSTR]
|
|
165
|
+
__user32.FindWindowExW.restype = HWND
|
|
166
|
+
|
|
167
|
+
try:
|
|
168
|
+
__user32.GetWindowLongPtrW.argtypes = [HWND, ctypes.c_int]
|
|
169
|
+
__user32.GetWindowLongPtrW.restype = LONG_PTR
|
|
170
|
+
get_style = lambda h: __user32.GetWindowLongPtrW(h, GWL_STYLE)
|
|
171
|
+
except AttributeError:
|
|
172
|
+
__user32.GetWindowLongW.argtypes = [HWND, ctypes.c_int]
|
|
173
|
+
__user32.GetWindowLongW.restype = LONG_PTR
|
|
174
|
+
get_style = lambda h: __user32.GetWindowLongW(h, GWL_STYLE)
|
|
175
|
+
|
|
176
|
+
try:
|
|
177
|
+
__user32.SetWindowLongPtrW.argtypes = [HWND, ctypes.c_int, LONG_PTR]
|
|
178
|
+
__user32.SetWindowLongPtrW.restype = LONG_PTR
|
|
179
|
+
set_style = lambda h, style: __user32.SetWindowLongPtrW(h, GWL_STYLE, style)
|
|
180
|
+
except AttributeError:
|
|
181
|
+
__user32.SetWindowLongW.argtypes = [HWND, ctypes.c_int, LONG_PTR]
|
|
182
|
+
__user32.SetWindowLongW.restype = LONG_PTR
|
|
183
|
+
set_style = lambda h, style: __user32.SetWindowLongW(h, GWL_STYLE, style)
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def taskbar_switcher():
|
|
187
|
+
"""
|
|
188
|
+
Gets the handle of the task switcher window (class name `MSTaskListWClass`). Returns None if not found.
|
|
189
|
+
:return: wintypes.HWND
|
|
190
|
+
"""
|
|
191
|
+
hTaskbar = __user32.FindWindowW("Shell_TrayWnd", None)
|
|
192
|
+
if not hTaskbar:
|
|
193
|
+
hTaskbar = __user32.FindWindowW("Shell_SecondaryTrayWnd", None)
|
|
194
|
+
if not hTaskbar:
|
|
195
|
+
return None
|
|
196
|
+
|
|
197
|
+
hRebar = __user32.FindWindowExW(hTaskbar, None, "ReBarWindow32", None)
|
|
198
|
+
if hRebar:
|
|
199
|
+
hSwitcher = __user32.FindWindowExW(hRebar, None, "MSTaskSwWClass", None)
|
|
200
|
+
if hSwitcher:
|
|
201
|
+
return hSwitcher
|
|
202
|
+
|
|
203
|
+
hWorkerW = __user32.FindWindowExW(hTaskbar, None, "MSTaskListWClass", None)
|
|
204
|
+
if hWorkerW:
|
|
205
|
+
return hWorkerW
|
|
206
|
+
|
|
207
|
+
return None
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def border(hwnd):
|
|
211
|
+
"""
|
|
212
|
+
Used to add a border to a specified window
|
|
213
|
+
:param hwnd: The parameter 'hwnd' is the handle of specified window
|
|
214
|
+
:return: None
|
|
215
|
+
"""
|
|
216
|
+
if not hwnd:
|
|
217
|
+
return
|
|
218
|
+
|
|
219
|
+
current_style = get_style(hwnd)
|
|
220
|
+
new_style = current_style | WS_BORDER
|
|
221
|
+
set_style(hwnd, new_style)
|
|
222
|
+
|
|
223
|
+
SWP_NOSIZE = 0x0001
|
|
224
|
+
SWP_NOMOVE = 0x0002
|
|
225
|
+
SWP_FRAMECHANGED = 0x0020
|
|
226
|
+
flags = SWP_NOSIZE | SWP_NOMOVE | SWP_FRAMECHANGED
|
|
227
|
+
|
|
228
|
+
__user32.SetWindowPos(hwnd, None, 0, 0, 0, 0, flags)
|
|
229
|
+
return
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Copyright (c) 2026 enstarep <enstarep@rncyk.org> and other authors of stbdl
|
|
2
|
+
# License: https://github.com/theembodimentofdisharmony/stbdl/blob/main/LICENSE
|
|
3
|
+
|
|
4
|
+
import ctypes
|
|
5
|
+
from ctypes import wintypes
|
|
6
|
+
from typing import Optional
|
|
7
|
+
|
|
8
|
+
__version__: str
|
|
9
|
+
|
|
10
|
+
def window(path: Optional[str] = None, mode: int = 3) -> None: ...
|
|
11
|
+
def expansion() -> None: ...
|
|
12
|
+
def taskbar_switcher() -> wintypes.HWND: ...
|
|
13
|
+
def border(hwnd: wintypes.HWND) -> None: ...
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stbdl
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A simple taskbar decoration library
|
|
5
|
+
Home-page: https://github.com/theembodimentofdisharmony/stbdl
|
|
6
|
+
Author: enstarep
|
|
7
|
+
Author-email: enstarep@rncyk.org
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
12
|
+
Requires-Python: >=3.0
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Dynamic: author
|
|
16
|
+
Dynamic: author-email
|
|
17
|
+
Dynamic: classifier
|
|
18
|
+
Dynamic: description
|
|
19
|
+
Dynamic: description-content-type
|
|
20
|
+
Dynamic: home-page
|
|
21
|
+
Dynamic: license
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
Dynamic: requires-python
|
|
24
|
+
Dynamic: summary
|
|
25
|
+
|
|
26
|
+
# stbdl (Simple Taskbar Decoration Library)
|
|
27
|
+
|
|
28
|
+
Document: https://github.com/enstarep/rchp/blob/main/stbdl/README.md
|
|
29
|
+
|
|
30
|
+
Run the following command to install stbdl:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
pip install stbdl
|
|
34
|
+
```
|
|
35
|
+
No dependencies need to be installed.
|
|
36
|
+
|
|
37
|
+
stbdl supports Python 3.x on Windows
|
|
38
|
+
|
|
39
|
+
## Latest Version Changes:
|
|
40
|
+
1. Release 0.1.0 version
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
# stbdl (Simple Taskbar Decoration Library)
|
|
45
|
+
|
|
46
|
+
Run the following command to install stbdl:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
> pip install stbdl
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
No dependencies need to be installed.
|
|
53
|
+
|
|
54
|
+
stbdl supports Python 3.x on Windows 10+.
|
|
55
|
+
|
|
56
|
+
stbdl is a simple taskbar decoration library.
|
|
57
|
+
|
|
58
|
+
It mainly includes the following four functions:
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
def window(path: Optional[str] = None, mode: int = 3) -> None: ...
|
|
62
|
+
def expansion() -> None: ...
|
|
63
|
+
def taskbar_switcher() -> wintypes.HWND: ...
|
|
64
|
+
def border(hwnd: wintypes.HWND) -> None: ...
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
These functions are all under the `stbdl.*` namespace.
|
|
68
|
+
|
|
69
|
+
## `window` function
|
|
70
|
+
|
|
71
|
+
The parameter `path` is the path to the background image, **must be an absolute path**. If no value is provided, it defaults to loading `stbdl\white.png`.
|
|
72
|
+
The parameter `mode` is the dynamic style, with the following meanings:
|
|
73
|
+
```text
|
|
74
|
+
mode=0: Fade in/out
|
|
75
|
+
mode=1: Rotation
|
|
76
|
+
mode=2: Zoom
|
|
77
|
+
mode=3: Four-color cycle (red, green, blue, yellow)
|
|
78
|
+
mode=4: Color cycle
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
If no value is provided, it defaults to 3.
|
|
82
|
+
|
|
83
|
+
Also, the background window needs to be clicked on a blank area of the taskbar to bring the taskbar above it.
|
|
84
|
+
|
|
85
|
+
The `window` function returns no value.
|
|
86
|
+
|
|
87
|
+
**Tip: Do not run the window function multiple times, as this will create multiple stbdl processes (but they can be terminated using `taskkill /im stbdl.exe`)**
|
|
88
|
+
|
|
89
|
+
## `expansion` function
|
|
90
|
+
|
|
91
|
+
Enables the stbdl taskbar extension. The actual effect depends on system support. It prioritizes the mica effect (requires Windows 11), then the acrylic effect (requires Windows 10), and finally the blur effect.
|
|
92
|
+
|
|
93
|
+
The `expansion` function takes no parameters and returns no value.
|
|
94
|
+
|
|
95
|
+
## `taskbar_switcher` function
|
|
96
|
+
|
|
97
|
+
Gets the handle of the task switcher window (class name `MSTaskListWClass`). Returns None if not found.
|
|
98
|
+
|
|
99
|
+
The `taskbar_switcher` function takes no parameters.
|
|
100
|
+
|
|
101
|
+
## `border` function
|
|
102
|
+
|
|
103
|
+
Used to add a border to a specified window. It takes the handle of the target window as a parameter.
|
|
104
|
+
|
|
105
|
+
The `border` function returns no value.
|
|
106
|
+
|
|
107
|
+
## Example
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
import stbdl
|
|
111
|
+
|
|
112
|
+
stbdl.window()
|
|
113
|
+
|
|
114
|
+
stbdl.expansion()
|
|
115
|
+
|
|
116
|
+
h = stbdl.taskbar_switcher()
|
|
117
|
+
|
|
118
|
+
stbdl.border(h)
|
|
119
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
stbdl
|