Skip to content

Commit

Permalink
Merge pull request #9 from Elvyria/master
Browse files Browse the repository at this point in the history
Hide mouse pointer if surface is fully dimmed
  • Loading branch information
marcelohdez authored Oct 13, 2024
2 parents fc2b774 + c5a1ff9 commit e010be3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion man/dim.1.scd
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ detected after its timeout, swaylock will be run, locking the screen.

\-a, --alpha <ALPHA>
Set the *alpha* value of the overlay, 0.0 being transparent and 1.0 being
solid black. Default is 0.5.
solid black. When solid, cursor will be hidden. Default is 0.5.

\--gen-completions <PATH>
Generates completions for all supported shells at the given path.
Expand Down
9 changes: 7 additions & 2 deletions src/dim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,12 +426,17 @@ impl PointerHandler for DimData {
&mut self,
_conn: &smithay_client_toolkit::reexports::client::Connection,
_qh: &QueueHandle<Self>,
_pointer: &wl_pointer::WlPointer,
pointer: &wl_pointer::WlPointer,
events: &[PointerEvent],
) {
for e in events {
match e.kind {
PointerEventKind::Enter { .. } | PointerEventKind::Leave { .. } => (),
PointerEventKind::Enter { serial } => {
if self.alpha == 1.0 {
pointer.set_cursor(serial, None, 0, 0);
}
},
PointerEventKind::Leave { .. } => {}
_ => {
debug!("Mouse event");
self.exit = true;
Expand Down
2 changes: 1 addition & 1 deletion src/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct DimOpts {
#[arg(
short,
long,
help = format!("0.0 is transparent, 1.0 is opaque, [default: {DEFAULT_ALPHA}]")
help = format!("0.0 is transparent, 1.0 is opaque. When opaque, cursor will be hidden. [default: {DEFAULT_ALPHA}]")
)]
pub alpha: Option<f32>,

Expand Down

0 comments on commit e010be3

Please sign in to comment.