summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCanop <cano.petrole@gmail.com>2022-07-09 09:47:24 +0200
committerCanop <cano.petrole@gmail.com>2022-07-09 09:47:24 +0200
commitf5b33c43c10795661b626330ee86f1979b0957f7 (patch)
tree3768f6aa0460caa5dcb39d70d12457194407300c
parentd4751c863011bf2583b07942363df3f70db37d97 (diff)
use mio instead of epoll to find terminal's lumaterminal-light-mio
For compatibiliy with more unix variants
-rw-r--r--Cargo.lock17
-rw-r--r--Cargo.toml5
-rw-r--r--src/display/luma.rs6
3 files changed, 15 insertions, 13 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 7357191..d8cc4ae 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -187,7 +187,7 @@ dependencies = [
"umask",
"unicode-width",
"users",
- "xterm-query",
+ "xterm-query 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -1863,13 +1863,12 @@ dependencies = [
[[package]]
name = "terminal-light"
version = "0.8.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f279e95099c18b04b1b5dcab98fa6f2a50908754cbf453ddbb99c392b7d662d1"
+source = "git+https://github.com/Canop/terminal-light?branch=mio#2077bc03573b61f967aec001a6f64da78f11a5eb"
dependencies = [
"coolor",
"crossterm",
"thiserror",
- "xterm-query",
+ "xterm-query 0.1.0 (git+https://github.com/Canop/xterm-query?branch=mio)",
]
[[package]]
@@ -2237,6 +2236,16 @@ dependencies = [
]
[[package]]
+name = "xterm-query"
+version = "0.1.0"
+source = "git+https://github.com/Canop/xterm-query?branch=mio#0a6bb9438ae532931a363e02922a71c5e775bbe7"
+dependencies = [
+ "mio",
+ "nix",
+ "thiserror",
+]
+
+[[package]]
name = "yaml-rust"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index 568c8eb..430d549 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -59,6 +59,7 @@ syntect = { package = "syntect-no-panic", version = "4.6.1" } # see issue #485
tempfile = "3.2"
termimad = "0.20.2"
terminal-clipboard = { version = "0.3.1", optional = true }
+terminal-light = { version = "0.8.1", git = "https://github.com/Canop/terminal-light", branch = "mio" }
toml = "0.5"
umask = "2.0.0"
unicode-width = "0.1.8"
@@ -71,9 +72,6 @@ glassbench = "0.3.3"
lfs-core = "0.11.0"
users = "0.11"
-[target.'cfg(target_os = "linux")'.dependencies]
-terminal-light = "0.8.1"
-
[target.'cfg(windows)'.dependencies]
is_executable = "1.0.1"
@@ -118,5 +116,6 @@ harness = false
# syntect = { path = "../syntect" }
# syntect-no-panic = { path = "../syntect" }
# termimad = { path = "../termimad" }
+# terminal-light = { path = "../terminal-light" }
# terminal-clipboard = { path = "../terminal-clipboard" }
# umask = { path = "../umask" }
diff --git a/src/display/luma.rs b/src/display/luma.rs
index 479e4c9..c9e9105 100644
--- a/src/display/luma.rs
+++ b/src/display/luma.rs
@@ -15,7 +15,6 @@ pub enum Luma {
/// Return the light of the terminal background, which is a value
/// between 0 (black) and 1 (white).
-#[cfg(target_os = "linux")]
pub fn luma() -> &'static Result<f32, terminal_light::TlError> {
static LUMA: Lazy<Result<f32, terminal_light::TlError>> = Lazy::new(|| {
let luma = time!(Debug, terminal_light::luma());
@@ -25,11 +24,6 @@ pub fn luma() -> &'static Result<f32, terminal_light::TlError> {
&*LUMA
}
-#[cfg(not(target_os = "linux"))]
-pub fn luma() -> Result<&'static f32, &'static str> {
- Err("not implemented on this OS")
-}
-
impl Luma {
pub fn read() -> Self {
match luma() {