Compare commits
No commits in common. "dd09ee24166d7558d90621197b58facd367176f1" and "14782da7ce10fb96cfe8e28411222dbe398d7fc3" have entirely different histories.
dd09ee2416
...
14782da7ce
2 changed files with 15 additions and 10 deletions
10
readme.txt
10
readme.txt
|
@ -1,10 +0,0 @@
|
||||||
a simple crosshair overlay for wayland!
|
|
||||||
|
|
||||||
requires wlr_layer_shell, check if your compositor supports that at https://wayland.app/protocols/wlr-layer-shell-unstable-v1#compositor-support
|
|
||||||
|
|
||||||
|
|
||||||
install by running:
|
|
||||||
`cargo install --git https://git.xunuwu.xyz/xun/crosshair-overlay`
|
|
||||||
|
|
||||||
usage:
|
|
||||||
run crosshair-overlay while in a directory with a file called crosshair.png containing the crosshair you want to use
|
|
15
src/main.rs
15
src/main.rs
|
@ -67,6 +67,17 @@ fn main() -> Result<()> {
|
||||||
layer_surface_data.clone(),
|
layer_surface_data.clone(),
|
||||||
);
|
);
|
||||||
layer_surface.set_size(img.width(), img.height());
|
layer_surface.set_size(img.width(), img.height());
|
||||||
|
// layer_surface
|
||||||
|
// .set_anchor(zwlr_layer_surface_v1::Anchor::Top | zwlr_layer_surface_v1::Anchor::Left);
|
||||||
|
|
||||||
|
// let screen_height = 1080;
|
||||||
|
// let screen_width = 1920;
|
||||||
|
// layer_surface.set_margin(
|
||||||
|
// screen_height / 2 - img.width() as i32 / 2,
|
||||||
|
// 0,
|
||||||
|
// 0,
|
||||||
|
// screen_width / 2 - img.height() as i32 / 2,
|
||||||
|
// );
|
||||||
layer_surface.set_exclusive_zone(-1); // ignore other exclusive zones
|
layer_surface.set_exclusive_zone(-1); // ignore other exclusive zones
|
||||||
|
|
||||||
surface.commit();
|
surface.commit();
|
||||||
|
@ -74,6 +85,7 @@ fn main() -> Result<()> {
|
||||||
while !layer_surface_data.read().unwrap().0 {
|
while !layer_surface_data.read().unwrap().0 {
|
||||||
queue.blocking_dispatch(&mut state)?;
|
queue.blocking_dispatch(&mut state)?;
|
||||||
}
|
}
|
||||||
|
// let (_, width, height) = *layer_surface_data.read().unwrap();
|
||||||
|
|
||||||
let mut memfile = {
|
let mut memfile = {
|
||||||
let memfile = memfd::MemfdOptions::default()
|
let memfile = memfd::MemfdOptions::default()
|
||||||
|
@ -107,6 +119,9 @@ fn main() -> Result<()> {
|
||||||
surface.attach(Some(&buffer), 0, 0);
|
surface.attach(Some(&buffer), 0, 0);
|
||||||
surface.commit();
|
surface.commit();
|
||||||
|
|
||||||
|
// layer_surface.set_margin(10, 10, 10, 10);
|
||||||
|
// surface.commit();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
debug!("dispatched!");
|
debug!("dispatched!");
|
||||||
queue.blocking_dispatch(&mut state)?;
|
queue.blocking_dispatch(&mut state)?;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue