hotfix: get $XDG_CURRENT_DESKTOP at runtime
This commit is contained in:
parent
11883050eb
commit
8f723df25b
1 changed files with 8 additions and 8 deletions
16
src/main.rs
16
src/main.rs
|
@ -1,8 +1,8 @@
|
||||||
use clap::Parser;
|
|
||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
use std::env;
|
use std::env::var;
|
||||||
use sysinfo::System;
|
use sysinfo::System;
|
||||||
use whoami::*;
|
use whoami::*;
|
||||||
|
use clap::Parser;
|
||||||
|
|
||||||
/// A simple and adorable sysinfo utility written in Rust.
|
/// A simple and adorable sysinfo utility written in Rust.
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
|
@ -16,7 +16,7 @@ struct Args {
|
||||||
#[arg(short = 'x', long)]
|
#[arg(short = 'x', long)]
|
||||||
arch: bool,
|
arch: bool,
|
||||||
|
|
||||||
/// Hide terminal colours
|
/// Hide terminal colours
|
||||||
#[arg(short = 'z', long, default_value_t = false)]
|
#[arg(short = 'z', long, default_value_t = false)]
|
||||||
hide_colours: bool,
|
hide_colours: bool,
|
||||||
}
|
}
|
||||||
|
@ -41,12 +41,14 @@ fn main() {
|
||||||
|
|
||||||
let kernel = System::kernel_version().unwrap_or(String::from("N/A"));
|
let kernel = System::kernel_version().unwrap_or(String::from("N/A"));
|
||||||
let pretty = distro();
|
let pretty = distro();
|
||||||
let mut wm: &str = "N/A";
|
let wm: &str;
|
||||||
|
|
||||||
if cfg!(windows) {
|
if cfg!(windows) {
|
||||||
wm = "Aero";
|
wm = "Aero";
|
||||||
} else if cfg!(unix) {
|
} else if cfg!(unix) {
|
||||||
wm = env!("XDG_CURRENT_DESKTOP");
|
wm = var("XDG_CURRENT_DESKTOP");
|
||||||
|
} else {
|
||||||
|
wm = "N/A";
|
||||||
}
|
}
|
||||||
|
|
||||||
println!();
|
println!();
|
||||||
|
@ -64,9 +66,7 @@ fn main() {
|
||||||
|
|
||||||
if !args.hide_colours && !args.ascii_only {
|
if !args.hide_colours && !args.ascii_only {
|
||||||
println!();
|
println!();
|
||||||
let colors = [
|
let colors = ["black", "red", "green", "yellow", "blue", "magenta", "cyan", "white"];
|
||||||
"black", "red", "green", "yellow", "blue", "magenta", "cyan", "white",
|
|
||||||
];
|
|
||||||
let mut color_string: String = " ".to_owned();
|
let mut color_string: String = " ".to_owned();
|
||||||
for color in colors {
|
for color in colors {
|
||||||
color_string.push_str(&format!("{:>3}", "●".color(color)));
|
color_string.push_str(&format!("{:>3}", "●".color(color)));
|
||||||
|
|
Loading…
Reference in a new issue