ActivityWatch / aw-watcher-window-wayland

Window and AFK watcher for some Wayland compositors
Mozilla Public License 2.0
57 stars 14 forks source link

Result::unwrap() value: missing #2

Closed tivvit closed 4 years ago

tivvit commented 4 years ago

Hi, thanks for solving #1 so quickly.

I encountered another issue (I am on Fedora 30)

RUST_BACKTRACE=1 cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.12s
     Running `target/debug/aw-watcher-window-wayland`
### Setting up display
### Fetching wayland globals
### Setting up toplevel manager
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Missing', src/libcore/result.rs:1165:5
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:77
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:61
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1028
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1412
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:65
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:50
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:188
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:205
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:464
  11: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:373
  12: rust_begin_unwind
             at src/libstd/panicking.rs:302
  13: core::panicking::panic_fmt
             at src/libcore/panicking.rs:139
  14: core::result::unwrap_failed
             at src/libcore/result.rs:1165
  15: core::result::Result<T,E>::unwrap
             at /rustc/87cbf0a547aaf9e8a7fc708851ecf4bc2adab5fd/src/libcore/result.rs:933
  16: aw_watcher_window_wayland::current_window::assign_toplevel_manager
             at src/current_window.rs:77
  17: aw_watcher_window_wayland::main
             at src/main.rs:68
  18: std::rt::lang_start::{{closure}}
             at /rustc/87cbf0a547aaf9e8a7fc708851ecf4bc2adab5fd/src/libstd/rt.rs:61
  19: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:48
  20: std::panicking::try::do_call
             at src/libstd/panicking.rs:287
  21: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:83
  22: std::panicking::try
             at src/libstd/panicking.rs:265
  23: std::panic::catch_unwind
             at src/libstd/panic.rs:396
  24: std::rt::lang_start_internal
             at src/libstd/rt.rs:47
  25: std::rt::lang_start
             at /rustc/87cbf0a547aaf9e8a7fc708851ecf4bc2adab5fd/src/libstd/rt.rs:61
  26: main
  27: __libc_start_main
  28: _start
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

I did not look into the code yet, I just wanted to report for now.

Maybe the issue is connected to the unsupported Wayland protocol you mention in the readme (I am not familiar with Wayland internals).

johan-bjareholt commented 4 years ago

Maybe the issue is connected to the unsupported Wayland protocol you mention in the readme (I am not familiar with Wayland internals).

Yes this is likely the case (since you use Fedora I also assume you use the Gnome desktop which doesn't support the wayland protocol this watcher uses).

I should probably make it print a proper error when it fails though rather than just making an unspecified unwrap.

johan-bjareholt commented 4 years ago

I have replaced all unwraps with expects now so there should be a proper error message when something fails. Unfortunately I can't fix the issue with it not working with Gnome though, they have to implement the wlr-foreign-toplevel-management wayland protocol for this application to work.

tivvit commented 4 years ago

I have replaced all unwraps with expects now so there should be a proper error message when something fails. Unfortunately I can't fix the issue with it not working with Gnome though, they have to implement the wlr-foreign-toplevel-management wayland protocol for this application to work.

I will try, but first I have to study Wayland and learn Rust better