forked from michael/leanshot
include slop
This commit is contained in:
parent
129ca1e221
commit
cdf9f6f74f
11 changed files with 59 additions and 13 deletions
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "slop-sys/slop"]
|
||||||
|
path = slop-sys/slop
|
||||||
|
url = https://github.com/naelstrof/slop.git
|
17
Cargo.lock
generated
17
Cargo.lock
generated
|
@ -105,6 +105,14 @@ dependencies = [
|
||||||
"vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cmake"
|
||||||
|
version = "0.1.33"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"cc 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "failure"
|
name = "failure"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
|
@ -360,9 +368,17 @@ dependencies = [
|
||||||
"gdk-pixbuf 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gdk-pixbuf 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"gio 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gio 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"gtk 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gtk 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"slop-sys 0.1.0",
|
||||||
"time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "slop-sys"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"cmake 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strsim"
|
name = "strsim"
|
||||||
version = "0.7.0"
|
version = "0.7.0"
|
||||||
|
@ -470,6 +486,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
"checksum cc 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)" = "0ebb87d1116151416c0cf66a0e3fb6430cccd120fd6300794b4dfaa050ac40ba"
|
"checksum cc 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)" = "0ebb87d1116151416c0cf66a0e3fb6430cccd120fd6300794b4dfaa050ac40ba"
|
||||||
"checksum cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "405216fd8fe65f718daa7102ea808a946b6ce40c742998fbfd3463645552de18"
|
"checksum cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "405216fd8fe65f718daa7102ea808a946b6ce40c742998fbfd3463645552de18"
|
||||||
"checksum clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f0f16b89cbb9ee36d87483dc939fe9f1e13c05898d56d7b230a0d4dff033a536"
|
"checksum clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f0f16b89cbb9ee36d87483dc939fe9f1e13c05898d56d7b230a0d4dff033a536"
|
||||||
|
"checksum cmake 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)" = "704fbf3bb5149daab0afb255dbea24a1f08d2f4099cedb9baab6d470d4c5eefb"
|
||||||
"checksum failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "934799b6c1de475a012a02dab0ace1ace43789ee4b99bcfbf1a2e3e8ced5de82"
|
"checksum failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "934799b6c1de475a012a02dab0ace1ace43789ee4b99bcfbf1a2e3e8ced5de82"
|
||||||
"checksum failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c7cdda555bb90c9bb67a3b670a0f42de8e73f5981524123ad8578aafec8ddb8b"
|
"checksum failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c7cdda555bb90c9bb67a3b670a0f42de8e73f5981524123ad8578aafec8ddb8b"
|
||||||
"checksum gdk 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dd30051ff3d908ff2fc7e5776ffe1c699821e043809f294c3a61004f11d6c3a9"
|
"checksum gdk 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dd30051ff3d908ff2fc7e5776ffe1c699821e043809f294c3a61004f11d6c3a9"
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
name = "screenshot"
|
name = "screenshot"
|
||||||
version = "0.2.3"
|
version = "0.2.3"
|
||||||
authors = ["Michael Zhang <failed.down@gmail.com>"]
|
authors = ["Michael Zhang <failed.down@gmail.com>"]
|
||||||
build = "src/build.rs"
|
|
||||||
|
[workspace]
|
||||||
|
members = [".", "slop-sys"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = "2.31.2"
|
clap = "2.31.2"
|
||||||
|
@ -13,3 +15,4 @@ gdk-pixbuf = "0.4.0"
|
||||||
gio = "0.4.0"
|
gio = "0.4.0"
|
||||||
gtk = { version = "0.4.1", features = ["v3_16"] }
|
gtk = { version = "0.4.1", features = ["v3_16"] }
|
||||||
time = "0.1.40"
|
time = "0.1.40"
|
||||||
|
slop-sys = { path = "slop-sys" }
|
||||||
|
|
4
slop-sys/Cargo.lock
generated
Normal file
4
slop-sys/Cargo.lock
generated
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
[[package]]
|
||||||
|
name = "slop-sys"
|
||||||
|
version = "0.1.0"
|
||||||
|
|
13
slop-sys/Cargo.toml
Normal file
13
slop-sys/Cargo.toml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
[package]
|
||||||
|
name = "slop-sys"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Michael Zhang <failed.down@gmail.com>"]
|
||||||
|
build = "build.rs"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
path = "lib.rs"
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
cmake = "0.1"
|
||||||
|
|
||||||
|
[dependencies]
|
12
slop-sys/build.rs
Normal file
12
slop-sys/build.rs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
extern crate cmake;
|
||||||
|
|
||||||
|
use cmake::Config;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let dst = Config::new("slop").define("CMAKE_SKIP_RPATH", "ON").build();
|
||||||
|
println!("cargo:rustc-link-search=native={}", dst.display());
|
||||||
|
println!("cargo:rustc-link-lib=slopy");
|
||||||
|
|
||||||
|
// println!("cargo:rustc-link-lib=slopy");
|
||||||
|
// println!("cargo:rustc-link-search=native=/usr/lib/usr/lib/x86_64-linux-gnu");
|
||||||
|
}
|
1
slop-sys/slop
Submodule
1
slop-sys/slop
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 2196617d8e10bb4a4a1e4a1520af4cab890f1e00
|
|
@ -1,4 +0,0 @@
|
||||||
fn main() {
|
|
||||||
println!("cargo:rustc-link-lib=slopy");
|
|
||||||
println!("cargo:rustc-link-search=native=/usr/lib:/usr/lib/x86_64-linux-gnu");
|
|
||||||
}
|
|
11
src/main.rs
11
src/main.rs
|
@ -9,13 +9,13 @@ extern crate gdk;
|
||||||
extern crate gdk_pixbuf;
|
extern crate gdk_pixbuf;
|
||||||
extern crate gio;
|
extern crate gio;
|
||||||
extern crate gtk;
|
extern crate gtk;
|
||||||
|
extern crate slop_sys;
|
||||||
extern crate time;
|
extern crate time;
|
||||||
|
|
||||||
mod capture;
|
mod capture;
|
||||||
mod errors;
|
mod errors;
|
||||||
mod options;
|
mod options;
|
||||||
mod selection;
|
mod selection;
|
||||||
mod slop;
|
|
||||||
|
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
|
|
||||||
|
@ -42,22 +42,19 @@ fn run() -> Result<(), Error> {
|
||||||
.help("The region to be captured.")
|
.help("The region to be captured.")
|
||||||
.takes_value(false)
|
.takes_value(false)
|
||||||
.required(true),
|
.required(true),
|
||||||
)
|
).arg(
|
||||||
.arg(
|
|
||||||
Arg::with_name("output")
|
Arg::with_name("output")
|
||||||
.alias("o")
|
.alias("o")
|
||||||
.long("output")
|
.long("output")
|
||||||
.help("Specify the output file.")
|
.help("Specify the output file.")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.required(true),
|
.required(true),
|
||||||
)
|
).arg(
|
||||||
.arg(
|
|
||||||
Arg::with_name("clip")
|
Arg::with_name("clip")
|
||||||
.alias("c")
|
.alias("c")
|
||||||
.long("clip")
|
.long("clip")
|
||||||
.help("Copies the image to the clipboard if set."),
|
.help("Copies the image to the clipboard if set."),
|
||||||
)
|
).get_matches();
|
||||||
.get_matches();
|
|
||||||
let region = match app.value_of("region").unwrap() {
|
let region = match app.value_of("region").unwrap() {
|
||||||
"fullscreen" => Region::Fullscreen,
|
"fullscreen" => Region::Fullscreen,
|
||||||
"active" | "window" => Region::ActiveWindow,
|
"active" | "window" => Region::ActiveWindow,
|
||||||
|
|
|
@ -4,7 +4,7 @@ use failure::Error;
|
||||||
use gdk_pixbuf::{Pixbuf, PixbufExt};
|
use gdk_pixbuf::{Pixbuf, PixbufExt};
|
||||||
|
|
||||||
use errors::ScreenshotError;
|
use errors::ScreenshotError;
|
||||||
use slop::{slop_options, slop_select};
|
use slop_sys::{slop_options, slop_select};
|
||||||
|
|
||||||
pub fn select_area(pixbuf: Pixbuf) -> Result<Pixbuf, Error> {
|
pub fn select_area(pixbuf: Pixbuf) -> Result<Pixbuf, Error> {
|
||||||
let xdisplay = CString::new(":0")?.as_ptr();
|
let xdisplay = CString::new(":0")?.as_ptr();
|
||||||
|
|
Loading…
Reference in a new issue