From ecdfd589fa711220107e1647a7d2128d82dceba7 Mon Sep 17 00:00:00 2001 From: elkowar <5300871+elkowar@users.noreply.github.com> Date: Wed, 21 Oct 2020 23:38:44 +0200 Subject: [PATCH 1/2] add read-timeout to client --- src/main.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 758c7f4..50c6c8a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -127,6 +127,13 @@ impl OptAction { } } } + + fn is_server_command(&self) -> bool { + match self { + OptAction::OpenWindow { .. } => true, + _ => false, + } + } } fn try_main() -> Result<()> { @@ -137,6 +144,7 @@ fn try_main() -> Result<()> { stream.write_all(&bincode::serialize(&opts)?)?; let mut buf = String::new(); + stream.set_read_timeout(Some(std::time::Duration::from_millis(100)))?; stream.read_to_string(&mut buf)?; println!("{}", buf); } else { @@ -154,7 +162,8 @@ fn try_main() -> Result<()> { } fn initialize_server(opts: Opt) -> Result<()> { - if opts.action == OptAction::KillServer { + if opts.action == OptAction::KillServer || !opts.action.is_server_command() { + println!("No eww server running"); return Ok(()); } From bde3197d02e0b125a2b88a0f474cc0012fa470f3 Mon Sep 17 00:00:00 2001 From: "ay9thqi3tbqiwbegqsg a[soiaosshasdg" <30902201+alx365@users.noreply.github.com> Date: Thu, 22 Oct 2020 16:31:39 +0000 Subject: [PATCH 2/2] added troubleshooting to the readme (and fixed a small naming convention issue) (#39) --- README.md | 21 ++++++++++++++++++++- src/widgets/widget_definitions.rs | 2 +- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ced413e..700dd3a 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ - [Prerequisites](#org727b3da) - [Installation](#orgdd31739) - [Usage](#org4a9b3c6) +- [Troubleshooting](#something) - [Contributing](#org12345) @@ -91,6 +92,24 @@ then copy the built binary from `./target/release` to anywhere in `$PATH` (examp Create a Config and then just do `eww`! + + +# Troubleshooting + +If you experience any issues, the following things should be tried: + +- Try killing the eww daemon with `eww kill` and run again +- If you're running with `-d`, run without `-d` to see output, or have a look at ~/.cache/eww.log +- use `eww state`, to see the state of all variables +- use `eww debug`, to see the xml of your widget and other information +- update to the latest eww version +- sometimes hot reloading doesn't work. restart the widget in that case + +If you're experiencing issues printing variables, try to print them in quotes, so e.g. +``` +onchange="notify-send '{}'" +``` + # Contributing @@ -100,5 +119,5 @@ If you want to contribute, like adding new widgets, features or subcommands, you ## Steps 1. Fork this repo 2. install dependencies ([Prerequisites](#org727b3da)) -3. smash your head against the keyboard +3. smash your head against the keyboard from frustration (coding is hard) 4. open a pull request once you're finished. diff --git a/src/widgets/widget_definitions.rs b/src/widgets/widget_definitions.rs index f056697..4fa6b92 100644 --- a/src/widgets/widget_definitions.rs +++ b/src/widgets/widget_definitions.rs @@ -157,7 +157,7 @@ fn build_gtk_expander(bargs: &mut BuilderArgs) -> Result { }); Ok(gtk_widget) } -/// @widget color button +/// @widget color-button fn build_gtk_color_button(bargs: &mut BuilderArgs) -> Result { let gtk_widget = gtk::ColorButtonBuilder::new().build(); let on_change_handler_id: Rc>> = Rc::new(RefCell::new(None));