Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chrome OS support #37

Open
bpstrngr opened this issue Nov 26, 2023 · 29 comments
Open

Chrome OS support #37

bpstrngr opened this issue Nov 26, 2023 · 29 comments
Labels
enhancement New feature or request

Comments

@bpstrngr
Copy link

trying to test this in a graphically rather limited wayland environment (chrome os), and i worked through a few errors to satisfy the gui dependencies, but libadwaita being a more complicated one, I'm just wishing for a way to opt out of building the gui and rely on the cli only:
image
is it already available just not mentioned in the readme?
Sorry if it could be determined with more familiarity with cargo toolchains.
Thanks!

@feschber
Copy link
Owner

Disabling individual features does not seem to be possible as of now:
rust-lang/cargo#3126

There is two Options:

  • either build with --no-default-features and add all the features manually:
cargo build --release --no-default-features --features wayland,x11,xdg_desktop_portal

@feschber
Copy link
Owner

If you could tell me what Distro you're using, I may be able to help you with getting libadwaita installed.

@feschber
Copy link
Owner

If you could tell me what Distro you're using, I may be able to help you with getting libadwaita installed.

Sorry I overlooked chrome os.

@feschber
Copy link
Owner

feschber commented Dec 1, 2023

Do you have an update on this?
I'm curious if chrome os works but I feel like they probably dont support the necessary wayland protocols or desktop portals.

@jpeeler
Copy link

jpeeler commented Dec 15, 2023

I tried running in a Crostini container (with libadwaita-1-0 installed) and got this:

$ ./lan-mouse 
[2023-12-15T20:20:04Z ERROR lan_mouse::config] /home/jpeeler/.config/lan-mouse/config.toml: No such file or directory (os error 2)
[2023-12-15T20:20:04Z WARN  lan_mouse::config] Continuing without config file ...
[2023-12-15T20:20:04Z ERROR lan_mouse::config] /home/jpeeler/.config/lan-mouse/config.toml: No such file or directory (os error 2)
[2023-12-15T20:20:04Z WARN  lan_mouse::config] Continuing without config file ...
thread 'main' panicked at /var/home/jpeeler/src/lan-mouse/src/producer.rs:58:13:
could not detect session type: XDG_SESSION_TYPE environment variable not set!
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
^C
jpeeler@jeff:~$ XDG_SESSION_TYPE=wayland ./lan-mouse 
[2023-12-15T20:20:43Z ERROR lan_mouse::config] /home/jpeeler/.config/lan-mouse/config.toml: No such file or directory (os error 2)
[2023-12-15T20:20:43Z WARN  lan_mouse::config] Continuing without config file ...
[2023-12-15T20:20:43Z ERROR lan_mouse::config] /home/jpeeler/.config/lan-mouse/config.toml: No such file or directory (os error 2)
[2023-12-15T20:20:43Z WARN  lan_mouse::config] Continuing without config file ...
[2023-12-15T20:20:43Z INFO  lan_mouse::producer] XDG_SESSION_TYPE = wayland -> using wayland event producer
[2023-12-15T20:20:43Z INFO  lan_mouse::producer] XDG_CURRENT_DESKTOP = X-Generic -> using layer_shell backend
[2023-12-15T20:20:43Z INFO  lan_mouse::consumer] XDG_SESSION_TYPE = wayland -> using wayland event consumer
[2023-12-15T20:20:43Z WARN  lan_mouse::consumer] unknown XDG_CURRENT_DESKTOP -> defaulting to wlroots backend
[2023-12-15T20:20:43Z ERROR lan_mouse] xdg_output not supported!

@feschber
Copy link
Owner

I tried running in a Crostini container (with libadwaita-1-0 installed) and got this:

$ ./lan-mouse 
[2023-12-15T20:20:04Z ERROR lan_mouse::config] /home/jpeeler/.config/lan-mouse/config.toml: No such file or directory (os error 2)
[2023-12-15T20:20:04Z WARN  lan_mouse::config] Continuing without config file ...
[2023-12-15T20:20:04Z ERROR lan_mouse::config] /home/jpeeler/.config/lan-mouse/config.toml: No such file or directory (os error 2)
[2023-12-15T20:20:04Z WARN  lan_mouse::config] Continuing without config file ...
thread 'main' panicked at /var/home/jpeeler/src/lan-mouse/src/producer.rs:58:13:
could not detect session type: XDG_SESSION_TYPE environment variable not set!
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
^C
jpeeler@jeff:~$ XDG_SESSION_TYPE=wayland ./lan-mouse 
[2023-12-15T20:20:43Z ERROR lan_mouse::config] /home/jpeeler/.config/lan-mouse/config.toml: No such file or directory (os error 2)
[2023-12-15T20:20:43Z WARN  lan_mouse::config] Continuing without config file ...
[2023-12-15T20:20:43Z ERROR lan_mouse::config] /home/jpeeler/.config/lan-mouse/config.toml: No such file or directory (os error 2)
[2023-12-15T20:20:43Z WARN  lan_mouse::config] Continuing without config file ...
[2023-12-15T20:20:43Z INFO  lan_mouse::producer] XDG_SESSION_TYPE = wayland -> using wayland event producer
[2023-12-15T20:20:43Z INFO  lan_mouse::producer] XDG_CURRENT_DESKTOP = X-Generic -> using layer_shell backend
[2023-12-15T20:20:43Z INFO  lan_mouse::consumer] XDG_SESSION_TYPE = wayland -> using wayland event consumer
[2023-12-15T20:20:43Z WARN  lan_mouse::consumer] unknown XDG_CURRENT_DESKTOP -> defaulting to wlroots backend
[2023-12-15T20:20:43Z ERROR lan_mouse] xdg_output not supported!

You are on a Chromebook as well?

@jpeeler
Copy link

jpeeler commented Dec 15, 2023

Yeah (don't think Crostini exists anywhere else). I compiled the binary on a more powerful linux host and copied over the binary - I assume that doesn't matter.

@feschber
Copy link
Owner

Could you run wayland-info in that container and list the supported interfaces here?

For input capture either the wlr_layer_shell protocol would need to be implemented or libei support is required
and for input emulation the best bet is probably the remote desktop portal but I don't think that is available in chrome os either.

I would not get my hopes up too much that any of this works in Chrome OS unfortunately.

@jpeeler
Copy link

jpeeler commented Dec 15, 2023

$ wayland-info
interface: 'wl_compositor',                              version:  4, name:  1
interface: 'wl_shm',                                     version:  1, name:  2
        formats (fourcc):
        0x36314752 = 'RG16'
                 1 = 'XR24'
                 0 = 'AR24'
        0x34324258 = 'XB24'
        0x34324241 = 'AB24'
        0x3231564e = 'NV12'
interface: 'wl_drm',                                     version:  2, name:  3
interface: 'wl_subcompositor',                           version:  1, name:  4
interface: 'wl_output',                                  version:  3, name:  5
        x: 0, y: 0, scale: 2,
        physical_width: 260 mm, physical_height: 173 mm,
        make: 'unknown', model: 'unknown',
        subpixel_orientation: unknown, output_transform: normal,
        mode:
                width: 2400 px, height: 1600 px, refresh: 60.000 Hz,
                flags: current preferred
interface: 'wl_data_device_manager',                     version:  3, name:  6
interface: 'wp_fractional_scale_manager_v1',             version:  1, name:  7
interface: 'wp_viewporter',                              version:  1, name:  8
interface: 'zwp_tablet_manager_v2',                      version:  1, name:  9
        tablet_seat: default
                tablet: Touchscreen
                        vendor: 0
                        product: 0
                tablet_tool: eraser
                        capabilities: tilt pressure
                tablet_tool: pen
                        capabilities: tilt pressure
interface: 'wl_seat',                                    version:  5, name: 10
        name: default
        capabilities: pointer keyboard touch
        keyboard repeat rate: 20
        keyboard repeat delay: 500
interface: 'gtk_shell1',                                 version:  1, name: 11
interface: 'wl_shell',                                   version:  1, name: 12
interface: 'zwp_pointer_constraints_v1',                 version:  1, name: 13
interface: 'zwp_relative_pointer_manager_v1',            version:  1, name: 14
interface: 'zwp_idle_inhibit_manager_v1',                version:  1, name: 15
interface: 'zwp_text_input_manager_v1',                  version:  1, name: 16
interface: 'zcr_text_input_crostini_manager_v1',         version:  1, name: 17
interface: 'zcr_text_input_x11_v1',                      version:  1, name: 18
interface: 'zcr_text_input_extension_v1',                version: 11, name: 19
interface: 'xdg_wm_base',                                version:  3, name: 20

I don't really have my hopes up for ChromeOS. But I am interested in the rest of the operating systems, especially Linux+MacOS. If I can help debug integration any there let me know.

@feschber
Copy link
Owner

gtk_shell1 might be a valid fallback for layer_shell but at least zwp_keyboard_shortcuts_inhibit_manager_v1 would still be required to do anything useful.

If I can help debug integration any there let me know.

Will do :) Still in pretty early development.

@feschber feschber changed the title CLI-only build Chrome OS support Dec 15, 2023
@feschber feschber added the enhancement New feature or request label Dec 15, 2023
@bpstrngr
Copy link
Author

bpstrngr commented Dec 16, 2023

sorry i dropped out a bit, i layed off trying to control my chromebooks for a bit, but i'm still interested and will get back to testing.
Two things i'd note is i think building on another linux distro and copying the binary may not be indifferent (statically linked libraries missing or dynamic env assumptions differing). In my build attempts i was building on crostini directly, and running from there, but you could also be right @jpeeler .
Secondly, in chromeos, crostini is a virtual machine with a little more integration than usual which makes it a viable candidate, but there is also the host "crosh" (chromeos shell) system with more limited, but at least not virtual linux environment which i was also testing against.
I'll return to keep on testing, i just missed notifications of your engagement here, but i'm happy to see the support, thanks!

@feschber
Copy link
Owner

Cheers!
You could do one more thing: Try to run with XDG_CURRENT_DESKTOP=KDE. That way we can tell whether or not the remote desktop portal is available.

At least rudimentary input capture should always be possible through an application window. I feel Iike input emulation might be the bigger problem

@jpeeler
Copy link

jpeeler commented Dec 16, 2023

Is this what you were asking about, @feschber ?

$ XDG_SESSION_TYPE=wayland XDG_CURRENT_DESKTOP=kde ./lan-mouse 
[2023-12-16T13:32:51Z ERROR lan_mouse::config] /home/jpeeler/.config/lan-mouse/config.toml: No such file or directory (os error 2)
[2023-12-16T13:32:51Z WARN  lan_mouse::config] Continuing without config file ...
[2023-12-16T13:32:51Z ERROR lan_mouse::config] /home/jpeeler/.config/lan-mouse/config.toml: No such file or directory (os error 2)
[2023-12-16T13:32:51Z WARN  lan_mouse::config] Continuing without config file ...
[2023-12-16T13:32:51Z INFO  lan_mouse::producer] XDG_SESSION_TYPE = wayland -> using wayland event producer
[2023-12-16T13:32:51Z INFO  lan_mouse::producer] XDG_CURRENT_DESKTOP = kde -> using layer_shell backend
[2023-12-16T13:32:51Z INFO  lan_mouse::consumer] XDG_SESSION_TYPE = wayland -> using wayland event consumer
[2023-12-16T13:32:51Z WARN  lan_mouse::consumer] unknown XDG_CURRENT_DESKTOP -> defaulting to wlroots backend
[2023-12-16T13:32:51Z ERROR lan_mouse] xdg_output not supported!

I thought that the remote desktop portal was something to be installed. Surprisingly I do have xdg-desktop-portal-gtk and xdg-desktop-portal installed. Wondering if switching to the KDE version would be helpful, though when I set the current desktop to gnome I get the exact same output.

@bpstrngr I thought crosh was restricted to executing Chrome management utilities. You're saying there's a way to run scripts/binaries in that environment?

@feschber
Copy link
Owner

It must be capital KDE, what you want is the xdg-desktop-portal backend

@jpeeler
Copy link

jpeeler commented Dec 16, 2023

$ XDG_SESSION_TYPE=wayland XDG_CURRENT_DESKTOP=KDE ./lan-mouse 
[2023-12-16T15:05:42Z ERROR lan_mouse::config] /home/jpeeler/.config/lan-mouse/config.toml: No such file or directory (os error 2)
[2023-12-16T15:05:42Z WARN  lan_mouse::config] Continuing without config file ...
[2023-12-16T15:05:42Z ERROR lan_mouse::config] /home/jpeeler/.config/lan-mouse/config.toml: No such file or directory (os error 2)
[2023-12-16T15:05:42Z WARN  lan_mouse::config] Continuing without config file ...
[2023-12-16T15:05:42Z INFO  lan_mouse::producer] XDG_SESSION_TYPE = wayland -> using wayland event producer
[2023-12-16T15:05:42Z INFO  lan_mouse::producer] XDG_CURRENT_DESKTOP = KDE -> using layer_shell backend
[2023-12-16T15:05:43Z INFO  lan_mouse::consumer] XDG_SESSION_TYPE = wayland -> using wayland event consumer
[2023-12-16T15:05:43Z INFO  lan_mouse::consumer] XDG_CURRENT_DESKTOP = KDE -> using xdg_desktop_portal backend
[2023-12-16T15:05:43Z ERROR lan_mouse] xdg_output not supported!

@feschber
Copy link
Owner

Can you rerun this with LAN_MOUSE_LOG_LEVEL=debug?

@jpeeler
Copy link

jpeeler commented Dec 16, 2023

$ LAN_MOUSE_LOG_LEVEL=debug XDG_SESSION_TYPE=wayland XDG_CURRENT_DESKTOP=KDE ./lan-mouse 
[2023-12-16T15:21:22Z ERROR lan_mouse::config] /home/jpeeler/.config/lan-mouse/config.toml: No such file or directory (os error 2)
[2023-12-16T15:21:22Z WARN  lan_mouse::config] Continuing without config file ...
[2023-12-16T15:21:22Z DEBUG lan_mouse] Config { frontend: Gtk, port: 4242, clients: [], daemon: false }
[2023-12-16T15:21:22Z DEBUG lan_mouse::frontend::gtk] running gtk frontend
[2023-12-16T15:21:22Z ERROR lan_mouse::config] /home/jpeeler/.config/lan-mouse/config.toml: No such file or directory (os error 2)
[2023-12-16T15:21:22Z WARN  lan_mouse::config] Continuing without config file ...
[2023-12-16T15:21:22Z DEBUG lan_mouse] Config { frontend: Gtk, port: 4242, clients: [], daemon: true }
[2023-12-16T15:21:22Z DEBUG lan_mouse::frontend] remove socket: "/run/user/1000/lan-mouse-socket.sock"
[2023-12-16T15:21:22Z INFO  lan_mouse::producer] XDG_SESSION_TYPE = wayland -> using wayland event producer
[2023-12-16T15:21:22Z INFO  lan_mouse::producer] XDG_CURRENT_DESKTOP = KDE -> using layer_shell backend
[2023-12-16T15:21:22Z INFO  lan_mouse::consumer] XDG_SESSION_TYPE = wayland -> using wayland event consumer
[2023-12-16T15:21:22Z INFO  lan_mouse::consumer] XDG_CURRENT_DESKTOP = KDE -> using xdg_desktop_portal backend
[2023-12-16T15:21:22Z DEBUG lan_mouse::frontend] remove socket: "/run/user/1000/lan-mouse-socket.sock"
[2023-12-16T15:21:22Z ERROR lan_mouse] xdg_output not supported!
[2023-12-16T15:21:22Z DEBUG lan_mouse::frontend::gtk] connecting to lan-mouse-socket
CLI run
$ LAN_MOUSE_LOG_LEVEL=debug XDG_SESSION_TYPE=wayland XDG_CURRENT_DESKTOP=KDE ./lan-mouse -f cli
[2023-12-16T15:21:01Z ERROR lan_mouse::config] /home/jpeeler/.config/lan-mouse/config.toml: No such file or directory (os error 2)
[2023-12-16T15:21:01Z WARN  lan_mouse::config] Continuing without config file ...
[2023-12-16T15:21:01Z DEBUG lan_mouse] Config { frontend: Cli, port: 4242, clients: [], daemon: false }
[2023-12-16T15:21:01Z ERROR lan_mouse] Could not connect to lan-mouse-socket
jpeeler@jeff:~$ [2023-12-16T15:21:01Z ERROR lan_mouse::config] /home/jpeeler/.config/lan-mouse/config.toml: No such file or directory (os error 2)
[2023-12-16T15:21:01Z WARN  lan_mouse::config] Continuing without config file ...
[2023-12-16T15:21:01Z DEBUG lan_mouse] Config { frontend: Cli, port: 4242, clients: [], daemon: true }
[2023-12-16T15:21:01Z DEBUG lan_mouse::frontend] remove socket: "/run/user/1000/lan-mouse-socket.sock"
[2023-12-16T15:21:01Z INFO  lan_mouse::producer] XDG_SESSION_TYPE = wayland -> using wayland event producer
[2023-12-16T15:21:01Z INFO  lan_mouse::producer] XDG_CURRENT_DESKTOP = KDE -> using layer_shell backend
[2023-12-16T15:21:01Z INFO  lan_mouse::consumer] XDG_SESSION_TYPE = wayland -> using wayland event consumer
[2023-12-16T15:21:01Z INFO  lan_mouse::consumer] XDG_CURRENT_DESKTOP = KDE -> using xdg_desktop_portal backend
[2023-12-16T15:21:01Z DEBUG lan_mouse::frontend] remove socket: "/run/user/1000/lan-mouse-socket.sock"
[2023-12-16T15:21:01Z ERROR lan_mouse] xdg_output not supported!

@feschber
Copy link
Owner

Okay, seems like I need to add some more debug information first.

@feschber
Copy link
Owner

@jpeeler you can try the latest main now. I added a fallback interface so it does not crash before we know whats going on.
XDG_CURRENT_DESKTOP=KDE is not required anymore

@jpeeler
Copy link

jpeeler commented Dec 17, 2023

(Using a6ab109).

$ LAN_MOUSE_LOG_LEVEL=debug ./lan-mouse 
[2023-12-17T19:49:05Z ERROR lan_mouse::config] /home/jpeeler/.config/lan-mouse/config.toml: No such file or directory (os error 2)
[2023-12-17T19:49:05Z WARN  lan_mouse::config] Continuing without config file ...
[2023-12-17T19:49:05Z DEBUG lan_mouse] Config { frontend: Gtk, port: 4242, clients: [], daemon: false }
[2023-12-17T19:49:05Z DEBUG lan_mouse::frontend::gtk] running gtk frontend
[2023-12-17T19:49:05Z ERROR lan_mouse::config] /home/jpeeler/.config/lan-mouse/config.toml: No such file or directory (os error 2)
[2023-12-17T19:49:05Z WARN  lan_mouse::config] Continuing without config file ...
[2023-12-17T19:49:05Z DEBUG lan_mouse] Config { frontend: Gtk, port: 4242, clients: [], daemon: true }
[2023-12-17T19:49:05Z DEBUG lan_mouse::frontend] remove socket: "/run/user/1000/lan-mouse-socket.sock"
[2023-12-17T19:49:05Z DEBUG lan_mouse::frontend] "/run/user/1000/lan-mouse-socket.sock": Connection refused (os error 111) - removing left behind socket
[2023-12-17T19:49:05Z INFO  lan_mouse::producer] libei event producer not available: not implemented
[2023-12-17T19:49:06Z INFO  lan_mouse::producer] layer_shell event producer not available: xdg_output not supported!
[2023-12-17T19:49:06Z INFO  lan_mouse::producer] x11 event producer not available: not implemented
[2023-12-17T19:49:06Z ERROR lan_mouse::producer] falling back to dummy event producer
[2023-12-17T19:49:06Z INFO  lan_mouse::consumer] wayland backend not available: wl_seat >= v7 not supported
[2023-12-17T19:49:06Z INFO  lan_mouse::consumer] libei not available: ZBus Error: org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.RemoteDesktop” on object at path /org/freedesktop/portal/desktop
[2023-12-17T19:49:06Z DEBUG lan_mouse::backend::consumer::xdg_desktop_portal] connecting to org.freedesktop.portal.RemoteDesktop portal ...
[2023-12-17T19:49:06Z DEBUG lan_mouse::backend::consumer::xdg_desktop_portal] creating session ...
[2023-12-17T19:49:06Z INFO  lan_mouse::consumer] remote desktop portal not available: ZBus Error: org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.RemoteDesktop” on object at path /org/freedesktop/portal/desktop
[2023-12-17T19:49:06Z INFO  lan_mouse::consumer] using x11 event consumer
[2023-12-17T19:49:06Z INFO  lan_mouse] Press Ctrl+Alt+Shift+Super to release the mouse
[2023-12-17T19:49:06Z DEBUG lan_mouse::frontend::gtk] connecting to lan-mouse-socket
[2023-12-17T19:49:06Z DEBUG lan_mouse::frontend] json: {"Enumerate":[]}, len: 16
[2023-12-17T19:49:06Z DEBUG lan_mouse::frontend::gtk] connected to lan-mouse-socket

(lan-mouse:4557): Gtk-CRITICAL **: 14:49:06.203: Error building template class 'LanMouseWindow' for an instance of type 'LanMouseWindow': .:0:0 Invalid object type 'AdwToolbarView'
thread 'main' panicked at /home/jpeeler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gtk4-0.7.2/src/subclass/widget.rs:1244:17:
Failed to retrieve template child. Please check that all fields of type `GtkButton` have been bound and have a #[template_child] attribute.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@feschber
Copy link
Owner

feschber commented Dec 18, 2023

Okay seems like the remote desktop portal is not available. XTest likely wont work either.

@feschber
Copy link
Owner

(Using a6ab109).

$ LAN_MOUSE_LOG_LEVEL=debug ./lan-mouse 
[2023-12-17T19:49:05Z ERROR lan_mouse::config] /home/jpeeler/.config/lan-mouse/config.toml: No such file or directory (os error 2)
[2023-12-17T19:49:05Z WARN  lan_mouse::config] Continuing without config file ...
[2023-12-17T19:49:05Z DEBUG lan_mouse] Config { frontend: Gtk, port: 4242, clients: [], daemon: false }
[2023-12-17T19:49:05Z DEBUG lan_mouse::frontend::gtk] running gtk frontend
[2023-12-17T19:49:05Z ERROR lan_mouse::config] /home/jpeeler/.config/lan-mouse/config.toml: No such file or directory (os error 2)
[2023-12-17T19:49:05Z WARN  lan_mouse::config] Continuing without config file ...
[2023-12-17T19:49:05Z DEBUG lan_mouse] Config { frontend: Gtk, port: 4242, clients: [], daemon: true }
[2023-12-17T19:49:05Z DEBUG lan_mouse::frontend] remove socket: "/run/user/1000/lan-mouse-socket.sock"
[2023-12-17T19:49:05Z DEBUG lan_mouse::frontend] "/run/user/1000/lan-mouse-socket.sock": Connection refused (os error 111) - removing left behind socket
[2023-12-17T19:49:05Z INFO  lan_mouse::producer] libei event producer not available: not implemented
[2023-12-17T19:49:06Z INFO  lan_mouse::producer] layer_shell event producer not available: xdg_output not supported!
[2023-12-17T19:49:06Z INFO  lan_mouse::producer] x11 event producer not available: not implemented
[2023-12-17T19:49:06Z ERROR lan_mouse::producer] falling back to dummy event producer
[2023-12-17T19:49:06Z INFO  lan_mouse::consumer] wayland backend not available: wl_seat >= v7 not supported
[2023-12-17T19:49:06Z INFO  lan_mouse::consumer] libei not available: ZBus Error: org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.RemoteDesktop” on object at path /org/freedesktop/portal/desktop
[2023-12-17T19:49:06Z DEBUG lan_mouse::backend::consumer::xdg_desktop_portal] connecting to org.freedesktop.portal.RemoteDesktop portal ...
[2023-12-17T19:49:06Z DEBUG lan_mouse::backend::consumer::xdg_desktop_portal] creating session ...
[2023-12-17T19:49:06Z INFO  lan_mouse::consumer] remote desktop portal not available: ZBus Error: org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.RemoteDesktop” on object at path /org/freedesktop/portal/desktop
[2023-12-17T19:49:06Z INFO  lan_mouse::consumer] using x11 event consumer
[2023-12-17T19:49:06Z INFO  lan_mouse] Press Ctrl+Alt+Shift+Super to release the mouse
[2023-12-17T19:49:06Z DEBUG lan_mouse::frontend::gtk] connecting to lan-mouse-socket
[2023-12-17T19:49:06Z DEBUG lan_mouse::frontend] json: {"Enumerate":[]}, len: 16
[2023-12-17T19:49:06Z DEBUG lan_mouse::frontend::gtk] connected to lan-mouse-socket

(lan-mouse:4557): Gtk-CRITICAL **: 14:49:06.203: Error building template class 'LanMouseWindow' for an instance of type 'LanMouseWindow': .:0:0 Invalid object type 'AdwToolbarView'
thread 'main' panicked at /home/jpeeler/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gtk4-0.7.2/src/subclass/widget.rs:1244:17:
Failed to retrieve template child. Please check that all fields of type `GtkButton` have been bound and have a #[template_child] attribute.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This Gtk-CRITICAL error is because I had used widgets from libadwaita-1.4 (accidentally). If you try the latest main, you may be able to get the gui to launch.

@jpeeler
Copy link

jpeeler commented Dec 19, 2023

Yep, I was compiling against libadwaita-rs 0.5.2. The GUI does indeed launch, which is nice.

@jpeeler
Copy link

jpeeler commented Dec 19, 2023

Something I just wondered - do you know of any necessary portal versions that are required to get things to work? This linux container I'm testing with is running Debian 12. The KDE portal is 5.27.5, which seems to be around 7 months old. But maybe everything that is required has been implemented for a while and the problem is more so on the ChromeOS wayland side.

@feschber
Copy link
Owner

For input emulation only the remote desktop portal is required. (org.freedesktop.portal.RemoteDesktop).
This has been around for a quite a while in xdg-desktop-portal-kde.

Do I understand correctly that you are running KDE on a Linux container in ChromeOS?

Can you check the output of qdbus?
It should list all of the available portals.

@jpeeler
Copy link

jpeeler commented Dec 19, 2023

The xdg-desktop-portal package is 1.16.0, which is about 12 months old. And I realized that I only had the -gtk portal installed earlier. However, it doesn't change the result all that much.

I am not running KDE as a desktop environment on ChromeOS if that's what you're asking. But am using their packages to run various apps (such as VLC).

$ /usr/lib/qt6/bin/qdbus
:1.10
 org.freedesktop.portal.Desktop
:1.11
 org.freedesktop.portal.Documents
:1.12
 org.freedesktop.impl.portal.PermissionStore
:1.13
 org.freedesktop.impl.portal.desktop.gtk
:1.14
:1.15
 org.a11y.Bus
:1.16
:1.17
:1.2
 org.freedesktop.systemd1
:1.37
 org.freedesktop.Flatpak
:1.4
 org.pulseaudio.Server
:1.40
 org.freedesktop.Notifications
:1.5
:1.51
 org.mozilla.firefox.ZGVmYXVsdC1yZWxlYXNl
:1.53
:1.58
:1.59
:1.6
:1.7
 org.freedesktop.ScreenSaver
:1.8
 org.freedesktop.impl.portal.desktop.cros
org.freedesktop.DBus

I don't understand why the KDE portal is not listed though.

@bpstrngr
Copy link
Author

bpstrngr commented Dec 24, 2023

found the time to test this too, starting from the point where you taught me how to opt out of libadwaita, i compiled with cargo build --release --no-default-features --features wayland in crostini.
inside crostini, it's the same result as for jpeeler,

$ LAN_MOUSE_LOG_LEVEL=debug XDG_SESSION_TYPE=wayland XDG_CURRENT_DESKTOP=KDE RUST_BACKTRACE=1 ./target/release/lan-mouse
[2023-12-24T14:32:51Z INFO  lan_mouse::producer] XDG_SESSION_TYPE = wayland -> using wayland event producer
[2023-12-24T14:32:51Z ERROR lan_mouse] xdg_output not supported!

The thing i can add, for what it's worth, is what happens outside crostini, on the host chromeos shell:

$ LAN_MOUSE_LOG_LEVEL=debug XDG_SESSION_TYPE=wayland XDG_CURRENT_DESKTOP=KDE ./lan-mouse
[2023-12-24T15:15:47Z ERROR lan_mouse::config] config.toml: No such file or directory (os error 2)
[2023-12-24T15:15:47Z WARN  lan_mouse::config] Continuing without config file ...
[2023-12-24T15:15:47Z INFO  lan_mouse::producer] XDG_SESSION_TYPE = wayland -> using wayland event producer
[2023-12-24T15:15:47Z ERROR lan_mouse] could not connect to wayland compositor: NoCompositor

or, when built with "x11,xdg_desktop_portal" features included:

./lan-mouse: error while loading shared libraries: libXtst.so.6: cannot open shared object file: No such file or directory

(been down the rabbit hole of building/copying such libs individually, in this case i assume the list would be long, so i just didn't include these features, X11 will certainly be ever foreign to the native chromeos shell).
And yes, @jpeeler official chromeos distributions lock the user out of the host shell, but "switching to dev mode", or chromium os builds, give access to it. it's a really minimal raspberry pi-like gentoo environment with not even portage being functional (although i commonly run nodejs/python there without any problems), so probably won't be easy to give any more diagnostics about the wayland environment.

@bpstrngr
Copy link
Author

bpstrngr commented Dec 24, 2023

Oh, and mind you, i had to checkout the v0.3.3 tag, because on the latest main, and several commits back, cargo build --release on crostini has started failing with

$ cargo build --release --no-default-features --features wayland
    Updating crates.io index
    Updating git repository `https://github.com/ids1024/reis`
warning: spurious network error (3 tries remaining): failed to mmap. Could not write data: Invalid argument; class=Os (2)
warning: spurious network error (2 tries remaining): failed to mmap. Could not write data: Invalid argument; class=Os (2)
warning: spurious network error (1 tries remaining): failed to mmap. Could not write data: Invalid argument; class=Os (2)
error: failed to get `reis` as a dependency of package `lan-mouse v0.4.0 (/home/ranger/crostini/lan-mouse)`

Caused by:
  failed to load source for dependency `reis`

Caused by:
  Unable to update https://github.com/ids1024/reis#a12f7e41

Caused by:
  failed to fetch into: /home/ranger/shuttle/x86/../rust/x86_64-unknown-linux-gnu/cargo/git/db/reis-ad85acfe9d586b15

Caused by:
  failed to mmap. Could not write data: Invalid argument; class=Os (2)

@feschber
Copy link
Owner

ChromeOS would need to support either

And either

Neither of which is very likely to happen anytime soon.

The error you are seeing is because xdg-output
is currently used to detect the dimensions of monitors attached to a PC. I can fallback to wl-output which must be supported by any wayland compositor.

That would lead to the next error though, which is that wlr-layer-shell is not supported.
For that I could craft another fallback to a simple xdg-toplevel (normal application window) that you would move the mouse into to control another PC. (not very elegant but a somewhat useful fallback).

So in short the options to get input capture working are:

  • Implement wl-output fallback for xdg-output
  • Implement xdg-toplevel fallback for wlr-layershell

For input emulation I have less hope other than chromeos supporting either xdg remote desktop or Libei at some point.

The other error you are seeing is very peculiar and seems to be an issue with cargo on chromeos.
You could comment out the "reis" dependency from Cargo.toml to work around it (its only needed for libei, which is not supported anyway).

With that the GUI should now launch as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants