hyprcam 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.
hyprcam-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 mhdztr
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
hyprcam-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,413 @@
1
+ Metadata-Version: 2.4
2
+ Name: hyprcam
3
+ Version: 0.1.0
4
+ Summary: Frameless, tiled webcam window for Hyprland with live settings and OBS-friendly screen capture
5
+ Author-email: mhdztr <zakkithoriq@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/mhdztr/hyprcam
8
+ Project-URL: Source, https://github.com/mhdztr/hyprcam
9
+ Project-URL: Repository, https://github.com/mhdztr/hyprcam
10
+ Project-URL: Issues, https://github.com/mhdztr/hyprcam/issues
11
+ Project-URL: Documentation, https://github.com/mhdztr/hyprcam#readme
12
+ Project-URL: Changelog, https://github.com/mhdztr/hyprcam/blob/main/CHANGELOG.md
13
+ Project-URL: Releases, https://github.com/mhdztr/hyprcam/releases
14
+ Keywords: hyprland,wayland,webcam,v4l2,obs,qt,pyside6,opencv,screen-capture,arch-linux,tiling-window-manager
15
+ Classifier: Development Status :: 3 - Alpha
16
+ Classifier: Environment :: X11 Applications :: Qt
17
+ Classifier: Intended Audience :: End Users/Desktop
18
+ Classifier: Operating System :: POSIX :: Linux
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: Desktop Environment :: Window Managers
25
+ Classifier: Topic :: Multimedia :: Video :: Capture
26
+ Requires-Python: >=3.11
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Requires-Dist: PySide6>=6.6
30
+ Requires-Dist: opencv-python-headless>=4.8
31
+ Provides-Extra: dev
32
+ Requires-Dist: build>=1.0; extra == "dev"
33
+ Requires-Dist: mypy>=1.8; extra == "dev"
34
+ Requires-Dist: pytest>=7.0; extra == "dev"
35
+ Requires-Dist: ruff>=0.4; extra == "dev"
36
+ Dynamic: license-file
37
+
38
+ # hyprcam
39
+
40
+ [![CI](https://github.com/mhdztr/hyprcam/actions/workflows/ci.yml/badge.svg)](https://github.com/mhdztr/hyprcam/actions/workflows/ci.yml)
41
+ [![Release](https://img.shields.io/github/v/release/mhdztr/hyprcam)](https://github.com/mhdztr/hyprcam/releases)
42
+ [![License: MIT](https://img.shields.io/github/license/mhdztr/hyprcam)](LICENSE)
43
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11%20%7C%203.12%20%7C%203.13-blue)](https://www.python.org/downloads/)
44
+ [![PyPI](https://img.shields.io/pypi/v/hyprcam)](https://pypi.org/project/hyprcam/)
45
+ [![AUR](https://img.shields.io/aur/version/hyprcam)](https://aur.archlinux.org/packages/hyprcam)
46
+
47
+ > The PyPI and AUR badges display "not found" until the first PyPI upload and
48
+ > the AUR submission are live.
49
+
50
+ A minimal webcam window for [Hyprland](https://hypr.land/). It opens as a normal
51
+ **tiled, frameless** window, so OBS can capture your face by recording a region
52
+ of the screen — no virtual camera, no OBS overlay, no `ffplay` wrapper, no video
53
+ mixer configuration.
54
+
55
+ The video window has no chrome or controls. Right-click it (or use
56
+ `hyprcam --settings`) to open the settings dialog.
57
+
58
+ > **Status:** early-stage (v0.1.0), Linux/V4L2 only. AUR packaging and PyPI
59
+ > publishing are prepared in this repository but no package has been submitted
60
+ > or published yet. See [Installation](#installation) and
61
+ > [Publishing](#publishing-maintainers).
62
+
63
+ ## Contents
64
+
65
+ - [Highlights](#highlights)
66
+ - [Requirements](#requirements)
67
+ - [Installation](#installation)
68
+ - [Hyprland setup](#hyprland-setup)
69
+ - [Usage](#usage)
70
+ - [Configuration](#configuration)
71
+ - [Device discovery](#device-discovery)
72
+ - [OBS workflow](#obs-workflow)
73
+ - [Screenshots](#screenshots)
74
+ - [Troubleshooting](#troubleshooting)
75
+ - [FAQ](#faq)
76
+ - [Publishing (maintainers)](#publishing-maintainers)
77
+ - [Development](#development)
78
+ - [Contributing](#contributing)
79
+ - [License](#license)
80
+
81
+ ## Highlights
82
+
83
+ - **Direct V4L2 capture** through OpenCV (`cv2.VideoCapture` with `CAP_V4L2`); no
84
+ portal or PipeWire virtual device needed.
85
+ - **Tiled by default.** The frameless window behaves like any other Hyprland
86
+ client, so it is easy to region-capture from OBS.
87
+ - **Two window titles for rules:** `hyprcam` (tiled) and `hyprcam-float`
88
+ (floating). The settings dialog uses `hyprcam-settings`.
89
+ - **Settings that apply live.** Device, resolution, FPS, pixel format, mirroring
90
+ and floating state update without restarting; **Apply** saves them to TOML.
91
+ - **CLI overrides** for one-off launches, on top of a validated config file with
92
+ sane defaults.
93
+ - **Single-key toggle.** `hyprcam-toggle` uses a pidfile in `$XDG_RUNTIME_DIR`
94
+ and works with a `Super+B` binding.
95
+ - **Device discovery.** `hyprcam --list-devices` uses `v4l2-ctl` when available,
96
+ with an OpenCV `/dev/video*` probe fallback.
97
+ - **Small, testable core.** 17 tests cover config, CLI and device discovery; CI
98
+ runs lint, format, type checks and tests on Python 3.11–3.13.
99
+
100
+ ## Requirements
101
+
102
+ - Linux with a V4L2 webcam exposed as `/dev/video*`.
103
+ - Python 3.11 or newer.
104
+ - Qt 6 via PySide6 and OpenCV (installed by pip, or from Arch system packages).
105
+ - Hyprland for the suggested keybinding and window rules. The Qt window itself
106
+ also runs on other Wayland/X11 desktops, but the rules and `hyprctl` calls are
107
+ Hyprland-specific.
108
+ - Optional: `v4l-utils` for detailed device and format reporting.
109
+
110
+ ## Installation
111
+
112
+ Pick one path. All of them provide the same `hyprcam` and `hyprcam-toggle`
113
+ commands.
114
+
115
+ ### Arch Linux / AUR packaging
116
+
117
+ AUR-ready files live in [`packaging/aur/`](packaging/aur/) (`PKGBUILD`,
118
+ `.SRCINFO` and submission notes). **No AUR package has been submitted yet**, so
119
+ build and install it locally for now:
120
+
121
+ ```sh
122
+ sudo pacman -S --needed base-devel
123
+ git clone https://github.com/mhdztr/hyprcam.git
124
+ cd hyprcam/packaging/aur
125
+ makepkg -si
126
+ ```
127
+
128
+ The package builds from the `v0.1.0` source tarball with
129
+ `python -m build --wheel --no-isolation` and installs the wheel with
130
+ `python -m installer`, using Arch's system `pyside6`, `python-opencv` and
131
+ `python` packages. Once a package is listed on AUR, the usual
132
+ `yay -S hyprcam` (or another AUR helper) will work instead. See
133
+ [`packaging/aur/AUR-README.md`](packaging/aur/AUR-README.md) for the exact
134
+ submission commands.
135
+
136
+ ### pip / PyPI
137
+
138
+ There is no PyPI release yet — publishing is opt-in and gated (see below). The
139
+ tagged Git source can already be installed with pip:
140
+
141
+ ```sh
142
+ python3 -m pip install 'git+https://github.com/mhdztr/hyprcam.git@v0.1.0'
143
+ hyprcam --list-devices
144
+ ```
145
+
146
+ After the first successful publish workflow run, the normal path becomes:
147
+
148
+ ```sh
149
+ python3 -m pip install hyprcam
150
+ ```
151
+
152
+ A virtual environment is recommended (`python3 -m venv .venv && . .venv/bin/activate`).
153
+
154
+ ### Source checkout (Arch system packages)
155
+
156
+ Install the runtime libraries from pacman, then run the idempotent user
157
+ installer from a checkout:
158
+
159
+ ```sh
160
+ sudo pacman -S pyside6 python-opencv v4l-utils
161
+ git clone https://github.com/mhdztr/hyprcam.git
162
+ cd hyprcam
163
+ chmod +x scripts/hyprcam-install-user
164
+ ./scripts/hyprcam-install-user
165
+ ```
166
+
167
+ It creates `~/.local/bin/hyprcam` and `~/.local/bin/hyprcam-toggle` symlinks,
168
+ installs `hyprcam.desktop` into `~/.local/share/applications/`, and seeds
169
+ `~/.config/hyprcam/config.toml` from `config.example.toml` without overwriting
170
+ an existing config. Re-running it is safe; if `~/.local/bin` is not on `PATH`, it
171
+ prints a warning instead of failing.
172
+
173
+ Make sure `~/.local/bin` is on your `PATH`, or `hyprcam` only works by full path
174
+ and the desktop entry's `Exec=hyprcam` will fail. For zsh, uncomment (or add)
175
+ this line in `~/.zshrc`, above the Oh My Zsh setup:
176
+
177
+ ```sh
178
+ export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
179
+ ```
180
+
181
+ For fish, add this near the top of `~/.config/fish/config.fish`:
182
+
183
+ ```fish
184
+ fish_add_path $HOME/.local/bin
185
+ ```
186
+
187
+ Open a new shell (or re-login) and confirm `command -v hyprcam` prints a path.
188
+ Desktop environments pick up the installed `.desktop` file on next login;
189
+ `update-desktop-database ~/.local/share/applications` refreshes it immediately.
190
+
191
+ The wrapper scripts resolve their own real path with `readlink -f`, add `src/`
192
+ to `PYTHONPATH`, and exec `python3 -m hyprcam`, so symlinks work without
193
+ installing the package. Alternatively use an editable install for development:
194
+
195
+ ```sh
196
+ python3 -m pip install -e '.[dev]'
197
+ ```
198
+
199
+ ## Hyprland setup
200
+
201
+ Add a variable in `variables.lua` under `-- Apps`:
202
+
203
+ ```lua
204
+ kbHyprcam = "SUPER + B",
205
+ ```
206
+
207
+ Add the bind in `hyprland/keybinds.lua` under `-- Apps`:
208
+
209
+ ```lua
210
+ create_bind(vars.kbHyprcam, hl.dsp.exec_cmd("~/.local/bin/hyprcam-toggle"))
211
+ ```
212
+
213
+ Add the rules in `hyprland/rules.lua` under `-- Per app rules`:
214
+
215
+ ```lua
216
+ -- hyprcam: frameless tiled camera window; floating variant selected by title
217
+ hl.window_rule({ match = { title = "^hyprcam$" }, border_size = 0, tile = true })
218
+ hl.window_rule({ match = { title = "^hyprcam-float$" }, border_size = 0, float = true, size = "480 360", center = true })
219
+ hl.window_rule({ match = { title = "^hyprcam-settings$" }, float = true, size = "520 420", center = true })
220
+ ```
221
+
222
+ Then run `hyprctl reload` and confirm `hyprctl configerrors` is clean. The
223
+ equivalent legacy `.conf` lines are:
224
+
225
+ ```conf
226
+ bind = SUPER, B, exec, ~/.local/bin/hyprcam-toggle
227
+ windowrulev2 = noborder, class:^hyprcam$
228
+ windowrulev2 = float, title:^hyprcam-float$
229
+ ```
230
+
231
+ Press `Super+B` to open the tiled camera; press it again to close it.
232
+
233
+ ## Usage
234
+
235
+ ```sh
236
+ hyprcam # launch with saved defaults
237
+ hyprcam --settings # launch and open settings
238
+ hyprcam --list-devices # list cameras and formats
239
+ hyprcam --device /dev/video1 --width 1280 --height 720 --fps 30
240
+ hyprcam --pixel-format YUYV --no-mirror # FOURCC and mirroring
241
+ hyprcam --float # floating variant for this launch
242
+ hyprcam --no-float # force tiled variant
243
+ hyprcam --config /path/to/config.toml # alternative config file
244
+ hyprcam-toggle # same action as Super+B
245
+ ```
246
+
247
+ Right-click the video window to open settings. Changes in the dialog apply
248
+ live; **Apply** writes the current values back to the TOML file. The dialog has
249
+ a normal decorated window (title `hyprcam-settings`) and is placed by the rule
250
+ above.
251
+
252
+ ## Configuration
253
+
254
+ Location: `~/.config/hyprcam/config.toml`, or
255
+ `$XDG_CONFIG_HOME/hyprcam/config.toml` when that variable is set. See
256
+ [`config.example.toml`](config.example.toml). The user installer seeds this file
257
+ on first run; until then hyprcam uses built-in defaults.
258
+
259
+ ```toml
260
+ device = "/dev/video0"
261
+ width = 640
262
+ height = 480
263
+ fps = 30
264
+ pixel_format = "MJPG"
265
+ mirror = true
266
+ float = false
267
+ ```
268
+
269
+ | Key | Default | Meaning |
270
+ | --- | --- | --- |
271
+ | `device` | `/dev/video0` | V4L2 device path; see `hyprcam --list-devices`. |
272
+ | `width` | `640` | Requested capture width (160–4096 in the dialog). |
273
+ | `height` | `480` | Requested capture height (120–4096 in the dialog). |
274
+ | `fps` | `30` | Requested frame rate (1–240 in the dialog). |
275
+ | `pixel_format` | `MJPG` | Four-character FOURCC code. |
276
+ | `mirror` | `true` | Flip the image horizontally. |
277
+ | `float` | `false` | Tiled `hyprcam` window; `true` selects `hyprcam-float`. |
278
+
279
+ Precedence: **built-in defaults → config file → command-line flags**. Invalid or
280
+ missing values fall back to defaults rather than crashing the app.
281
+
282
+ `pixel_format` is a four-character FOURCC code. The requested format is tried
283
+ first; MJPG, YUYV and YUY2 are then tried as fallbacks (MJPG usually gives a
284
+ usable frame rate). The settings dialog offers MJPG, YUYV, YUY2, NV12 and H264.
285
+
286
+ When float is toggled in the dialog, hyprcam updates the title and asks Hyprland
287
+ to change the window state via `hyprctl dispatch`. If your Hyprland version
288
+ rejects that dispatcher, close and reopen the window once to pick up the rule.
289
+
290
+ ## Device discovery
291
+
292
+ ```text
293
+ $ hyprcam --list-devices
294
+ /dev/video0 [available] (Integrated Camera, formats: MJPG, YUYV)
295
+ ```
296
+
297
+ `hyprcam --list-devices` uses `v4l2-ctl --list-devices` (from `v4l-utils`) when
298
+ available, including the camera name and supported FOURCC formats. If it is not
299
+ installed or the camera is busy, hyprcam probes `/dev/video*` with OpenCV and
300
+ reports each device as `available` or `busy or unavailable` instead of failing.
301
+
302
+ ## OBS workflow
303
+
304
+ 1. Open hyprcam with `Super+B` (or `hyprcam`); it tiles on your current workspace.
305
+ 2. In OBS, add a **Display Capture (Wayland)** or **Window Capture** source.
306
+ 3. Select/region-capture the tiled hyprcam window and crop to your face.
307
+ 4. Leave the window tiled and unobstructed — OBS records the tiled feed
308
+ directly, without a separate camera source or overlay.
309
+
310
+ For best results, request a capture size that matches your OBS canvas (for
311
+ example 1280×720 at 30 FPS via config or CLI flags) and use MJPG if your camera
312
+ supports it. hyprcam does not create a virtual camera device and does not
313
+ record or stream anything itself.
314
+
315
+ ## Screenshots
316
+
317
+ No screenshots are bundled yet. To add one for a future release: launch hyprcam
318
+ in tiled mode, run `grim -g "$(slurp)" docs/screenshots/tiled.png` (requires
319
+ `grim` and `slurp`), and commit the image with a short caption. For the settings
320
+ dialog, run `hyprcam --settings` first and repeat the capture.
321
+
322
+ ## Troubleshooting
323
+
324
+ - **No image / black window**: check `hyprcam --list-devices`; another app may
325
+ have the camera open. Close it and try again.
326
+ - **Poor frame rate**: switch `pixel_format` to `MJPG`, or lower width, height
327
+ or FPS.
328
+ - **Window not frameless**: make sure the Lua window rules above are loaded and
329
+ `hyprctl reload` succeeded; verify with `hyprctl clients` and
330
+ `hyprctl configerrors`.
331
+ - **Float change did not take effect**: some Hyprland versions only apply window
332
+ rules at window creation; close and reopen hyprcam.
333
+ - **Stale toggle state**: delete `$XDG_RUNTIME_DIR/hyprcam.pid` and press
334
+ `Super+B` again. The toggle prefers `~/.local/bin/hyprcam`, then falls back to
335
+ `python3 -m hyprcam`.
336
+ - **`Exec=hyprcam` fails from the desktop entry**: `~/.local/bin` is missing
337
+ from `PATH` in the desktop session; see the PATH notes above and re-login.
338
+ - **`hyprcam --list-devices` shows only `/dev/video*` with no name**: install
339
+ `v4l-utils` for detailed names and formats; the OpenCV fallback still works.
340
+
341
+ ## FAQ
342
+
343
+ **Is this a virtual camera for OBS?** No. It is a real window that you capture
344
+ with OBS Display/Window Capture. It does not use `v4l2loopback` or expose a new
345
+ `/dev/video*` device.
346
+
347
+ **Does it work outside Hyprland?** The Qt window and V4L2 capture can run on
348
+ other Linux desktops, but the toggle keybinding, window rules and float
349
+ dispatcher are Hyprland-specific. There is no xdg-desktop-portal fallback yet.
350
+
351
+ **Does hyprcam record, stream or apply effects?** No. It only displays live
352
+ frames. Mirroring is the only image transform today.
353
+
354
+ **Can I open two cameras at once?** Not yet. One device per process; per-device
355
+ profiles are on the feature ideas list.
356
+
357
+ **Is it on AUR or PyPI?** Not yet. AUR packaging and a gated PyPI workflow are
358
+ included, but the user must submit/publish them. See below.
359
+
360
+ **Why does my camera reject the requested resolution?** Cameras only support
361
+ discrete modes; OpenCV may silently pick a nearby one. Use
362
+ `hyprcam --list-devices` to see supported formats and try MJPG/YUYV with a
363
+ smaller size.
364
+
365
+ ## Publishing (maintainers)
366
+
367
+ Pushing a `v*` tag always builds an sdist and wheel and attaches them to a
368
+ GitHub Release via `.github/workflows/release.yml`.
369
+
370
+ PyPI publishing is opt-in so the workflow never fails before it is configured:
371
+
372
+ 1. Create/verify a PyPI account at <https://pypi.org/account/register/>.
373
+ 2. In the GitHub repository, go to **Settings → Secrets and variables →
374
+ Actions → Variables → New repository variable** and create
375
+ `ENABLE_PYPI_PUBLISH` with value `true`. Until this exists, the PyPI job is
376
+ skipped.
377
+ 3. On PyPI, open <https://pypi.org/manage/account/publishing/> and add a
378
+ **trusted publisher** with: PyPI Project Name `hyprcam`, Owner `mhdztr`,
379
+ Repository `hyprcam`, Workflow `Publish to PyPI`, Environment `pypi`.
380
+ 4. Push a new tag, for example
381
+ `git tag -a v0.2.0 -m "hyprcam v0.2.0" && git push origin v0.2.0`. The
382
+ `pypi` environment is created on first use. PyPI filenames are immutable, so
383
+ do not try to republish `v0.1.0`.
384
+
385
+ The workflow uses `pypa/gh-action-pypi-publish@release/v1` with OIDC
386
+ (`id-token: write`); no PyPI token is stored in the repository. A PyPI or AUR
387
+ badge will be added once those listings exist.
388
+
389
+ ## Development
390
+
391
+ ```sh
392
+ python3 -m pip install -e '.[dev]'
393
+ ruff check .
394
+ ruff format --check .
395
+ mypy src
396
+ pytest -q
397
+ ```
398
+
399
+ If the tools are installed but not on `PATH`, prefix with `python3 -m` (for
400
+ example `python3 -m ruff check .`). CI runs the same checks on Python 3.11–3.13
401
+ with `QT_QPA_PLATFORM=offscreen`; tests do not need a camera.
402
+
403
+ ## Contributing
404
+
405
+ Bug reports, feature requests and pull requests are welcome. Start with
406
+ [`CONTRIBUTING.md`](CONTRIBUTING.md), the
407
+ [issue templates](.github/ISSUE_TEMPLATE/), the
408
+ [pull request template](.github/PULL_REQUEST_TEMPLATE.md), the
409
+ [changelog](CHANGELOG.md) and the [code of conduct](CODE_OF_CONDUCT.md).
410
+
411
+ ## License
412
+
413
+ MIT © 2026 mhdztr. See [LICENSE](LICENSE).