-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
21 changed files
with
1,065 additions
and
463 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,35 @@ | ||
[package] | ||
name = "i3lockr" | ||
version = "0.1.2" | ||
description = "Distort a screenshot and run i3lock" | ||
version = "1.0.0" | ||
license = "MIT OR Apache-2.0" | ||
edition = "2018" | ||
repository = "https://github.com/owenthewizard/i3lockr" | ||
keywords = ["i3", "i3lock", "i3lockr", "i3lock-color", "lock"] | ||
authors = ["Owen Walpole <[email protected]>"] | ||
description = "Distort a screenshot and run i3lock" | ||
publish = false | ||
repository = "https://github.com/owenthewizard/i3lockr" | ||
readme = "README.md" | ||
keywords = ["i3lockr", "i3lock", "i3lock-fancy", "blur", "i3lock-color" ] | ||
categories = ["command-line-utilities", "multimedia::images"] | ||
edition = "2018" | ||
|
||
[dependencies] | ||
#font-loader = "0.7.0" | ||
libc = "0.2.46" | ||
|
||
[dependencies.clap] | ||
version = "2.32.0" | ||
default-features = false | ||
features = ["yaml"] | ||
|
||
#[dependencies.structopt] | ||
#version = "0.2.14" | ||
#default-features = false | ||
libc = "0.2" # should be same as xcb | ||
num_cpus = "1" | ||
|
||
[dependencies.image] | ||
version = "0.21.0" | ||
[dependencies.structopt] | ||
version = "0.2" | ||
default-features = false | ||
features = ["png_codec"] | ||
|
||
[dependencies.xcb] | ||
version = "0.8.2" | ||
default-features = false | ||
features = ["randr"] | ||
version = "0.8" | ||
features = ["randr", "shm"] | ||
|
||
[dependencies.xcb-util] | ||
version = "0.2.0" | ||
default-features = false | ||
features = ["image"] | ||
[build-dependencies] | ||
cc = "1" | ||
|
||
[profile.release] | ||
codegen-units = 1 | ||
lto = "thin" | ||
|
||
[profile.bench] | ||
codegen-units = 1 | ||
lto = "thin" | ||
[features] | ||
suggestions = ["structopt/suggestions"] | ||
color = ["structopt/color"] | ||
default = ["suggestions", "color"] | ||
|
||
[profile.dev] | ||
opt-level = 2 | ||
[profile.release] | ||
lto = true | ||
codegen-units=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,30 +3,30 @@ | |
See the help: | ||
|
||
``` | ||
i3lockr v0.1.0 (unknown-branch@unknown-commit) | ||
i3lockr 1.0.0 | ||
Owen Walpole <[email protected]> | ||
Distort a screenshot and run i3lock | ||
USAGE: | ||
i3lockr [FLAGS] [OPTIONS] [i3lock]... | ||
FLAGS: | ||
-h, --help Prints help information | ||
--invert Draw the lock image as an invert mask on the background, i.e. invert every pixel on the background | ||
where the same pixel on the lock image has >50% alpha | ||
-V, --version Prints version information | ||
-v, --verbose Print how long each step takes, among other things. Always enabled in debug builds. | ||
-h, --help Prints help information | ||
--invert Interpret the icon as a mask, inverting masked pixels [NYI] on the screenshot. Try it to see an | ||
example. | ||
--one-icon Only place one icon. Default is to place an icon on each monitor. [NYI] | ||
-V, --version Prints version information | ||
OPTIONS: | ||
-d, --dark <dark> Darkens image by an amount [default: -36] | ||
-g, --gravity <gravity> Text position [default: south] [possible values: north, east, south, west] | ||
-i, --iter <iter> Number of blur iterations [default: 1] | ||
-l, --lock <lock> Path to lock image | ||
-f, --scale <scale> Scale factor for faux-blur. Divisor of 1, so 5 == 20% [default: 2] | ||
-s, --strength <strength> Blur strength [default: 3] | ||
-t, --text <text> Text to draw on the screen [UNINPLEMENTED] [default: ] | ||
-i, --icon <file.png> Path to icon to overlay on screenshot. [NYI] | ||
-u, --position <coords|center> Icon placement, "center" to center, [NYI] "x, y" (from top-left), or "-x,-y" (from | ||
bottom-right). Has no effect without --icon. Example: "(945, -20)" [default: | ||
Center] | ||
-b, --blur <radius> Blur strength. Example: 10 | ||
ARGS: | ||
<i3lock>... Args to pass to i3lock | ||
<i3lock>... Arguments to pass to i3lock. '--' must be used. Example: "-- --nofork --ignore-empty-password" | ||
``` | ||
|
||
[default.png](default.png) is embedded into the executable at build-time as the default lock image. | ||
Items marked `[NYI]` are `Not Yet Implemented` and may function partially or not at all. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,52 @@ | ||
use std::env; | ||
use std::path::Path; | ||
use std::process::Command; | ||
use std::time::{SystemTime, UNIX_EPOCH}; | ||
|
||
fn main() { | ||
println!("cargo:rustc-env=GIT_BRANCH=unknown-branch"); | ||
println!("cargo:rustc-env=GIT_HASH=unknown-commit"); | ||
if let Ok(output) = Command::new("git") | ||
.args(&["rev-parse", "--abbrev-ref", "HEAD"]) | ||
// Build C code for stackblur and statically link | ||
let c_src = Path::new("src").join("C"); | ||
cc::Build::new() | ||
.file(c_src.join("stackblur.c")) | ||
.include(c_src) | ||
.compile("stackblur"); | ||
// | ||
|
||
// Export build target, build time, and git commit | ||
println!( | ||
"cargo:rustc-env=TARGET={}", | ||
env::var("TARGET").unwrap_or("Unknown Target".to_owned()) | ||
); | ||
|
||
let mut git_branch = "Unknown Branch".to_owned(); | ||
let mut git_commit = "Unknown Commit".to_owned(); | ||
|
||
if let Ok(out) = Command::new("git") | ||
.args(vec!["rev-parse", "--abbrev-ref", "HEAD"]) | ||
.output() | ||
{ | ||
if output.status.success() { | ||
let git_branch = String::from_utf8(output.stdout).unwrap(); | ||
println!("cargo:rustc-env=GIT_BRANCH={}", git_branch); | ||
if !out.stdout.is_empty() { | ||
git_branch = String::from_utf8(out.stdout).unwrap_or("Unknown Branch".to_owned()); | ||
} | ||
} | ||
if let Ok(output) = Command::new("git").args(&["rev-parse", "HEAD"]).output() { | ||
if output.status.success() { | ||
let git_hash = String::from_utf8(output.stdout).unwrap(); | ||
println!("cargo:rustc-env=GIT_HASH={}", git_hash.get(0..7).unwrap()); | ||
|
||
if let Ok(out) = Command::new("git") | ||
.args(vec!["rev-parse", "--short", "HEAD"]) | ||
.output() | ||
{ | ||
if !out.stdout.is_empty() { | ||
git_commit = String::from_utf8(out.stdout).unwrap_or("Unknown Commit".to_owned()); | ||
} | ||
} | ||
|
||
// TODO: clap gen shell completion & manpages | ||
println!("cargo:rustc-env=GIT_BRANCH={}", git_branch); | ||
println!("cargo:rustc-env=GIT_COMMIT={}", git_commit); | ||
println!( | ||
"cargo:rustc-env=TIME={}", | ||
SystemTime::now() | ||
.duration_since(UNIX_EPOCH) | ||
.unwrap() | ||
.as_secs() | ||
); | ||
// | ||
} |
Binary file not shown.
Oops, something went wrong.