l4l/yofi

Panic trying to run on wayland + gnome + manjaro

rajibahmed opened this issue ยท 7 comments

Hi,

first of all thank you for this initiative / project ๐Ÿ‘๐Ÿพ :). I can read rust and can try fix simple problems.

I tried to follow the instructions on README. I get this error

 Running `target/release/yofi`
thread 'main' panicked at '[SCTK] A missing global was required: zwlr_layer_shell_v1', /home/rajib/.cargo/registry/src/github.com-1ecc6299db9ec823/smithay-client-toolkit-0.12.1/src/environment.rs:183:21
stack backtrace:
   0:     0x564e6df41c7a - std::backtrace_rs::backtrace::libunwind::trace::h72c2fb8038f1bbee
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/../../backtrace/src/backtrace/libunwind.rs:96
   1:     0x564e6df41c7a - std::backtrace_rs::backtrace::trace_unsynchronized::h1e3b084883f1e78c
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/../../backtrace/src/backtrace/mod.rs:66
   2:     0x564e6df41c7a - std::sys_common::backtrace::_print_fmt::h3bf6a7ebf7f0394a
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/sys_common/backtrace.rs:79
   3:     0x564e6df41c7a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2e8cb764b7fe02e7
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/sys_common/backtrace.rs:58
   4:     0x564e6de0937c - core::fmt::write::h7a1184eaee6a8644
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/fmt/mod.rs:1080
   5:     0x564e6df413e1 - std::io::Write::write_fmt::haeeb374d93a67eac
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/io/mod.rs:1516
   6:     0x564e6df40ceb - std::sys_common::backtrace::_print::h1d14a7f6ad632dc8
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/sys_common/backtrace.rs:61
   7:     0x564e6df40ceb - std::sys_common::backtrace::print::h301abac8bb2e3e81
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/sys_common/backtrace.rs:48
   8:     0x564e6df40ceb - std::panicking::default_hook::{{closure}}::hde0cb80358a6920a
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:208
   9:     0x564e6df40ceb - std::panicking::default_hook::h9b1a691049a0ec8f
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:227
  10:     0x564e6df40ceb - std::panicking::rust_panic_with_hook::h2bdec87b60580584
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:577
  11:     0x564e6df5d058 - std::panicking::begin_panic_handler::{{closure}}::h101ca09d9df5db47
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:484
  12:     0x564e6df5d024 - std::sys_common::backtrace::__rust_end_short_backtrace::h3bb85654c20113ca
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/sys_common/backtrace.rs:153
  13:     0x564e6df5cfdd - rust_begin_unwind
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:483
  14:     0x564e6df5cfa0 - std::panicking::begin_panic_fmt::hf0503558fbe5b251
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:437
  15:     0x564e6dd99327 - yofi::main::h7f05fcf424576d39
  16:     0x564e6dd83223 - std::sys_common::backtrace::__rust_begin_short_backtrace::h14aaf3615dd2a315
  17:     0x564e6dda8605 - main
  18:     0x7fa16a09e152 - __libc_start_main
  19:     0x564e6dd7e0ae - _start
  20:                0x0 - <unknown>

Googling this zwlr_layer_shell_v1 - seems to have some issue with gnome. emersion/slurp#38 (comment)

Any ideas how to slove this ?

l4l commented

zwlr_layer_shell_v1 is a extension protocol from wlroots which apparently gnome will never support. Although unlike slurp I don't see any problem to make its support optional.

That're the lines where it sets up. require_global should be simply replaced with get_global. If layer_shell isn't presented window should be created (e.g. like this) instead. Thus the Surface should store smth like Either<Main<zwlr_layer_surface_v1::ZwlrLayerSurfaceV1>, wl_surface::WlSurface> (but better add a newtype, because they have different behavior on event handling).

Do you like to work on this? If so feel free to ask any related question right there, I'll try to answer them asap.

I will follow your comments and will create a PR for this later today :)

How can I create a PR for this ? I don't have push access. I have some draft code that I want to run through you.
:)

Trying to follow the example - env.create_window give me this error

{
	"startLineNumber": 156,
	"startColumn": 9,
	"endLineNumber": 156,
	"endColumn": 29,
	"message": "doesn't satisfy `Env: smithay_client_toolkit::shell::ShellHandling`",
	"resource": "/home/rajib/.cargo/registry/src/github.com-1ecc6299db9ec823/smithay-client-toolkit-0.12.1/src/lib.rs"
},
{
	"startLineNumber": 156,
	"startColumn": 9,
	"endLineNumber": 156,
	"endColumn": 29,
	"message": "doesn't satisfy `_: smithay_client_toolkit::environment::GlobalHandler<smithay_client_toolkit::reexports::wayland_protocols::unstable::xdg_decoration::v1::client::zxdg_decoration_manager_v1::ZxdgDecorationManagerV1>`",
	"resource": "/home/rajib/.cargo/registry/src/github.com-1ecc6299db9ec823/smithay-client-toolkit-0.12.1/src/lib.rs"
}

now reading the - https://smithay.github.io/book/ to understand what I am trying to do :)

l4l commented

How can I create a PR for this ? I don't have push access.

You need to make a fork, here some (random) note that describes the common worflow for github: https://gist.github.com/Chaser324/ce0505fbed06b947d962

As I may guess, zxdg_decoration_manager_v1 is unnecessary for that fix, so perhaps removing it helps a little. Feel free to open a draft pull request, so I can build and provide a better help

Hi @l4l ,

It is taking me long, as I have never before worked with compositor :), I am reading some docs and have some general question.

  let pools = env
      .create_double_pool(|_| {})
      .expect("Failed to create a memory pool!")

What does a DoubleMemoryPool do ? What is the difference between a surface and layer_surface ? Any documentation I read to make better sense of what I am trying to do ?

l4l commented

DoubleMemoryPool is used for image buffering, it simply contains raw bytes of app pixels and double buffering is a common technique for rendering.

Surface is (surprise) a screen surface, where you may receive some events and attach a buffer with a final image. Layer surface extends the surface with Z-coordinate (i.e. depth), quite handy if you want to make a lock screen (which should always be on top of everything), or menu app like yofi so it is never hidden by other apps. The last one is wlr extension as I noted before.

As for doc, protocol sources comments are very comprehensive imo: wayland-protocol & wlr-extensions. Besides I found the wayland book very useful.