Giter Club home page Giter Club logo

lan-mouse's Introduction

Lan Mouse

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).

  • Now with a gtk frontend
Screenshot of Lan-Mouse

Goal of this project is to be an open-source replacement for proprietary tools like Synergy 2/3, Share Mouse.

Focus lies on performance and a clean, manageable implementation that can easily be expanded to support additional backends like e.g. Android, iOS, ... .

blazingly fast™ because it's written in rust.

For an alternative (with slightly different goals) you may check out Input Leap.

Warning

Since this tool has gained a bit of popularity over the past couple of days:

All network traffic is currently unencrypted and sent in plaintext.

A malicious actor with access to the network could read input data or send input events with spoofed IPs to take control over a device.

Therefore you should only use this tool in your local network with trusted devices for now and I take no responsibility for any leakage of data!

OS Support

The following table shows support for input emulation (to emulate events received from other clients) and input capture (to send events to other clients) on different operating systems:

OS / Desktop Environment input emulation input capture
Wayland (wlroots) ✔️ ✔️
Wayland (KDE) ✔️ ✔️
Wayland (Gnome) ✔️ ✔️ (starting at GNOME 45)
Windows ✔️ ✔️
X11 ✔️ WIP
MacOS ✔️ WIP

Important

Gnome -> Sway only partially works (modifier events are not handled correctly)

Important

Wayfire

If you are using Wayfire, make sure to use a recent version (must be newer than October 23rd) and add shortcuts-inhibit to the list of plugins in your wayfire config! Otherwise input capture will not work.

Important

The mouse cursor will be invisible when sending input to a Windows system if there is no real mouse connected to the machine.

Installation

Install via cargo

cargo install lan-mouse

Download from Releases

Precompiled release binaries for Windows, MacOS and Linux are available in the releases section.

For Windows, the depenedencies are included in the .zip file, for other operating systems see Installing Dependencies.

Arch Linux

Lan Mouse can be installed from the official repositories:

pacman -S lan-mouse

It is also available on the AUR:

# git version (includes latest changes)
paru -S lan-mouse-git

# alternatively
paru -S lan-mouse-bin

Nix

Manual Installation

First make sure to install the necessary dependencies.

Build in release mode:

cargo build --release

Run directly:

cargo run --release

Install the files:

# install lan-mouse
sudo cp target/release/lan-mouse /usr/local/bin/

# install app icon
sudo mkdir -p /usr/local/share/icons/hicolor/scalable/apps
sudo cp resources/de.feschber.LanMouse.svg /usr/local/share/icons/hicolor/scalable/apps

# update icon cache
gtk-update-icon-cache /usr/local/share/icons/hicolor/

# install desktop entry
sudo mkdir -p /usr/local/share/applications
sudo cp de.feschber.LanMouse.desktop /usr/local/share/applications

# when using firewalld: install firewall rule
sudo cp firewall/lan-mouse.xml /etc/firewalld/services
# -> enable the service in firewalld settings

Conditional Compilation

Currently only x11, wayland, windows and MacOS are supported backends. Depending on the toolchain used, support for other platforms is omitted automatically (it does not make sense to build a Windows .exe with support for x11 and wayland backends).

However one might still want to omit support for e.g. wayland, x11 or libei on a Linux system.

This is possible through cargo features.

E.g. if only wayland support is needed, the following command produces an executable with just support for wayland:

cargo build --no-default-features --features wayland

For a detailed list of available features, checkout the Cargo.toml

Installing Dependencies

MacOS
brew install libadwaita
Ubuntu and derivatives
sudo apt install libadwaita-1-dev libgtk-4-dev libx11-dev libxtst-dev
Arch and derivatives
sudo pacman -S libadwaita gtk libx11 libxtst
Fedora and derivatives
sudo dnf install libadwaita-devel libXtst-devel libX11-devel
Windows

[!NOTE] This is only necessary when building lan-mouse from source. The windows release comes with precompiled gtk dlls.

TLDR:

Build gtk from source

  • The following commands should be run in an admin power shell instance:
# install chocolatey
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

# install gvsbuild dependencies
choco install python git msys2 visualstudio2022-workload-vctools
  • The following commands should be run in a regular power shell instance:
# install gvsbuild with python
python -m pip install --user pipx
python -m pipx ensurepath
  • Relaunch your powershell instance so the changes in the environment are reflected.
pipx install gvsbuild

# build gtk + libadwaita
gvsbuild build gtk4 libadwaita librsvg
  • Make sure to add the directory C:\gtk-build\gtk\x64\release\bin to the PATH environment variable. Otherwise the project will fail to build.

To avoid building GTK from source, it is possible to disable the gtk frontend (see conditional compilation below).

Usage

Gtk Frontend

By default the gtk frontend will open when running lan-mouse.

To add a new connection, simply click the Add button on both devices, enter the corresponding hostname and activate it.

If the mouse can not be moved onto a device, make sure you have port 4242 (or the one selected) opened up in your firewall.

Command Line Interface

The cli interface can be enabled using --frontend cli as commandline arguments. Type help to list the available commands.

E.g.:

$ cargo run --release -- --frontend cli
(...)
> connect <host> left|right|top|bottom
(...)
> list
(...)
> activate 0

Daemon

Lan Mouse can be launched in daemon mode to keep it running in the background. To do so, add --daemon to the commandline args:

$ cargo run --release -- --daemon

In order to start lan-mouse with a graphical session automatically, the systemd-service can be used:

Copy the file to ~/.config/systemd/user/ and enable the service:

cp service/lan-mouse.service ~/.config/systemd/user
systemctl --user daemon-reload
systemctl --user enable --now lan-mouse.service

Configuration

To automatically load clients on startup, the file $XDG_CONFIG_HOME/lan-mouse/config.toml is parsed. $XDG_CONFIG_HOME defaults to ~/.config/.

To create this file you can copy the following example config:

Example config

Tip

key symbols in the release bind are named according to their names in src/scancode.rs#L172. This is bound to change

# example configuration

# configure release bind
release_bind = [ "KeyA", "KeyS", "KeyD", "KeyF" ]

# optional port (defaults to 4242)
port = 4242
# # optional frontend -> defaults to gtk if available
# # possible values are "cli" and "gtk" 
# frontend = "gtk"

# define a client on the right side with host name "iridium"
[right]
# hostname
hostname = "iridium"
# activate this client immediately when lan-mouse is started
activate_on_startup = true
# optional list of (known) ip addresses
ips = ["192.168.178.156"]

# define a client on the left side with IP address 192.168.178.189
[left]
# The hostname is optional: When no hostname is specified,
# at least one ip address needs to be specified.
hostname = "thorium"
# ips for ethernet and wifi
ips = ["192.168.178.189", "192.168.178.172"]
# optional port
port = 4242

Where left can be either left, right, top or bottom.

Roadmap

  • Graphical frontend (gtk + libadwaita)
  • respect xdg-config-home for config file location.
  • IP Address switching
  • Liveness tracking Automatically ungrab mouse when client unreachable
  • Liveness tracking: Automatically release keys, when server offline
  • MacOS KeyCode Translation
  • Libei Input Capture
  • X11 Input Capture
  • Windows Input Capture
  • MacOS Input Capture
  • Latency measurement and visualization
  • Bandwidth usage measurement and visualization
  • Clipboard support
  • Encryption

Protocol

Currently all mouse and keyboard events are sent via UDP for performance reasons. Each event is sent as one single datagram, currently without any acknowledgement to guarantee 0% packet loss. This means, any packet that is lost results in a discarded mouse / key event, which is ignored for now.

UDP also has the additional benefit that no reconnection logic is required. Any client can just go offline and it will simply start working again as soon as it comes back online.

Additionally a tcp server is hosted for data that needs to be sent reliably (e.g. the keymap from the server or clipboard contents in the future) can be requested via a tcp connection.

Bandwidth considerations

The most bandwidth is taken up by mouse events. A typical office mouse has a polling rate of 125Hz while gaming mice typically have a much higher polling rate of 1000Hz. A mouse Event consists of 21 Bytes:

  • 1 Byte for the event type enum,
  • 4 Bytes (u32) for the timestamp,
  • 8 Bytes (f64) for dx,
  • 8 Bytes (f64) for dy.

Additionally the IP header with 20 Bytes and the udp header with 8 Bytes take up another 28 Byte. So in total there is 49 * 1000 Bytes/s for a 1000Hz gaming mouse. This makes for a bandwidth requirement of 392 kbit/s in total even for a high end gaming mouse. So bandwidth is a non-issue.

Larger data chunks, like the keymap are offered by the server via tcp listening on the same port. This way we dont need to implement any congestion control and leave this up to tcp. In the future this can be used for e.g. clipboard contents as well.

Packets per Second

While on LAN the performance is great, some WIFI cards seem to struggle with the amount of packets per second, particularly on high-end gaming mice with 1000Hz+ polling rates.

The plan is to implement a way of accumulating packets and sending them as one single key event to reduce the packet rate (basically reducing the polling rate artificially).

The way movement data is currently sent is also quite wasteful since even a 16bit integer is likely enough to represent even the fastest possible mouse movement. A different encoding that is more efficient for smaller values like Protocol Buffers would be a better choice for the future and could also help for WIFI connections.

Security

Sending key and mouse event data over the local network might not be the biggest security concern but in any public network or business environment it's QUITE a problem to basically broadcast your keystrokes.

  • There should be an encryption layer below the application to enable a secure link.
  • The encryption keys could be generated by the graphical frontend.

Wayland support

Input Emulation (for receiving events)

On wayland input-emulation is in an early/unstable state as of writing this.

For this reason a suitable backend is chosen based on the active desktop environment / compositor.

Different compositors have different ways of enabling input emulation:

Wlroots

Most wlroots-based compositors like Hyprland and Sway support the following unstable wayland protocols for keyboard and mouse emulation:

KDE

KDE also has a protocol for input emulation (kde-fake-input), it is however not exposed to third party applications.

The recommended way to emulate input on KDE is the freedesktop remote-desktop-portal.

Gnome

Gnome uses libei for input emulation and capture, which has the goal to become the general approach for emulating and capturing Input on Wayland.

Input capture

To capture mouse and keyboard input, a few things are necessary:

  • Displaying an immovable surface at screen edges
  • Locking the mouse in place
  • (optionally but highly recommended) reading unaccelerated mouse input
Required Protocols (Event Emitting) Sway Kwin Gnome
pointer-constraints-unstable-v1 ✔️ ✔️ ✔️
relative-pointer-unstable-v1 ✔️ ✔️ ✔️
keyboard-shortcuts-inhibit-unstable-v1 ✔️ ✔️ ✔️
wlr-layer-shell-unstable-v1 ✔️ ✔️

The zwlr_virtual_pointer_manager_v1 is required to display surfaces on screen edges and used to display the immovable window on both wlroots based compositors and KDE.

Gnome unfortunately does not support this protocol and likely won't ever support it.

In order for layershell surfaces to be able to lock the pointer using the pointer_constraints protocol this patch needs to be applied to sway. (this works natively on sway versions >= 1.8)

lan-mouse's People

Contributors

cupricreki avatar feschber avatar hannesschulze avatar ice-gb avatar kiwiz avatar meck avatar orhun avatar vilhalmer 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  avatar

lan-mouse's Issues

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)

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 !

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

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

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.

[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.

Not working between debian computers in GNOME 46

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

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

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

[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 }

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()
}

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.

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)

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

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!

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

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

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.)

[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.

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

Manual Release required between GNOME and XFCE

Going between GNOME Shell 46.0 and XFCE 4.18. XFCE is running on 0.7.2 bin at the moment, where as my Ubuntu machine is compiled from source (however switching to a precompiled binary the behaviour is still the same).

I'm able to go to either desktop fine, but it requires a key-press release each time to get back to GNOME. I would like to get to a state of just being able to move to either monitor without this. Would just like to validate if this just a current limitation at the moment, or something I need to fix elsewhere.

I did find similar issues (#94) but these appeared fixed in newer versions so assumed its something I'm doing or I am just misinterpreting the behavior.

Best!

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 😁 )

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

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

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.

client unresponsive after screen goes to sleep

Issue

After both server & client's monitors turn off, due to power saving, the server will not reconnect to the client until I restart the service on the server. The machines do not suspend, only turn off the monitors.

Setup

  • Arch (server - lan-mouse-git 0.7.3.r15.g36855a1a17-1)
  • Fedora (client - 0.7.3)
  • Both using wayland

Config

port = 4242
[bottom]
hostname = "matt-laptop"
activate_on_startup = true

Log

May 06 11:13:00 matt-desktop systemd[1040]: lan-mouse.service: Consumed 12.607s CPU time, 9.7M memory peak, 0B memory swap peak.
May 06 11:13:00 matt-desktop systemd[1040]: Started Lan Mouse.                                                                                                                                                                              
May 06 11:13:00 matt-desktop lan-mouse[140298]: [2024-05-06T15:13:00Z INFO  lan_mouse::config] using config: "/home/mdavis/.config/lan-mouse/config.toml"                                                                                   
May 06 11:13:00 matt-desktop lan-mouse[140298]: [2024-05-06T15:13:00Z INFO  lan_mouse] release bind: [KeyLeftCtrl, KeyLeftShift, KeyLeftMeta, KeyLeftAlt]
May 06 11:13:00 matt-desktop lan-mouse[140298]: [2024-05-06T15:13:00Z INFO  lan_mouse] Press Ctrl+Alt+Shift+Super to release the mouse                       
May 06 11:13:00 matt-desktop lan-mouse[140298]: [2024-05-06T15:13:00Z INFO  lan_mouse::emulate] wayland backend not available: the requested global was not found in the registry
May 06 11:13:00 matt-desktop lan-mouse[140298]: [2024-05-06T15:13:00Z INFO  lan_mouse::capture::libei] creating input capture session
May 06 11:13:00 matt-desktop lan-mouse[140298]: [2024-05-06T15:13:00Z INFO  lan_mouse::capture] libei input capture not available: ZBus Error: org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.InputCapt
ure” on object at path /org/freedesktop/portal/desktop                                                                                                                                                                                      
May 06 11:13:00 matt-desktop lan-mouse[140298]: [2024-05-06T15:13:00Z INFO  lan_mouse::capture] using layer-shell input capture
May 06 11:13:00 matt-desktop lan-mouse[140298]: [2024-05-06T15:13:00Z INFO  lan_mouse::emulate::libei] requesting permission for input emulation
May 06 11:13:01 matt-desktop lan-mouse[140298]: [2024-05-06T15:13:01Z INFO  lan_mouse::emulate] 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}')
May 06 11:13:01 matt-desktop lan-mouse[140298]: [2024-05-06T15:13:01Z INFO  lan_mouse::emulate::xdg_desktop_portal] requesting permission for input emulation
May 06 11:13:02 matt-desktop lan-mouse[140298]: [2024-05-06T15:13:02Z INFO  lan_mouse::emulate] using xdg-remote-desktop-portal input emulation
May 06 11:13:02 matt-desktop lan-mouse[140298]: [2024-05-06T15:13:02Z INFO  lan_mouse::server] running service
May 06 11:13:02 matt-desktop lan-mouse[140298]: [2024-05-06T15:13:02Z INFO  lan_mouse::dns] resolving matt-laptop ...
May 06 11:13:02 matt-desktop lan-mouse[140298]: [2024-05-06T15:13:02Z INFO  lan_mouse::dns] matt-laptop: adding ip 172.31.1.51
May 06 11:37:34 matt-desktop systemd[1040]: Stopping Lan Mouse...

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.

Lock the entry

Thank you for your work!

I have a suggestion:

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

Thanks.

How to run it on MacOS

I have executed this:
brew install libadwaita
and download the release "lan-mouse-macos-intel"

I chmod u+x on lan-mouse-macos-intel, when run it in terminal, I got "zsh: bad CPU type in executable: /Users/aaron/Desktop/lan-mouse-macos-intel"

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)

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

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".

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.)

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.

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.

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!

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.

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

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

Windows: Input Lost on Elevated Programs

Windows 10 is the client with Ubuntu Linux as the server, set up correctly on both ends. Whenever a program running as admin opens on Windows (UAC prompt, admin command prompt, etc.), input is lost on the Windows machine. I have to use the release keys and make sure the elevated program isn't in focus to be able to use lan-mouse again.

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.