lan-mouse icon indicating copy to clipboard operation
lan-mouse copied to clipboard

[Windows client + Linux Server] lan-mouse doesn't work at all

Open daniel-pg opened this issue 3 months ago • 2 comments

I have a Linux desktop (server) where my primary mouse+keyboard are attached to, and a Windows laptop (client) that I want to control remotely. Both are connected to the same router on the same LAN. I then perform these steps:

  1. Open lan-mouse on both computers
  2. (client) Create firewall rule for lan-mouse.exe
  3. (client) Get local IP address with ipconfig /all
  4. (server) In the Connections section, click the Add button, type the IP address of the client in the hostname field, and enable the connection.
  5. (server) A popup appears asking for Input Capture permission. I clicked "Allow".
  6. (client) NO "Incoming connections" section appears. I try to move the mouse from the server to the client anyways, and a warning appears in the client's log window: WARN lan_mouse::server::emulation_task] ignoring events from client <server_lan_ip>:4242.

What puzzles me is why the log said it is ignoring inputs from the client when it should be the server that sends the inputs (unless in lan-mouse it is the opposite of Deskflow and Input-Leap)

Note: If I try to type the computer name in the hostname field literally (i.e. my-laptop) instead of the IP, nothing happens and a yellow icon appears saying "No ip addresses associated with this client".

Linux system info:

Operating System: Artix Linux 
KDE Plasma Version: 6.4.5
KDE Frameworks Version: 6.18.0
Qt Version: 6.9.2
Kernel Version: 6.16.7-artix1-1 (64-bit)
Graphics Platform: Wayland
Processors: 24 × AMD Ryzen 9 9900X 12-Core Processor
Memory: 32 GiB of RAM (30.4 GiB usable)
Graphics Processor 1: NVIDIA GeForce GTX 1060 6GB
Graphics Processor 2: AMD Radeon Graphics
Manufacturer: Micro-Star International Co., Ltd.
Product Name: MS-7E62
System Version: 2.0

daniel-pg avatar Oct 01 '25 12:10 daniel-pg

I was this problem, workaround for me:

create powershell script, its run daemon windows client, and rerun it by error:

# =============================
# LAN-Mouse Watchdog (clean)
# =============================

$LanMousePath = "C:\Users\kostinnik\Documents\lan\lan-mouse.exe"
$ErrorPattern = "not responding|network error|connection reset|os error 10040"

function Log { param($msg) ; Write-Host $msg }

$Global:LMProcess = $null
$Global:RestartNeeded = $false

function Start-LanMouse {
    if ($Global:LMProcess) {
        try { $Global:LMProcess.Kill() } catch {}
        $Global:LMProcess.Dispose()
        $Global:LMProcess = $null
    }

    # remove prev event subcription
    Get-EventSubscriber | Where-Object {$_.SourceIdentifier -in @("LMOut","LMErr")} | Unregister-Event

    $startInfo = New-Object System.Diagnostics.ProcessStartInfo
    $startInfo.FileName = $LanMousePath
    $startInfo.Arguments = "daemon"
    $startInfo.RedirectStandardOutput = $true
    $startInfo.RedirectStandardError  = $true
    $startInfo.UseShellExecute = $false
    $startInfo.CreateNoWindow = $true

    $proc = New-Object System.Diagnostics.Process
    $proc.StartInfo = $startInfo
    $proc.Start() | Out-Null
    $proc.BeginOutputReadLine()
    $proc.BeginErrorReadLine()
    $Global:LMProcess = $proc

    # stdout event
    Register-ObjectEvent -InputObject $proc -EventName OutputDataReceived -SourceIdentifier LMOut -Action {
        if ($EventArgs.Data) {
            Log "$($EventArgs.Data)"
            if ($EventArgs.Data -match $ErrorPattern) {
                Log "[!] Error detected -> scheduling restart"
                $Global:RestartNeeded = $true
            }
        }
    }

    # stderr event
    Register-ObjectEvent -InputObject $proc -EventName ErrorDataReceived -SourceIdentifier LMErr -Action {
        if ($EventArgs.Data) {
            Log "$($EventArgs.Data)"
            if ($EventArgs.Data -match $ErrorPattern) {
                Log "[!] Error detected -> scheduling restart"
                $Global:RestartNeeded = $true
            }
        }
    }

    Log "✅ lan-mouse started."
}


try {
    # основной код Watchdog
    Start-LanMouse
    Log "Watchdog started. Press Ctrl+C to stop."
    while ($true) {
        Start-Sleep -Milliseconds 500
        if ($Global:RestartNeeded) {
            Log "[!] Restarting lan-mouse..."
            Start-LanMouse
            $Global:RestartNeeded = $false
        }

        if ($Global:LMProcess -and $Global:LMProcess.HasExited) {
            Log "[!] lan-mouse crashed. Restarting..."
            Start-LanMouse
        }
    }
}
finally {
    # cleanup при выходе скрипта
    Log "🛑 Watchdog stopping. Killing lan-mouse..."
    if ($Global:LMProcess) {
        try { $Global:LMProcess.Kill() } catch {}
    }
}

F1st3K avatar Oct 07 '25 17:10 F1st3K

For encryption and the "incoming connections" section, you will need to use the pre-release version (which I recommend!). Otherwise, it won't work.

And yes, your assumption is correct that the server is the device, to which mouse and keyboard are attached to (the one controlling other devices), opposite to deskflow / input-leap.

Technically every device is a server by default with lan-mouse, where the server is the device receiving inputs.

feschber avatar Oct 07 '25 20:10 feschber