Skip to content

Commit

Permalink
disable luma detection on non linux platform
Browse files Browse the repository at this point in the history
To fix compilation

See #573
  • Loading branch information
Canop committed Jul 6, 2022
1 parent 3454e1e commit d4751c8
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### v1.14.1 - 2022-07-06
<a name="v1.14.1"></a>
Due to a technical problem, background color based skin selection is disabled on non linux systems.

### v1.14.0 - 2022-07-05
<a name="v1.14.0"></a>
#### Major Feature: imports
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "broot"
version = "1.14.0"
version = "1.14.1"
authors = ["dystroy <denys.seguret@gmail.com>"]
repository = "https://github.com/Canop/broot"
documentation = "https://dystroy.org/broot"
Expand Down Expand Up @@ -59,7 +59,6 @@ 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 = "0.8.1"
toml = "0.5"
umask = "2.0.0"
unicode-width = "0.1.8"
Expand All @@ -72,6 +71,9 @@ 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"

Expand Down
6 changes: 6 additions & 0 deletions src/display/luma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ 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());
Expand All @@ -24,6 +25,11 @@ 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() {
Expand Down
3 changes: 3 additions & 0 deletions website/docs/conf_file.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ Starting from version 1.14, the default configuration is released in several fil
!!! Note
Be careful when installing a configuration file from an unknown source: it may contain an arbitrary command to execute. Check it before importing it

!!! Note
Background color determination is currently disabled (always "unknown") on non linux systems. This is expected to be fixed.

# Default flags

Broot accepts a few flags at launch (the complete list is available with `broot --help`.
Expand Down

0 comments on commit d4751c8

Please sign in to comment.