GithubHelp home page GithubHelp logo

feschber / lan-mouse Goto Github PK

View Code? Open in Web Editor NEW
1.6K 1.6K 35.0 570 KB

mouse & keyboard sharing via LAN

License: GNU General Public License v3.0

Rust 98.27% Nix 1.73%
gplv3 gtk4-rs hyprland keyboard-emulation kvm-switch lan libadwaita linux macos mouse-emulation open-source rust tcp udp wayland wayland-client windows wlroots

lan-mouse's Introduction

Ferdinand Schober => feschber, the franconian pronounciation of "Vesper"

I like

  • Rust ๐Ÿฆ€ and other fun languages
  • ๐Ÿ”ญ Low level stuff and operating systems
  • Graphics and windowing

lan-mouse's People

Contributors

cupricreki avatar feschber avatar ice-gb avatar kiwiz avatar meck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lan-mouse's Issues

Clients do not activate if no input devices are connected

I have two computers, one of them has no keyboard, and no mouse. When this machine first starts, I have to connect a mouse or keyboard to it, in order to allow LAN Mouse to accept connections. This computer is running sway 1.8.1 on nixos unstable.

Make passing configuration file more user friendly.

Unless I'm mistaken, the executable will only read a config.toml file from the current directory.

  • Allow config directory to be passed as an argument
  • Search in $XDG_CONFIG_HOME/lan-mouse for config.toml

I think the hierarchy might look like:
Argument > $XDG_CONFIG_HOME/lan-mouse > current directory

Double-clicking on the client

After I start lan-mouse and move the muse to the client, every click will result in a double click.

Issue

  • Looks like every button click event is triggered twice on the client. (Scrolling and movement is fine)
  • Issue started with running two Plasma 6 (Wayland) systems. Worked with Plasma 6 and Plasma 5 (Wayland)
  • I switched the mouse/keyboard between both systems, behavior stays the same
  • Double click creates no output in the terminal
  • Issue happens every time and isn't traffic/connection related like stuck keys and UDP

Systems

  • Running as --daemon
  • Latest commit on main 0196cf
  • Using simple toml config
  • LAN connections

(server=send lan mouse information and has input devices/peripherals, client=uses lan mouse for inputs and no peripherals)

Not working between debian computers in GNOME 45

This is what I got in the first PC:

INFO  lan_mouse::config] using config: "/home/me/.config/lan-mouse/config.toml"
INFO  lan_mouse] release bind: [KeyA, KeyS, KeyD, KeyF]
INFO  lan_mouse::config] using config: "/home/me/.config/lan-mouse/config.toml"
INFO  lan_mouse] release bind: [KeyA, KeyS, KeyD, KeyF]
INFO  lan_mouse] Press Ctrl+Alt+Shift+Super to release the mouse
INFO  lan_mouse::emulate] wayland backend not available: the requested global was not found in the registry
INFO  lan_mouse::capture::libei] creating input capture session
INFO  lan_mouse::capture] x11 input capture not available: not implemented
ERROR lan_mouse::capture] falling back to dummy input capture
INFO  lan_mouse::emulate::libei] requesting permission for input emulation
INFO  lan_mouse::emulate::xdg_desktop_portal] requesting permission for input emulation
INFO  lan_mouse::emulate] using xdg-remote-desktop-portal input emulation
INFO  lan_mouse::server] running service
INFO  lan_mouse::dns] resolving pc2.lan ...
WARN  lan_mouse::frontend::gtk::window] could not find client with handle 0
INFO  lan_mouse::dns] pc2.lan: adding ip 192.168.1.12

CLI access from scripts

I have a virtual machine with windows, that often takes the place of my usual linux desktop. It would be nice if I could script the switching in lan-mouse. Being able to do something like lan-mouse --frontend cli deactivate 2 && lan-mouse --frontend cli activate 3 would make my life significantly easier.

Tracking issue for MacOS support

Tracking issue for MacOS support

This issue is for tracking MacOS support and the current development status.

TODOs

  • Make it compile and get frontend up and running (#42)
  • Input Emulation
  • Keycode Translation
  • Input Capture

Several keys are bound to the wrong keycodes on receiving clients

May just be a Windows issue. Can't test.

Media Skip - h
Media Play/Pause - j
Media Previous - k (ironically the non-global hotkey for play/pause on YouTube)
Left - F18 / code 129
Up - F16 / code 127
Down - F21 / code 132
Right - F19 / code 130
Volume Up - IntlRo / 193
Volume Down - Lang1 / 255
Windows/Super/Meta - IntlYen / 255 (weird how its the same code)

Same environment as #46

Cant send keyboard inputs?

I am currently trying to use this to use 2 rigs with one keyboard and mouse on hyprland (wlroots based) but only my mouse seems to be sending properly. Any help as my configs are probably the problem? Files are attached, hopefully should be txt as github hates me and won't allow toml's
config.toml client
config.toml server

Host peripherals that move to Windows from Linux cannot move back

The magic edge appears to be broken on Windows, to work around it the connection must be deactivated.

Environments:
Sending

Latest KDE Plasma on Arch Linux
lan-mouse@010db79

frontend = "cli"

[left]
host_name = "zhulong"
ips = ["192.168.77.74"]
port = 4242

cargo run --release --no-default-features --features wayland,xdg_desktop_portal,x11

Receiving

Latest Windows 11
[email protected]

frontend = "cli"

[right]
host_name = "haixiong"
ips = ["192.168.77.117"]
port = 4242

[GithubActions] add an aarch64-apple-darwin build to releases

Running chmod +x on lan-mouse-mac binary results in an error due to missing libadwaita-1.0.dylib.

brew install libadwaita didn't resolve the issue.

error log

./lan-mouse-mac ; exit;
dyld[64640]: Library not loaded: /usr/local/opt/libadwaita/lib/libadwaita-1.0.dylib
  Referenced from: <36688367-70BB-368D-A4AE-2B6CCD7E5D4A> /Users/gllm/Downloads/lan-mouse-mac
  Reason: tried: '/usr/local/opt/libadwaita/lib/libadwaita-1.0.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/libadwaita/lib/libadwaita-1.0.dylib' (no such file), '/usr/local/opt/libadwaita/lib/libadwaita-1.0.dylib' (no such file), '/usr/local/lib/libadwaita-1.0.dylib' (no such file), '/usr/lib/libadwaita-1.0.dylib' (no such file, not in dyld cache)
zsh: abort      /Users/gllm/Downloads/lan-mouse-mac

Temporary Solution

when I compiled the source code after installing libadwaita via brew, I was able to run the locally compiled binary successfully.

This leads me to believe that the issue might be specific to the pre-compiled binary.

README update for Sway

FYI

The Sway dev's ignored swaywm/sway#7936 and proceeded to release Sway 1.9 anyways.

This means the official package, not just the git repository, would encounter this break. I am proposing that the README should be updated to reflect that only sway version 1.8 or lower is supported. (as reverting to the official package from git won't cause the break to go away)

Feature request: configurable release shortcut

Hello,

More a feature request. On windows, actually the shortcut ctrl+alt+shift+win shortcut is used by office 365 app and cannot be easily-user "unset".

The shortcut is actually sent on the remote before releasing the cursor.

2 ways:

  • do not send the event to the remote
  • allows the user to change the shortcut (as anyway, any shortcut we come up with, won't match a user.)

Clients Not Activated in Daemonized Mode

Environment info

Version: 0.5.0 (release)
Clients: Arch Linux (x2)


There appears to be an issue where starting lan-mouse in daemonized mode does not automatically activate clients that are defined in config.toml. Lan-mouse works properly when running with either the cli or gtk frontends and explicitly activating the connections, hence the suspicion that the daemonized mode is simply not activating client profiles.


Proposals

Short-term fix

Automatically starting all client profiles when running in daemonized mode seems like a reasonable short-term solution. If this is already the expected behaviour, I can assist with diagnostics as necessary.

Enhancement

It may be useful to have an "activate" key in the client configuration specification to specify which clients should be activated automatically during startup, as this would be useful even in non-daemonized cases. A similar global config key could be useful for controlling whether all profiles are activated at startup.

This can split into a separate issue if you would rather track the enhancement request separately


Annotated Log (Sway client)

[asmith@host2 ~]$ lan-mouse -d
[2024-01-11T03:17:10Z INFO lan_mouse::config] using config: "/home/asmith/.config/lan-mouse/config.toml"
[2024-01-11T03:17:10Z DEBUG lan_mouse] Config { frontend: Cli, port: 4242, clients: [(Client { host_name: Some("host1"), ips: None, port: Some(4242) }, Top)], daemon: true }
[2024-01-11T03:17:10Z INFO lan_mouse] Press Ctrl+Alt+Shift+Super to release the mouse
[2024-01-11T03:17:10Z DEBUG lan_mouse::frontend] remove socket: "/run/user/1000/lan-mouse-socket.sock"
[2024-01-11T03:17:10Z INFO lan_mouse::consumer] using wlroots event consumer
[2024-01-11T03:17:10Z INFO lan_mouse::producer] libei event producer not available: not implemented
[2024-01-11T03:17:10Z DEBUG lan_mouse::backend::producer::wayland] ==============> requested registry
[2024-01-11T03:17:10Z DEBUG lan_mouse::backend::producer::wayland] wl_output global
[2024-01-11T03:17:10Z DEBUG lan_mouse::backend::producer::wayland] ==============> roundtrip 1 done
[2024-01-11T03:17:10Z DEBUG lan_mouse::backend::producer::wayland] xdg-output - Name { name: "eDP-1" }
[2024-01-11T03:17:10Z DEBUG lan_mouse::backend::producer::wayland] xdg-output - Description { description: "LG Display 0x0719 0x000037A1 (eDP-1)" }
[2024-01-11T03:17:10Z DEBUG lan_mouse::backend::producer::wayland] xdg-output - LogicalPosition { x: 0, y: 0 }
[2024-01-11T03:17:10Z DEBUG lan_mouse::backend::producer::wayland] xdg-output - LogicalSize { width: 1440, height: 960 }
[2024-01-11T03:17:10Z DEBUG lan_mouse::backend::producer::wayland] ==============> roundtrip 2 done
[2024-01-11T03:17:10Z DEBUG lan_mouse::backend::producer::wayland] OutputInfo {
name: "eDP-1",
position: (0,0,),
size: (1440,960,),
}
[2024-01-11T03:17:10Z INFO lan_mouse::producer] using layer-shell event producer
[2024-01-11T03:17:10Z INFO lan_mouse::server] adding client [top]host1 @ {}
[2024-01-11T03:17:10Z DEBUG lan_mouse::server] add_client 0
[2024-01-11T03:17:10Z DEBUG lan_mouse::frontend] json: {"NotifyClientCreate":[0,"host1",4242,"Top"]}, len: 55
[2024-01-11T03:17:10Z INFO lan_mouse::dns] resolving host1 ...
[2024-01-11T03:17:10Z INFO lan_mouse::dns] host1: adding ip 192.168.0.16

<Attempt to move mouse from host 1 into host 2>

[2024-01-11T03:17:12Z WARN lan_mouse::server] ignoring events from client 192.168.0.16:4242

[Feature Request] Automation

Ideally there would be a built-in way to setup lan-mouse to run on start up, for all platforms. Currently, especially on Windows, this is a pain in the ass to do.

Some sort of auto-activate flag in the config, and a couple scripts that add the program to startup would be great.

Mouse gets stuck in gnome

lan-mouse 0.5.1 on both machines. Primary machine using sway, secondary machine using gnome 45.3.

Pointer can enter gnome and control works just fine. It is however unable to leave gnome by moving the pointer, either from the primary PC's mouse, or the gnome machines' mouse.

Feature Proposal: Add lan-mouse to Nix Package Manager

I want to propose to add lan-mouse also to the nix package manager and/or home-manager.

I tried to achieve it with a locally defined package:

{
  stdenv,
  fetchCrate,
  rustPlatform,
  fetchFromGitHub,
  lib,
  pkgs,
}:
rustPlatform.buildRustPackage rec {
  pname = "lan-mouse";
  version = "20240124";

  nativeBuildInputs = [pkgs.pkg-config pkgs.cmake];

  buildInputs = [
    pkgs.xorg.libX11
    pkgs.gtk4
    pkgs.libadwaita
    pkgs.xorg.libXtst
  ];

  src = fetchFromGitHub {
    owner = "feschber";
    repo = "lan-mouse";
    rev = "8084b52cfc8c661baa43fbea158e0b44cd0ae203";
    hash = "sha256-6sX2cAL7nVfSyvimqi3Oc5yVUYuSMiYjbRyleo0wKRY=";
  };

  cargoLock.lockFile = "${src}/Cargo.lock";

  cargoLock.outputHashes = {
    "reis-0.1.0" = "sha256-sRZqm6QdmgqfkTjEENV8erQd+0RL5z1+qjdmY18W3bA=";
  };

  # Set Environment Variables
  RUST_BACKTRACE = "full";

  meta = with lib; {
    description = "Lan Mouse is a mouse and keyboard sharing software";
    longDescription = ''
      Lan Mouse is a mouse and keyboard sharing software similar to universal-control on Apple devices. It allows for using multiple pcs with a single set of mouse and keyboard. This is also known as a Software KVM switch.
      The primary target is Wayland on Linux but Windows and MacOS and Linux on Xorg have partial support as well (see below for more details).
    '';
    mainProgram = "lan-mouse";
    platforms = platforms.all;
  };
}

But the build fails:

       >    Compiling itoa v1.0.10
       >    Compiling humantime v2.1.0
       >    Compiling ryu v1.0.16
       >    Compiling tempfile v3.8.1
       >    Compiling async-channel v2.1.1
       > error: failed to run custom build command for `lan-mouse v0.5.0 (/build/source)`
       > note: To improve backtraces for build dependencies, set the CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.
       >
       > Caused by:
       >   process didn't exit successfully: `/build/source/target/release/build/lan-mouse-9f2f7fca0f4f9dcf/build-script-build` (exit status: 101)
       >   --- stderr
       >   thread 'main' panicked at /build/cargo-vendor-dir/glib-build-tools-0.18.0/src/lib.rs:33:10:
       >   called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }
       >   stack backtrace:
       >      0:     0x5555555740eb - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h85e32f8f7b08f729
       >      1:     0x5555555a6530 - core::fmt::write::hae1cf5cde4ee2188
       >      2:     0x555555569375 - std::io::Write::write_fmt::h4ae54bff47727b29
       >      3:     0x555555573ec4 - std::sys_common::backtrace::print::hea248a594c5888cf
       >      4:     0x555555574a27 - std::panicking::default_hook::{{closure}}::h545cae1ad29f25d2
       >      5:     0x555555574774 - std::panicking::default_hook::hc1d7fee5faf0cc8a
       >      6:     0x555555574f88 - std::panicking::rust_panic_with_hook::h0e7975574d129b7c
       >      7:     0x555555574e6e - std::panicking::begin_panic_handler::{{closure}}::h420dcc10a77211ab
       >      8:     0x555555574306 - std::sys_common::backtrace::__rust_end_short_backtrace::he6597460302ecd4a
       >      9:     0x555555574bd2 - rust_begin_unwind
       >     10:     0x55555555d445 - core::panicking::panic_fmt::h3cf3338e18ada46e
       >     11:     0x55555555d403 - core::result::unwrap_failed::h22597ad5fa95281f
       >     12:     0x55555555efb0 - core::result::Result<T,E>::unwrap::h3c2a74cbb44f24c8
       >     13:     0x55555555de1e - glib_build_tools::compile_resources::hf7bc486b080714e8
       >     14:     0x555555562fbb - build_script_build::main::h61a7a6bb6051409b
       >     15:     0x555555561493 - core::ops::function::FnOnce::call_once::hc9e72346df2f6a18
       >     16:     0x555555560f26 - std::sys_common::backtrace::__rust_begin_short_backtrace::h8b820a1e1a9c9eb7
       >     17:     0x555555560f79 - std::rt::lang_start::{{closure}}::h531539a55ef140d4
       >     18:     0x555555574ac4 - std::panicking::try::h839c5e98485eaaba
       >     19:     0x55555557e4fb - std::rt::lang_start_internal::h6a4b333c7c2ab7bd
       >     20:     0x555555560f57 - std::rt::lang_start::h5efff1c9729f8d82
       >     21:     0x555555562fd5 - main
       >     22:     0x7ffff7ddc0ce - __libc_start_call_main
       >     23:     0x7ffff7ddc189 - __libc_start_main@GLIBC_2.2.5
       >     24:     0x55555555da95 - _start
       >     25:                0x0 - <unknown>
       > warning: build failed, waiting for other jobs to finish...
       For full logs, run 'nix log /nix/store/h55klm5rwz4phan0q1s3z3rijbhz2xb4-lan-mouse-20240124.drv'.
error: 1 dependencies of derivation '/nix/store/qr1w2a9fcrvwx02vanh4z1bwkab54y4b-home-manager-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ja7hxw294a1wx10s599g87s9shixf2yv-lan-mouse-20240124-fish-completions.drv' failed to build
error: 1 dependencies of derivation '/nix/store/9v9p30a3x92853n0216iji1q9vg9aaxk-man-paths.drv' failed to build
error: 1 dependencies of derivation '/nix/store/451cdyi0qfwr6iyappf728p5sjz0cxlc-home-manager-generation.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ar077jidk0ba8x9x5vb450kk7vv4fqqn-user-environment.drv' failed to build
error: 1 dependencies of derivation '/nix/store/byjp0n19xxf8s0hd9px9g4f74jkbfhra-etc.drv' failed to build
error: 1 dependencies of derivation '/nix/store/qd4s61ywr33jx8lhvsi28xs5xdbhchby-nixos-system-erde-24.05.20240121.612f972.drv' failed to build

I can compile lan-mouse with a nix-shell defined by this flake:

with import <nixpkgs> {};
  stdenv.mkDerivation {
    name = "rust-env";

    nativeBuildInputs = [pkgs.pkg-config pkgs.cmake pkgs.rustc pkgs.cargo];

    buildInputs = [
      pkgs.xorg.libX11
      pkgs.gtk4
      pkgs.libadwaita
      pkgs.xorg.libXtst
      pkgs.openssl
    ];

    # Set Environment Variables
    RUST_BACKTRACE = 1;
  }

Unfortuneately iam neither a rust nor a nix experst, so i dont understand whats going on.

Bug: Invisible and cursor in KDE Plasma.

I have it running on two clients, one sway and the other KDE Plasma (Wayland)

When the cursor exits sway and enters KDE, it becomes invisible for KDE, but I can still click and type. But when in KDE, it also cannot go back to the sway client if I'm using the sway client input. However, I can control the cursor using the input device on KDE client and it becomes visible and it can go back to sway to control everything.

KDE Plasma version: 5.27.11
KDE Frameworks: 5.115.0
Qt: 5.15.12
Wayland

Encryption

Hi, I switched to this tool as Plasma switched to Wayland and love it.

A few suggestions regarding encryption.

inside lan-mouse

I've noticed that WebRTC-rs have a working implementation of DTLS which would be the cannonical way for input-leap to encrypt UDP streams.

Have you had a look at it? (I am saddly too much of a rust newbie to be of any use making a PR, and even more so with delicate subjects like encryption)

workarounds outside lan-mouse

Until there's proper encryption inside lan-mouse, a few idea for users to hack their own workarounds:

  • I've noticed dtlspipe which is basically like stunnel but for UDP over DTLS instead of TCP.
  • There is also the classic approach of using netcat to forward UDP to TCP connection and use SSH forwarding to establish a secure connection. This sacrifice the "spontaneous connect/disconnect" that lan-mouse's UDP offers, but I think SSH tunnels and the port not even open on the laptops' firewalls is about the most secure solution (unless one has the wrong version of XZ ๐Ÿ˜ )

Holding keys doesn't work

Reproduce:

  1. Move peripherals to client device
  2. Press and hold any key

Expected: the key fires on the client once, then after a second it fires every 100ms

Actual: the key fires once and only once, pretty annoying for backspace.

It appears that KeyUp is being fired correctly, so my previous assertion that its a problem for games was incorrect.

detect output size for pointer grab surface

currently the size of the layer-shell surface is hard-coded at 1440x1 pixels.
It should depend on:

  • output size
  • orientation / position of the client (top|bottom / right|left)

Wayfire to wayfire desktop?

From wayfire.org:
"Wayfire is a wayland compositor based on wlroots."

Should I expect lan-mouse to work between wayfire desktops?

4242/UDP open on both desktops.

If there is any info I can send to help with this project let me know. Terminals on both machines look like this, except for the added ip.

username@hostname1:~$ ./lan-mouse 
[2024-01-05T13:54:16Z ERROR lan_mouse::config] /home/username/.config/lan-mouse/config.toml: No such file or directory (os error 2)
[2024-01-05T13:54:16Z WARN  lan_mouse::config] Continuing without config file ...
[2024-01-05T13:54:16Z ERROR lan_mouse::config] /home/username/.config/lan-mouse/config.toml: No such file or directory (os error 2)
[2024-01-05T13:54:16Z WARN  lan_mouse::config] Continuing without config file ...
[2024-01-05T13:54:16Z INFO  lan_mouse] Press Ctrl+Alt+Shift+Super to release the mouse
[2024-01-05T13:54:16Z INFO  lan_mouse::consumer] using wlroots event consumer
[2024-01-05T13:54:16Z INFO  lan_mouse::producer] libei event producer not available: not implemented
[2024-01-05T13:54:16Z INFO  lan_mouse::producer] layer_shell event producer not available: zwp_keyboard_shortcuts_inhibit_manager_v1 not supported
[2024-01-05T13:54:16Z INFO  lan_mouse::producer] x11 event producer not available: not implemented
[2024-01-05T13:54:16Z ERROR lan_mouse::producer] falling back to dummy event producer

(lan-mouse:23559): Gtk-WARNING **: 07:54:16.996: Unknown key gtk-modules in /home/username/.config/gtk-4.0/settings.ini
[2024-01-05T13:54:19Z INFO  lan_mouse::server] adding client [left] @ {}

(lan-mouse:23559): Gdk-WARNING **: 07:54:27.830: Compositor doesn't support moving popups, relying on remapping
[2024-01-05T13:54:35Z INFO  lan_mouse::dns] resolving hostname2 ...
[2024-01-05T13:54:35Z INFO  lan_mouse::dns] hostname2: adding ip 192.168.1.222

AUR Repository package

I created the lan-mouse package in the aur. Please review and let me know your thoughts. I've never worked with cargo and this is my first submission to the AUR.

https://aur.archlinux.org/packages/lan-mouse-git

I'm waiting for #72 before I add .desktop support. I'll add a service file for systemd once #70 and the daemon issues get sorted out.

AUR package for bin is forthcoming.

KDE prompts Remote Control Request muliple times and answer doesn't matter.

I'm getting multiple Remote Control Request every time I launch lan-mouse from the CLI.

Log

โฏ lan-mouse
[2024-01-15T14:52:24Z INFO  lan_mouse::config] using config: "/home/cupric/.config/lan-mouse/config.toml"

(lan-mouse:1668930): Gtk-WARNING **: 09:52:24.175: Unknown key gtk-modules in /home/cupric/.config/gtk-4.0/settings.ini
[2024-01-15T14:52:24Z INFO  lan_mouse::config] using config: "/home/cupric/.config/lan-mouse/config.toml"
[2024-01-15T14:52:24Z INFO  lan_mouse] Press Ctrl+Alt+Shift+Super to release the mouse
[2024-01-15T14:52:24Z INFO  lan_mouse::consumer] wayland backend not available: the requested global was not found in the registry
[2024-01-15T14:52:24Z INFO  lan_mouse::producer] libei event producer not available: not implemented
[2024-01-15T14:52:24Z INFO  lan_mouse::producer] using layer-shell event producer

(lan-mouse:1668930): Adwaita-WARNING **: 09:52:24.261: Using GtkSettings:gtk-application-prefer-dark-theme with libadwaita is unsupported. Please use AdwStyleManager:color-scheme instead.

KDE Screenshare

[2024-01-15T14:52:34Z INFO  lan_mouse::consumer] libei not available: Portal request failed: org.freedesktop.zbus.Error: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such method 'ConnectToEIS' in interface 'org.freedesktop.impl.portal.RemoteDesktop' at object path '/org/freedesktop/portal/desktop' (signature 'osa{sv}')

Remote Control Request prompt shows a second time.

[2024-01-15T14:52:40Z INFO  lan_mouse::consumer] using xdg-remote-desktop-portal event consumer
[2024-01-15T14:52:49Z INFO  lan_mouse] terminating service
[2024-01-15T14:52:49Z INFO  lan_mouse::server] terminating service
[2024-01-15T14:52:49Z INFO  lan_mouse::server] terminating gracefully...

Notes

  • Interestingly, it doesn't matter how if I accept or not, lan-mouse still works.
  • When launching via lan-mouse I don't always get the prompt, but I do get a notification.
    KDE Screenshare popup

cursor bound to single screen

With the merge of #81, I was able to test lan-mouse for the first time between a Linux server and MacOS client. I'm using multiple screens and see that when the mouse works on the remote client screen, it is not able to continue to the adjoining screens.

I was kind of hoping that the mouse would automatically release on the edge when traversing to go back to the server. Unsure if that's because of the above issue or if you have to press the release keys by design.

(Unrelated, but there is some keyboard weirdness with the server not passing through keystrokes that are already mapped for usage in the compositor. Will report that later in another issue.)

Suggestion: Clipboard

For sharing clipboard, I've found something that can both be used as a building block for users to make their workaround and which could be used to add clipboard support into lan-mouse:

wl-clipboard

It provides a pair of command that can read from- / write to- the wayland clipboard (and thus be used to store stuff in files, send over pipes or tunnels, etc.)

At the end of the readme, they also mention a rust crate wl-clipboard-rs handling the same which could be used for lan-mouse.

I own a Mac, how can I help?

Hey! I was wondering if I could help you out with the mac development in any way? Maybe even renting you a virtual mac?

let me know

Permission denied to bind lan-mouse-socket

Can't find anything about it in issue tracker or README.

Tired to connect via cargo run --release -- --frontend cli

INFO  lan_mouse::config] using config: "config/lan-mouse/config.toml"
INFO  lan_mouse] Press Ctrl+Alt+Shift+Super to release the mouse
ERROR lan_mouse] failed to bind lan-mouse-socket: Permission denied (os error 13)
  • config.toml only sets a port and first tries I had no config and same error.
  • Used barrier so far and stop it.
  • Can't find an open port, and it is not used (also tried different ports)

Running Wayland with latest commit on remote side. X11 on client side

Chrome OS support

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!

Client not responding, releasing pointer!

I tried a lot of things, but I can't get it to work

Setup
X11 -> Wayland
Wayland -> X11
Wayland -> Wayland

Both systems use KDE, libei installed, xdg-dekstop-portal...

Error

INFO  lan_mouse::dns] dnsname: adding ip 192.168.12.123
WARN  lan_mouse::server] client not responding, releasing pointer!

Error occurs if I try to enter the other screen. Did most tests from Wayland to Wayland. Also, I selected Yes for permission Input devices

Proxy software tun mode cause addr mismatch

When the request passes through the proxy software using tun mode, the source port will change, causing lan-mouse to ignore the request, is it possible to just determine if the ip is the same?

After I modified it like this it worked for me

c.active && c.client.addrs.iter().any(|&item| match_socket_addr(&item, &addr))
fn match_socket_addr(addr1: &SocketAddr, addr2: &SocketAddr) -> bool {
    addr1.ip() == addr2.ip()
}

Crash on Hyprland

Hey,
I have build lan-mouse on my 2 pc on archlinux, wayland, hyprland.
On the server Hyprland crash directly when i moving the cursor to the left pc.
And on client pc always fine. The output detect 1 entry of the cursor.

Crash Report

--------------------------------------------
   Hyprland Crash Report
--------------------------------------------
All these computers...

Hyprland received signal 11 (Segmentation fault)

Version: 96d555e8e794627bfc561e294e148ab8a9961fcc
Tag: v0.29.1

System info:
	System name: Linux
	Node name: archpc
	Release: 6.5.3-arch1-1
	Version: #1 SMP PREEMPT_DYNAMIC Wed, 13 Sep 2023 08:37:40 +0000

GPU:
	01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP104 [GeForce GTX 1080] [10de:1b80] (rev a1) (prog-if 00 [VGA controller])


os-release:
	NAME="Arch Linux"
	PRETTY_NAME="Arch Linux"
	ID=arch
	BUILD_ID=rolling
	ANSI_COLOR="38;2;23;147;209"
	HOME_URL="https://archlinux.org/"
	DOCUMENTATION_URL="https://wiki.archlinux.org/"
	SUPPORT_URL="https://bbs.archlinux.org/"
	BUG_REPORT_URL="https://bugs.archlinux.org/"
	PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/"
	LOGO=archlinux-logo
	


Backtrace:
	#0 | Hyprland(_Z12getBacktracev+0x48) [0x5595ef428c68]
		??
		??:0
	#1 | Hyprland(_ZN13CrashReporter18createAndSaveCrashEi+0x76e) [0x5595ef3f8a9e]
		??
		??:0
	#2 | Hyprland(_Z25handleUnrecoverableSignali+0x3c) [0x5595ef38fa8c]
		??
		??:0
	#3 | /usr/lib/libc.so.6(+0x3e710) [0x7f0aa363e710]
		??
		??:0
	#4 | Hyprland(_ZN13CInputManager16unconstrainMouseEv+0xf1) [0x5595ef477421]
		??
		??:0
	#5 | Hyprland(_ZN13CInputManager16mouseMoveUnifiedEjb+0x1a29) [0x5595ef47a739]
		??
		??:0
	#6 | Hyprland(_ZN13CInputManager12onMouseMovedEP24wlr_pointer_motion_event+0x126) [0x5595ef47ad96]
		??
		??:0
	#7 | /usr/lib/libwayland-server.so.0(wl_signal_emit_mutable+0x7e) [0x7f0aa431101e]
		??
		??:0
	#8 | /usr/lib/libwayland-server.so.0(wl_signal_emit_mutable+0x7e) [0x7f0aa431101e]
		??
		??:0
	#9 | /usr/lib/libwlroots.so.12032(+0x6115d) [0x7f0aa43bb15d]
		??
		??:0
	#10 | /usr/lib/libwlroots.so.12032(+0x600eb) [0x7f0aa43ba0eb]
		??
		??:0
	#11 | /usr/lib/libwayland-server.so.0(wl_event_loop_dispatch+0xa2) [0x7f0aa4312ae2]
		??
		??:0
	#12 | /usr/lib/libwayland-server.so.0(wl_display_run+0x27) [0x7f0aa43132d7]
		??
		??:0
	#13 | Hyprland(main+0xa91) [0x5595ef3803b1]
		??
		??:0
	#14 | /usr/lib/libc.so.6(+0x27cd0) [0x7f0aa3627cd0]
		??
		??:0
	#15 | /usr/lib/libc.so.6(__libc_start_main+0x8a) [0x7f0aa3627d8a]
		??
		??:0
	#16 | Hyprland(_start+0x25) [0x5595ef38f935]
		??
		??:0


Log tail:
[LOG] New LayerSurface has no preferred monitor. Assigning Monitor HDMI-A-1
[LOG] Registered signal for owner 5595f5cf44d0: 5595f5cf4360 -> 5595f5cf46b0 (owner: layerSurface)
[LOG] Registered signal for owner 5595f5cf44d0: 5595f5dd4a50 -> 5595f5cf4578 (owner: layerSurface)
[LOG] Registered signal for owner 5595f5cf44d0: 5595f5cf4370 -> 5595f5cf45e0 (owner: layerSurface)
[LOG] Registered signal for owner 5595f5cf44d0: 5595f5cf4380 -> 5595f5cf4648 (owner: layerSurface)
[LOG] Registered signal for owner 5595f5cf44d0: 5595f5dd4a60 -> 5595f5cf4718 (owner: layerSurface)
[LOG] LayerSurface 5595f5dd4990 (namespace LAN Mouse Sharing layer 2) created on monitor HDMI-A-1
[LOG] LayerSurface 5595f056b850 arranged: x: 0 y: 0 w: 1920 h: 35 with margins: t: 0 l: 0 r: 0 b: 0
[LOG] LayerSurface 5595f12d3e90 arranged: x: 0 y: 0 w: 1920 h: 1080 with margins: t: 0 l: 0 r: 0 b: 0
[LOG] LayerSurface 5595f056b858 arranged: x: 0 y: -163 w: 1 h: 1440 with margins: t: 0 l: 0 r: 0 b: 0
[LOG] Monitor HDMI-A-1 layers arranged: reserved: 0.000000 35.000000 0.000000 0.000000
[LOG] LayerSurface 5595f5dd4990 mapped
[LOG] Registered signal for owner 5595f5cf44f0: 5595f5cf43a0 -> 5595f5cf44f8 (owner: CWLSurface)
[LOG] CWLSurface 5595f5cf44f0 called init()
[LOG] LayerSurface 5595f056b850 arranged: x: 0 y: 0 w: 1920 h: 35 with margins: t: 0 l: 0 r: 0 b: 0
[LOG] LayerSurface 5595f12d3e90 arranged: x: 0 y: 0 w: 1920 h: 1080 with margins: t: 0 l: 0 r: 0 b: 0
[LOG] LayerSurface 5595f056b858 arranged: x: 0 y: -163 w: 1 h: 1440 with margins: t: 0 l: 0 r: 0 b: 0
[LOG] Monitor HDMI-A-1 layers arranged: reserved: 0.000000 35.000000 0.000000 0.000000
[LOG] LayerSurface 5595f056b850 arranged: x: 0 y: 0 w: 1920 h: 35 with margins: t: 0 l: 0 r: 0 b: 0
[LOG] LayerSurface 5595f12d3e90 arranged: x: 0 y: 0 w: 1920 h: 1080 with margins: t: 0 l: 0 r: 0 b: 0
[LOG] LayerSurface 5595f056b858 arranged: x: 0 y: -163 w: 1 h: 1440 with margins: t: 0 l: 0 r: 0 b: 0
[LOG] Monitor HDMI-A-1 layers arranged: reserved: 0.000000 35.000000 0.000000 0.000000
[LOG] Set keyboard focus to surface 5595f5cf4090
[LOG] New mouse constraint at 5595f44f31b0
[LOG] Registered signal for owner 5595f13a2cf0: 5595f44f32b8 -> 5595f13a2d80 (owner: Constraint)
[LOG] Registered signal for owner 5595f13a2cf0: 5595f44f32a8 -> 5595f13a2d18 (owner: Constraint)
[LOG] Registered signal for owner 5595f1197360: 5595f5cf4360 -> 5595f11973b8 (owner: Mouse constraint commit)
[LOG] Constrained mouse to 5595f44f31b0
[LOG] Callback 5595f11973e0 -> 5595f11973d8, Mouse constraint commit removed.
[LOG] Unconstrained mouse from 5595f44f31b0
[LOG] Callback 5595f13a2da8 -> 5595f13a2da0, Constraint removed.
[LOG] Callback 5595f13a2d40 -> 5595f13a2d38, Constraint removed.

Server Config

# server
port = 4242
backend = "wlroots"

[left]
host_name = "archlap"
port = 4242
ip = "192.168.0.196"

Client Config

# client
port = 4242
backend = "wlroots"

[right]
host_name = "archpc"
port = 4242
ip = "192.168.0.196"

Thanks !

Windows Startup support

Appearing within the Task Manager when added to the host, have a button or guide to add the program to login/startup.

[Zorin OS 17 + Windows 10] Can't connect

Hey there. So I'm currently using two laptops (one is Windows 10 the other is Zorin OS which is based on ubuntu). Windows seems to be working fine? at least I'm not getting any errors except that it tries to connect for a while but then after being unable to find a host it prints out that it wasn't able to resolve a host.

The ports are set to 4242 on both laptops and I made sure they are open on the firewalls for both laptops. Zorin definitely uses wayland because I've tried other tools similar to this one (like synergy) and had issues as they don't work with wayland on synergy I even got the error stating it is incompatible with wayland and if i go on my settings's "about" tab it clearly states it uses wayland.

I have also installed the dependencies mentioned on the github page. But it still won't connect. I am leaving the terminal log down below if that helps.

[2024-02-13T16:20:28Z WARN  lan_mouse::config] /home/marco/.config/lan-mouse/config.toml: No such file or directory (os error 2)
[2024-02-13T16:20:28Z WARN  lan_mouse::config] Continuing without config file ...
[2024-02-13T16:20:28Z WARN  lan_mouse::config] /home/marco/.config/lan-mouse/config.toml: No such file or directory (os error 2)
[2024-02-13T16:20:28Z WARN  lan_mouse::config] Continuing without config file ...
[2024-02-13T16:20:28Z INFO  lan_mouse] Press Ctrl+Alt+Shift+Super to release the mouse
[2024-02-13T16:20:28Z INFO  lan_mouse::consumer] wayland backend not available: the requested global was not found in the registry
[2024-02-13T16:20:28Z INFO  lan_mouse::producer] libei event producer not available: not implemented
[2024-02-13T16:20:28Z INFO  lan_mouse::producer] layer_shell event producer not available: zwlr_layer_shell_v1 >= v3 not supported - required to display a surface at the edge of the screen
[2024-02-13T16:20:28Z INFO  lan_mouse::producer] x11 event producer not available: not implemented
[2024-02-13T16:20:28Z ERROR lan_mouse::producer] falling back to dummy event producer
[2024-02-13T16:20:36Z INFO  lan_mouse::consumer] libei not available: This interface requires version 2, but 1 is available
[2024-02-13T16:20:45Z INFO  lan_mouse::consumer] using xdg-remote-desktop-portal event consumer
[2024-02-13T16:20:51Z INFO  lan_mouse::server::frontend_task] adding client [left] @ {}
[2024-02-13T16:21:16Z INFO  lan_mouse::dns] resolving zorin ...
[2024-02-13T16:21:17Z WARN  lan_mouse::server::resolver_task] could not resolve host 'zorin': no record found for Query { name: Name("zorin."), query_type: AAAA, query_class: IN }

Wheel scrolles too sensitive

Platform

Windows 10

Used Version

latest pre-release commitL: 3e96b42

Malfunction

client's mouse wheel scroll too sensitively. It just seems like that from top to bottom in one step.

Expect

Mouse's wheel works like general action rather than "one-step".

Lock the entry

Thank you for your work!

I have a suggestion:

  • Set up a key to lock entry into the client.

Thanks.

Feature Proposal: Packaging lan-mouse for Scoop (Windows Package Manager)

I created for myself a simple package in the Windows Packaging Manager Scoop:

{
    "version":  "v0.6.0",
    "license":  "GNU General Public License Version 3",
    "url":  "https://github.com/feschber/lan-mouse/releases/download/v0.6.0/lan-mouse-windows.zip",
    "hash": "61f50a3d0d04ef3df4c0f3efc7f0124838ffb515e2011914728c86af280e4655",
    "homepage":  "https://github.com/feschber/lan-mouse",
    "bin":  ["lan-mouse.exe"],
	"checkver": "github",
	"autoupdate": {
		"url": "https://github.com/feschber/lan-mouse/releases/download/$version/lan-mouse-windows.zip"
	}
}

I want to propose to add this to the official repository/bucket.

It's my first scoop package, it works for me and my usage, but it might not be "optimal".

Thanks!

Run as service via systemd

Here is an example service file. Connection still needs to be activated via GUI until #70 is sorted.

/usr/lib/systemd/user/lan-mouse.service
[Unit]
Description=Mouse & keyboard sharing via LAN
Wants=network-pre.target
After=network-pre.target NetworkManager.service systemd-resolved.service

[Service]
ExecStart=/usr/bin/lan-mouse -d
Restart=on-failure

[Install]
WantedBy=multi-user.target

Start now and on boot

systemclt --user daemon-reload
systemctl --user enable --now lan-mouse.service

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.