-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Python3 poetry env. Add aarch64 build. Add build.sh.
- Loading branch information
meganerd
committed
Apr 5, 2024
1 parent
2d7377b
commit d36483e
Showing
8 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,29 @@ | ||
# night-vision | ||
Virtual cursor for LXC Containers running X11 display | ||
|
||
### Usage | ||
|
||
```bash | ||
$ ./night-vision {ms} | ||
``` | ||
|
||
`{ms}` Milliseconds delay between cursor iteration, default: 100 | ||
|
||
```bash | ||
# 50-ms delay is fine, 10-100 is probably the expected range | ||
$ ./night-vision 50 | ||
# 1-ms delay, uses more CPU resource naturally | ||
$ ./night-vision 1 | ||
``` | ||
|
||
### Building | ||
You can use a pre-made build or run: | ||
```bash | ||
$ g++ night-vision.cpp -o ./build/night-vision -lX11 | ||
``` | ||
|
||
### Python | ||
There is also a python release of night-vision in `./python` | ||
It uses more CPU resource, but is still viable at 100-ms delay | ||
|
||
The `./python` directory also includes a poetry virtual environment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
g++ night-vision.cpp -o ./build/night-vision -lX11 | ||
sha256sum ./build/night-vision > ./build/night-vision.sha256 | ||
md5sum ./build/night-vision > ./build/night-vision.md5 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ba3b4c3f23c5fb99201568d4f48b8ce9 ./build/night-vision |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
89d70e3e56c6afb811ae6fe35e545db70508487c6df22240b4b7ce5749a7d397 ./build/night-vision |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from Xlib import X, display | ||
import time | ||
|
||
d = display.Display() | ||
root = d.screen().root | ||
|
||
window = root.create_window(-10, -10, 20, 20, 1, X.CopyFromParent, | ||
X.InputOutput, X.CopyFromParent, | ||
background_pixel=d.screen().white_pixel, | ||
override_redirect=True) | ||
|
||
gc = window.create_gc() | ||
|
||
window.map() | ||
|
||
def draw_crosshair(): | ||
window.clear_area(0, 0, 20, 20) | ||
window.line(gc, 10, 0, 10, 20) | ||
window.line(gc, 0, 10, 20, 10) | ||
|
||
while True: | ||
pointer = root.query_pointer() | ||
x, y = pointer.root_x, pointer.root_y | ||
|
||
window.configure(x=x - 10, y=y - 10) | ||
|
||
draw_crosshair() | ||
|
||
d.flush() | ||
|
||
time.sleep(0.1) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[tool.poetry] | ||
name = "night-vision" | ||
version = "0.1.0" | ||
description = "Virtual cursor for LXC Containers running X11 display, Python release build" | ||
authors = ["meganerd <[email protected]>"] | ||
readme = "README.md" | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.11" | ||
python3-xlib = "^0.15" | ||
|
||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |