Get rid of a lot of dependencies

This commit is contained in:
elkowar 2020-10-25 20:40:40 +01:00
parent 8c939fb054
commit 31ed9d0135
5 changed files with 6 additions and 80 deletions

71
Cargo.lock generated
View file

@ -247,16 +247,6 @@ dependencies = [
"syn 1.0.44",
]
[[package]]
name = "ctrlc"
version = "3.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b57a92e9749e10f25a171adcebfafe72991d45e7ec2dcb853e8f83d9dafaeb08"
dependencies = [
"nix 0.18.0",
"winapi 0.3.9",
]
[[package]]
name = "debug_stub_derive"
version = "0.3.0"
@ -310,7 +300,6 @@ dependencies = [
"anyhow",
"bincode",
"crossbeam-channel",
"ctrlc",
"debug_stub_derive",
"derive_more",
"extend",
@ -328,13 +317,11 @@ dependencies = [
"libc",
"log 0.4.11",
"maplit",
"nix 0.19.0",
"notify",
"nix",
"num",
"popol",
"pretty_assertions",
"pretty_env_logger",
"ref-cast",
"regex",
"roxmltree",
"scheduled-executor",
@ -343,7 +330,6 @@ dependencies = [
"smart-default",
"stoppable_thread",
"structopt",
"try_match",
]
[[package]]
@ -1061,18 +1047,6 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "nix"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83450fe6a6142ddd95fb064b746083fc4ef1705fe81f64a64e1d4b39f54a1055"
dependencies = [
"bitflags",
"cc",
"cfg-if",
"libc",
]
[[package]]
name = "nix"
version = "0.19.0"
@ -1511,26 +1485,6 @@ version = "0.1.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
[[package]]
name = "ref-cast"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "745c1787167ddae5569661d5ffb8b25ae5fedbf46717eaa92d652221cec72623"
dependencies = [
"ref-cast-impl",
]
[[package]]
name = "ref-cast-impl"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d21b475ab879ef0e315ad99067fa25778c3b0377f57f1b00207448dac1a3144"
dependencies = [
"proc-macro2",
"quote 1.0.7",
"syn 1.0.44",
]
[[package]]
name = "regex"
version = "1.3.9"
@ -2040,29 +1994,6 @@ dependencies = [
"serde",
]
[[package]]
name = "try_match"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "138279d5e35e72a1b3822588aaf928126f161491e3dd9c25758efe59ef6f0e1c"
dependencies = [
"proc-macro-hack",
"try_match_inner",
]
[[package]]
name = "try_match_inner"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc75c0dd3d842ee7316d2fb1d6ea2012291d279907ea8b9564f741358b5ef82e"
dependencies = [
"proc-macro-error",
"proc-macro-hack",
"proc-macro2",
"quote 1.0.7",
"syn 1.0.44",
]
[[package]]
name = "unicode-segmentation"
version = "1.6.0"

View file

@ -19,7 +19,6 @@ gdk-pixbuf = "0.9"
regex = "1"
bincode = "1.3"
try_match = "0.2.2"
anyhow = "1.0"
derive_more = "0.99"
maplit = "1"
@ -28,7 +27,6 @@ serde = {version = "1.0", features = ["derive"]}
extend = "0.3.0"
grass = "0.10"
hotwatch = "0.4"
notify = "4.0"
crossbeam-channel = "0.4"
num = "0.3"
stoppable_thread = "0.2"
@ -40,12 +38,10 @@ log = "0.4"
pretty_env_logger = "0.4"
lazy_static = "1.4.0"
libc = "0.2"
ref-cast = "1.0"
popol = "0.3"
nix = "0.19"
smart-default = "0.6"
filedescriptor = "0.7"
ctrlc = { version = "3.1", features = [ "termination" ] }
simple-signal = "1.1"
[dev-dependencies]

View file

@ -15,12 +15,11 @@ pub fn initialize_server(should_detach: bool, action: opts::ActionWithServer) ->
do_detach()?;
}
ctrlc::set_handler(|| {
simple_signal::set_handler(&[simple_signal::Signal::Int, simple_signal::Signal::Term], |_| {
println!("Shutting down eww daemon...");
script_var_handler::script_var_process::on_application_death();
std::process::exit(0);
})
.context("Error setting signal hook")?;
});
let config_file_path = crate::CONFIG_DIR.join("eww.xml");
let config_dir = config_file_path

View file

@ -1,5 +1,4 @@
use derive_more::*;
use ref_cast::RefCast;
use serde::{Deserialize, Serialize};
use std::fmt;
@ -12,7 +11,7 @@ pub use primitive::*;
/// The name of a variable
#[repr(transparent)]
#[derive(Clone, Hash, PartialEq, Eq, Serialize, Deserialize, RefCast, AsRef, From, FromStr, Display, DebugCustom)]
#[derive(Clone, Hash, PartialEq, Eq, Serialize, Deserialize, AsRef, From, FromStr, Display, DebugCustom)]
#[debug(fmt = "VarName({})", .0)]
pub struct VarName(pub String);
@ -30,7 +29,7 @@ impl From<&str> for VarName {
/// The name of an attribute
#[repr(transparent)]
#[derive(Clone, Hash, PartialEq, Eq, Serialize, Deserialize, RefCast, AsRef, From, FromStr, Display, DebugCustom)]
#[derive(Clone, Hash, PartialEq, Eq, Serialize, Deserialize, AsRef, From, FromStr, Display, DebugCustom)]
#[debug(fmt="AttrName({})", .0)]
pub struct AttrName(pub String);

View file

@ -97,6 +97,7 @@ impl PrimitiveValue {
parse_vec(self.0.to_owned()).map_err(|e| anyhow!("Couldn't convert {:#?} to a vec: {}", &self, e))
}
}
fn parse_vec(a: String) -> Result<Vec<String>> {
match a.strip_prefix('[').and_then(|x| x.strip_suffix(']')) {
Some(content) => {