From fc90d64289eaaeb85820198b402c1ce4d6d3015e Mon Sep 17 00:00:00 2001 From: Shinyzenith Date: Thu, 26 May 2022 23:48:55 +0530 Subject: [PATCH] [update] nix deps bump and add repology to readme --- Cargo.lock | 37 +++++++++++++++++++++---------------- Cargo.toml | 8 ++++---- README.md | 30 ++++++++++++++---------------- src/backend.rs | 21 ++++++++------------- src/wayshot.rs | 1 + 5 files changed, 48 insertions(+), 49 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index da069aeb..93a76afe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -73,19 +73,28 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "3.1.8" +version = "3.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71c47df61d9e16dc010b55dba1952a57d8c215dbb533fd13cdd13369aac73b1c" +checksum = "d2dbdf4bdacb33466e854ce889eee8dfd5729abf7ccd7664d0a2d60cd384440b" dependencies = [ "atty", "bitflags", + "clap_lex", "indexmap", - "os_str_bytes", "strsim", "termcolor", "textwrap", ] +[[package]] +name = "clap_lex" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a37c35f1112dad5e6e0b1adaff798507497a18fceeb30cceb3bae7d1427b9213" +dependencies = [ + "os_str_bytes", +] + [[package]] name = "color_quant" version = "1.1.0" @@ -225,9 +234,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.16" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ "cfg-if", ] @@ -282,9 +291,9 @@ dependencies = [ [[package]] name = "nix" -version = "0.20.2" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5e06129fb611568ef4e868c14b326274959aa70ff7776e9d55323531c374945" +checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf" dependencies = [ "bitflags", "cc", @@ -295,12 +304,11 @@ dependencies = [ [[package]] name = "nix" -version = "0.22.3" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf" +checksum = "8f17df307904acd05aa8e32e97bb20f2a0df1728bbc2d771ae8f9a90463441e9" dependencies = [ "bitflags", - "cc", "cfg-if", "libc", "memoffset", @@ -368,9 +376,6 @@ name = "os_str_bytes" version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" -dependencies = [ - "memchr", -] [[package]] name = "pkg-config" @@ -440,9 +445,9 @@ checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" [[package]] name = "smithay-client-toolkit" -version = "0.15.3" +version = "0.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1325f292209cee78d5035530932422a30aa4c8fda1a16593ac083c1de211e68a" +checksum = "8a28f16a97fa0e8ce563b2774d1e732dd5d4025d2772c5dba0a41a0f90a29da3" dependencies = [ "bitflags", "calloop", @@ -580,7 +585,7 @@ dependencies = [ "image", "log", "memmap2 0.5.3", - "nix 0.20.2", + "nix 0.24.1", "smithay-client-toolkit", "tempfile", ] diff --git a/Cargo.toml b/Cargo.toml index ffb6023a..c9f4c090 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,13 +18,13 @@ exclude = [ ] [dependencies] -clap = "3.1.6" +clap = "3.1.18" env_logger = { version = "0.9.0", default-features = false, features = ["atty", "termcolor"] } image = { version = "0.24", default-features = false, features = ["jpeg", "png"] } -log = "0.4.0" +log = "0.4.17" memmap2 = "0.5.3" -nix = "0.20" -smithay-client-toolkit = "0.15.3" +nix = "0.24.1" +smithay-client-toolkit = "0.15.4" tempfile = "3.3.0" [[bin]] diff --git a/README.md b/README.md index 91adc881..4b95800d 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ +
+

@@ -48,6 +50,7 @@ Pick a color, using ImageMagick: ```bash wayshot -s "$(slurp -p -f '%x %y %w %h')" --stdout | convert - -format '%[pixel:p{0,0}]' txt:- ``` + # Known bugs: Multi monitor systems break on `--slurp` usage. This is quite the tricky bug and will need some refactoring which we're currently working on. (https://github.com/waycrate/wayshot/issues/7) @@ -55,30 +58,25 @@ Multi monitor systems break on `--slurp` usage. This is quite the tricky bug and # Installation ## AUR: -`wayshot-git` & `wayshot-bin` have been packaged. -## OpenSuse Tumbleweed: -As root: -```bash -zypper addrepo https://download.opensuse.org/repositories/X11:Wayland/openSUSE_Tumbleweed/X11:Wayland.repo -zypper refresh -zypper install wayshot -``` +`wayshot-git` & `wayshot-bin` have been packaged. ## Compile time dependencies: -- rustup -- make + +- rustup +- make ## Compiling: -- `git clone https://github.com/waycrate/wayshot && cd wayshot` -- `make setup` -- `make` -- `sudo make install` + +- `git clone https://github.com/waycrate/wayshot && cd wayshot` +- `make setup` +- `make` +- `sudo make install` # Support: -1) https://matrix.to/#/#waycrate-tools:matrix.org -2) https://discord.gg/KKZRDYrRYW +1. https://matrix.to/#/#waycrate-tools:matrix.org +2. https://discord.gg/KKZRDYrRYW # Smithay Developers: diff --git a/src/backend.rs b/src/backend.rs index c280e439..01cb187b 100644 --- a/src/backend.rs +++ b/src/backend.rs @@ -13,7 +13,6 @@ use std::{ }; use nix::{ - errno::Errno, fcntl, sys::{memfd, mman, stat}, unistd, @@ -306,10 +305,9 @@ fn create_shm_fd() -> std::io::Result { ); return Ok(fd); } - Err(nix::Error::Sys(Errno::EINTR)) => continue, - Err(nix::Error::Sys(Errno::ENOSYS)) => break, - Err(nix::Error::Sys(errno)) => return Err(std::io::Error::from(errno)), - Err(err) => unreachable!("{}", err), + Err(nix::errno::Errno::EINTR) => continue, + Err(nix::errno::Errno::ENOSYS) => break, + Err(errno) => return Err(std::io::Error::from(errno)), } } @@ -336,14 +334,12 @@ fn create_shm_fd() -> std::io::Result { ) { Ok(fd) => match mman::shm_unlink(mem_file_handle.as_str()) { Ok(_) => return Ok(fd), - Err(nix::Error::Sys(errno)) => match unistd::close(fd) { + Err(errno) => match unistd::close(fd) { Ok(_) => return Err(std::io::Error::from(errno)), - Err(nix::Error::Sys(errno)) => return Err(std::io::Error::from(errno)), - Err(err) => panic!("{}", err), + Err(errno) => return Err(std::io::Error::from(errno)), }, - Err(err) => panic!("{}", err), }, - Err(nix::Error::Sys(Errno::EEXIST)) => { + Err(nix::errno::Errno::EEXIST) => { // If a file with that handle exists then change the handle mem_file_handle = format!( "/wayshot-{}", @@ -351,9 +347,8 @@ fn create_shm_fd() -> std::io::Result { ); continue; } - Err(nix::Error::Sys(Errno::EINTR)) => continue, - Err(nix::Error::Sys(errno)) => return Err(std::io::Error::from(errno)), - Err(err) => unreachable!("{}", err), + Err(nix::errno::Errno::EINTR) => continue, + Err(errno) => return Err(std::io::Error::from(errno)), } } } diff --git a/src/wayshot.rs b/src/wayshot.rs index 2be56c80..2f959369 100644 --- a/src/wayshot.rs +++ b/src/wayshot.rs @@ -139,6 +139,7 @@ fn main() -> Result<(), Box> { Ok(()) } +//TODO: This should be a part of output.rs which inturn should be merged into backend.rs /// Get a wl_output object from the output name. fn get_wloutput(name: String, valid_outputs: Vec<(WlOutput, OutputInfo)>) -> WlOutput { for device in valid_outputs.clone() {