Skip to content

Commit e4a91f5

Browse files
committed
update documentation and composition xglass following azure specifications
1 parent cbb67e2 commit e4a91f5

4 files changed

Lines changed: 280 additions & 164 deletions

File tree

extensions/xglass/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
All important modifications to this VSCode theme collection will be documented in this file.
44

55
---
6+
## [1.0.1]
7+
- Fixed package json, activation events was deleted following the standard
8+
- Added activation event onCommand:xglass.enable.
9+
- Updated packages
10+
- Updated compatibility
11+
- Fixed alpha value range
12+
- Improved documentation
13+
614

715
## [1.0.0]
816
- Initial release

extensions/xglass/README.md

Lines changed: 158 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,170 @@
11
# XGlass for VS Code
22

3-
An extension that makes your editor looks like glass.
3+
An extension that makes your editor look like glass by adjusting the window’s transparency—**only when you ask it to**.
44

55
![Preview](https://raw.githubusercontent.com/xscriptordev/vscode/main/extensions/xglass/images/preview.png)
66

77
## Features
8-
- Change the window transparency using keyboard shortcuts.
9-
- Configure the level and step size from VS Code settings.
8+
9+
* Change the window transparency via **commands** or **keyboard shortcuts**.
10+
* Configure default level and step size in **Settings**.
11+
* Works on **Windows** (native Win32 API via in-memory C# helper) and **Linux (X11/Xorg)**.
12+
13+
---
1014

1115
## Requirements
12-
- **Windows:** Windows 10+
13-
- **Linux:** Xorg session
14-
15-
```shell
16-
#make sure you have installed:
17-
sudo dnf install xorg-x11-utils
18-
sudo apt install x11-utils
19-
#or
20-
sudo pacman -S xorg-xprop
21-
#depending of your distro
22-
```
2316

24-
## Usage
25-
- `Ctrl + Alt + Z` → Increase transparency
26-
- `Ctrl + Alt + C` → Decrease transparency
17+
**Windows**
18+
19+
* Windows 10 or later.
20+
* PowerShell available in PATH (standard on Windows).
21+
22+
**Linux (X11/Xorg)**
23+
24+
* An Xorg session (Wayland is **not supported**).
25+
* `xprop` installed:
26+
27+
```bash
28+
# Fedora
29+
sudo dnf install xorg-x11-utils
30+
# Debian/Ubuntu
31+
sudo apt install x11-utils
32+
# Arch
33+
sudo pacman -S xorg-xprop
34+
```
35+
36+
---
37+
38+
## Activation (Opt-In)
39+
40+
XGlass **does not run automatically**. It only activates when you invoke one of its commands:
41+
42+
### Command Palette
43+
44+
1. Open the Command Palette (`Ctrl+Shift+P`)
45+
2. Type “xglass” and select one of:
46+
47+
* **xglass: Enable Transparency Mode** — sets default transparency (**150**)
48+
* **xglass: + transparency** — increase transparency (more transparent)
49+
* **xglass: - transparency** — decrease transparency (less transparent)
50+
* **xglass: full transparency** — minimum alpha (most transparent)
51+
* **xglass: No transparency** — restores full opacity
52+
53+
### Keyboard Shortcuts
54+
55+
* `Ctrl+Alt+Z`**+ transparency**
56+
* `Ctrl+Alt+C`**- transparency**
57+
* `Ctrl+Alt+X`**No transparency**
58+
59+
> You can change shortcuts in **File → Preferences → Keyboard Shortcuts**.
60+
61+
---
2762

2863
## Settings
29-
- `xglass.alpha`: Transparency level (1–255).
30-
- `xglass.step`: Step size when adjusting transparency.
3164

32-
## More information
33-
- [GitHub repository](https://github.com/xscriptordev/vscode)
34-
- [License](https://github.com/xscriptordev/vscode/blob/main/extensions/xglass/LICENSE.md)
65+
* `xglass.alpha` — Transparency level **1–255** (1 = most transparent, 255 = opaque).
66+
* `xglass.step` — Step size used by the increase/decrease commands (default: **10**).
67+
68+
The “Enable Transparency Mode” command uses alpha **150** by default.
69+
70+
---
71+
72+
## How It Works
73+
74+
### Windows (Win32 API via PowerShell + C#)
75+
76+
* On first use, the extension loads an **in-memory C# type** using PowerShell’s `Add-Type`.
77+
* The C# helper uses P/Invoke into `user32.dll` to:
78+
79+
* add `WS_EX_LAYERED` to the window’s extended style, and
80+
* call `SetLayeredWindowAttributes(hwnd, 0, alpha, LWA_ALPHA)`.
81+
82+
**Key calls (conceptual):**
83+
84+
```csharp
85+
// mark window as layered
86+
WS windowLong = User32.GetWindowLong(hWnd, GWL.EXSTYLE);
87+
User32.SetWindowLong(hWnd, GWL.EXSTYLE, windowLong | WS.EX_LAYERED);
88+
89+
// apply alpha (0–255)
90+
User32.SetLayeredWindowAttributes(hWnd, 0, alpha, LWA.ALPHA);
91+
```
92+
93+
**Why this approach?**
94+
It’s the standard Windows mechanism for per-window opacity; the helper runs in-memory (no extra binaries) and targets only the current VS Code process.
95+
96+
### Linux (X11/Xorg + xprop)
97+
98+
* Detects VS Code windows by process id (`pgrep 'code'` + `_NET_WM_PID`).
99+
* Sets `_NET_WM_WINDOW_OPACITY` using `xprop`:
100+
101+
```bash
102+
xprop -id <windowId> -f _NET_WM_WINDOW_OPACITY 32c \
103+
-set _NET_WM_WINDOW_OPACITY $(printf 0x%x $((0xffffffff * <alpha> / 255)))
104+
```
105+
106+
**Why this approach?**
107+
`_NET_WM_WINDOW_OPACITY` is the EWMH standard for opacity on X11; `xprop` is the canonical tool to set it.
108+
109+
> **Note:** Some window managers/compositors may ignore or override opacity settings.
110+
111+
---
112+
113+
## Security & Privacy
114+
115+
* **Activation model:** The extension **only activates on command** (`xglass.enable`, `xglass.increase`, `xglass.decrease`, `xglass.max`, `xglass.min`). It **does not** auto-run at startup.
116+
* **No telemetry / data collection:** No network calls, no personal data stored or transmitted.
117+
* **No elevation:** Does **not** require admin rights. Does **not** modify VS Code binaries.
118+
* **Scope:** Only adjusts **window attributes** (opacity) of the current VS Code process.
119+
* **Windows:** Loads a small **in-memory C# helper** via PowerShell (`Add-Type`). No additional files are written.
120+
* **Linux:** Uses `xprop` (X11 only). **Wayland not supported**.
121+
122+
---
123+
124+
## Compatibility & Limitations
125+
126+
* **Windows 10+**: Supported.
127+
* **Linux (X11/Xorg)**: Requires `xprop`; Wayland is **not** supported.
128+
* Certain WMs/compositors may not honor `_NET_WM_WINDOW_OPACITY`.
129+
* Accessibility: high transparency can reduce contrast; consider your theme/contrast needs.
130+
131+
---
132+
133+
## Troubleshooting
134+
135+
### Windows
136+
137+
* If you hit an execution policy error, ensure PowerShell can load in-memory types for the current session.
138+
* Ensure PowerShell is available in PATH (default on Windows).
139+
140+
### Linux
141+
142+
* Confirm you’re running **X11/Xorg**, not Wayland.
143+
* Ensure `xprop` is installed and callable from PATH.
144+
* If nothing changes, your WM/compositor may ignore opacity—check its settings or try another compositor.
145+
146+
### Uninstall / Reset
147+
148+
* Run **“xglass: No transparency”** to restore full opacity (255).
149+
* Disable or uninstall the extension from the Extensions view.
150+
151+
---
152+
153+
## Installation
154+
155+
* From VSIX:
156+
157+
```bash
158+
code --install-extension xglass-1.0.1.vsix
159+
```
160+
* Or search **“XGlass”** in the Extensions view and install.
161+
162+
---
163+
164+
## License
165+
166+
[MIT](./LICENSE.md)
167+
168+
**Repository:** [https://github.com/xscriptordev/vscode](https://github.com/xscriptordev/vscode)
169+
170+
---

0 commit comments

Comments
 (0)