Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pacman -S xcolor

Simply invoke the `xcolor` command to select a color. The selected color will be
printed to the standard output.
You can cancel the color picker by clicking right click.

``` text
xcolor 0.5.0
Expand Down
4 changes: 4 additions & 0 deletions src/location.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use crate::util::EnsureOdd;

// Left mouse button
const SELECTION_BUTTON: xproto::Button = 1;
const RIGHT_BUTTON: xproto::Button = 3;
const GRAB_MASK: u16 = (xproto::EVENT_MASK_BUTTON_PRESS | xproto::EVENT_MASK_POINTER_MOTION) as u16;

// Exclusively grabs the pointer so we get all its events
Expand Down Expand Up @@ -194,6 +195,9 @@ pub fn wait_for_location(

break Some(pixels[0]);
}
RIGHT_BUTTON => {
return Ok(None);
}
_ => {}
}
}
Expand Down