mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-05-15 06:06:07 -06:00
[PR #407] feat: single-instance application support #405
Labels
No labels
Xorg
documentation
enhancement
macos
pull-request
question
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/lan-mouse#405
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/feschber/lan-mouse/pull/407
Author: @tyvsmith
Created: 3/29/2026
Status: 🔄 Open
Base:
main← Head:feat/single-instance📝 Commits (2)
380eab4feat: single-instance application support3698abdfix: use windows().first() instead of active_window() for re-activation check📊 Changes
4 files changed (+90 additions, -13 deletions)
View changed files
📝
lan-mouse-gtk/src/lib.rs(+25 -3)📝
lan-mouse-ipc/src/connect.rs(+32 -0)📝
lan-mouse-ipc/src/lib.rs(+16 -1)📝
src/main.rs(+17 -9)📄 Description
Summary
Fixes #406 — makes lan-mouse a single-instance application so that repeated GUI launches reuse the existing daemon and raise the existing window.
is_service_running()before spawning a daemon child process. If a daemon is already listening, skip spawning and connect the GTK frontend to it. Daemon lifecycle cleanup (SIGINT + wait + kill) only runs if we spawned the daemon ourselves.is_service_running()for a one-shot socket probe (Unix socket / TCP on Windows). Addtry_connect()that attempts a single connection without the infinite retry loop ofconnect()/wait_for_service(). Extract shared connection-building intomake_connection().app.active_window()on activate and present the existing window instead of creating a duplicate. Usetry_connect()first, falling back to spawning a new daemon +connect()if the connection fails — handles the edge case where a daemon dies between the main.rs probe and the GTK connection attempt.Behavior changes
lan-mouse daemon), closing the GUI no longer kills it.Test plan
Verified locally on Arch Linux + Hyprland (Wayland):
lan-mouse daemonstarted separately, thenlan-mouseGUI: connects to existing daemon, closing GUI leaves daemon runningcargo fmtpassescargo buildsucceeds🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.