Skip to content

mvidaldev/MouseTool

Repository files navigation

MouseTool

BuyMeACoffee

MouseTool is a Windows tray utility built with .NET 10, WPF, and a small amount of native Win32 interop.

Download

The latest public builds are published on GitHub Releases:

Recommended:

  • use the installer if you want Start Menu shortcuts, uninstall support, and the easiest setup
  • use the zip package if you prefer a portable/manual installation

It is designed for dual-screen setups where:

  • the physical mouse should stay anchored to the main monitor
  • a touchscreen is used on a secondary monitor
  • the app should remember the last useful mouse position on the primary screen
  • the cursor should return to that saved primary-screen position after touchscreen interaction ends

The project was inspired by the workflow described by Touch Mouse Tools and adapted into a standalone desktop utility focused on a practical day-to-day Windows workflow.

What the app does

MouseTool separates mouse and touchscreen behavior so the touchscreen can be used as a control surface without permanently pulling the mouse away from the main work display.

Core behavior:

  • remembers the last valid mouse position on the primary monitor
  • treats touchscreen activity on the configured touchscreen monitor as secondary interaction
  • restores the cursor to the saved primary-monitor position when physical mouse activity resumes
  • can optionally restore immediately when touch ends
  • can optionally allow the physical mouse to enter the touchscreen monitor area
  • keeps the app available through a tray icon and desktop control panel

Why this is not a Windows Service

Windows Services run in Session 0 and do not have normal access to the interactive desktop session used by the logged-in user.

Because MouseTool needs to:

  • observe global input
  • react to touchscreen and mouse movement
  • move the cursor inside the active desktop session

it must run as a per-user background application instead of a true Windows Service.

Current product status

MouseTool currently includes:

  • tray-based background execution
  • a WPF control panel with fixed-size desktop layout
  • manual monitor selection with readable names
  • configurable restore behavior
  • optional startup with Windows
  • optional manual diagnostics logging
  • multilingual UI driven by JSON translation files
  • contextual help file opening based on the selected language
  • release packaging
  • setup installer
  • uninstaller
  • self-update infrastructure based on manifest check, silent uninstall, and silent reinstall

Architecture

The project is now fully centered on WPF for the desktop interface.

Main layers:

  • App.xaml and App.xaml.cs for WPF application startup
  • MainWindow.xaml and MainWindow.xaml.cs for the main dashboard
  • CloseChoiceWindow.xaml and CloseChoiceWindow.xaml.cs for the close/minimize decision dialog
  • Program.cs for application coordination, configuration, localization, help, startup registration, and the input engine
  • TrayIconHost.cs for the native tray icon and tray menu
  • MonitorManager.cs for native monitor enumeration without Windows Forms
  • NativeMethods.cs for input hooks, cursor movement, tray interop, and monitor APIs

Main UI

The application window includes:

  • top header with branding, app status, and language selector
  • tabbed interface:
    • Overview
    • Displays
    • Behavior
    • Diagnostics
  • footer command bar with run, pause, tray, config, and apply actions

Overview tab

The Overview tab is split into two columns:

  • left column:
    • active status summary
    • explanation of how MouseTool works
    • quick usage guide
    • best-practices section
    • scroll support when content exceeds the available height
  • right column:
    • fixed support area
    • gratitude text
    • clickable support email
    • help button
    • buy-me-a-coffee button

Displays tab

Lets the user choose:

  • the primary display
  • the touchscreen display

Monitor names are shown in a readable format based on role, order, resolution, and coordinates.

Behavior tab

Current options:

  • restore the mouse immediately when touch ends
  • allow the physical mouse to enter the touchscreen display area
  • start MouseTool with Windows

Diagnostics tab

Current controls:

  • enable logging
  • disable logging
  • open log file

Logging is disabled by default.

Tray behavior

The app stays available through the system tray and supports:

  • opening the dashboard from the tray
  • starting protection
  • pausing protection
  • opening help
  • exiting the app
  • opening the dashboard with left click or double click on the tray icon
  • opening the tray menu with right click

Language system

The UI text is driven by JSON files under:

  • Resources\Lang

Currently supported languages:

  • English
  • Portuguese (Brazil)
  • French
  • Spanish
  • German
  • Italian
  • Russian

Behavior:

  • default language follows the Windows system language when available
  • users can manually choose a language from the header selector
  • after changing the language, the app asks the user to restart
  • the UI loads from the selected JSON language file on the next launch

Current language files:

  • lang.en.json
  • lang.pt-BR.json
  • lang.fr.json
  • lang.es.json
  • lang.de.json
  • lang.it.json
  • lang.ru.json

Help system

MouseTool generates localized help files in the output folder under help.

Supported help files currently include:

  • HELP.en.html
  • HELP.pt-BR.html
  • HELP.fr.html
  • HELP.es.html
  • HELP.de.html
  • HELP.it.html
  • HELP.ru.html

The app opens the help file that matches the currently selected language when possible, with fallback to English when necessary.

Configuration

The app writes mousekeeper.config.json into the per-user data folder:

  • %LOCALAPPDATA%\MouseTool\mousekeeper.config.json

Important fields include:

  • Enabled
  • LoggingEnabled
  • StartWithWindows
  • SelectedLanguage
  • AllowMouseOnTouchscreen
  • PrimaryMonitorDeviceName
  • TouchMonitorDeviceName
  • RestoreImmediatelyOnTouchRelease
  • LastPrimaryMousePosition

Startup behavior

MouseTool can register itself in:

  • HKCU\Software\Microsoft\Windows\CurrentVersion\Run

This is controlled by the Start with Windows option in the app.

Logging

Logging is manual and disabled by default.

The diagnostic log file is written into the per-user data folder as:

  • %LOCALAPPDATA%\MouseTool\mousekeeper.log

Use logging only when you need to investigate behavior during testing.

Auto-update

The installed build can now check a published JSON manifest and apply an update by:

  • downloading the newest installer
  • validating the installer SHA-256 hash
  • opening the published changelog for the target version before installation
  • starting a separate updater helper
  • closing MouseTool
  • silently uninstalling the current installed version
  • silently reinstalling the new version into the same path
  • relaunching MouseTool

The default manifest URL used by the app is:

  • https://github.com/mvidaldev/MouseTool/releases/latest/download/update.json

The updater helper is shipped as:

  • MouseTool.Updater.exe

The release changelog is published as:

  • MouseTool-CHANGELOG.md

License

MouseTool is licensed under the GNU GPL-3.0.

That means:

  • you can use, study, modify, and redistribute the software
  • if you distribute modified versions, you must also keep them under GPL-3.0
  • source code for redistributed derivatives must remain available under the same license

License file:

  • LICENSE

Build

$env:DOTNET_CLI_HOME = "$PWD\\.dotnet-home"
$env:NUGET_PACKAGES = "$PWD\\.nuget\\packages"
$env:NUGET_CONFIG_FILE = "$PWD\\NuGet.Config"
& "C:\Program Files\dotnet\dotnet.exe" build

Run locally

& "C:\Program Files\dotnet\dotnet.exe" run

Publish release

Use:

powershell -ExecutionPolicy Bypass -File Z:\projetos\Codex\MouseTool\publish-release.ps1

This generates:

  • release folder
  • zip package
  • setup installer executable
  • update manifest JSON

Local release outputs:

  • MouseTool.exe
  • MouseTool.Updater.exe
  • MouseTool-win-x64.zip
  • MouseTool-Setup.exe
  • MouseTool-CHANGELOG.md
  • update.json

Public downloads:

Installer

The installer is generated with Inno Setup.

It currently:

  • installs MouseTool into %LocalAppData%\Programs\MouseTool
  • creates application shortcuts
  • installs the updater helper next to the main executable
  • launches the app after installation
  • registers uninstall information in Windows
  • includes uninstall support through Windows settings and the Start Menu

Installer source files:

  • publish-release.ps1
  • MouseTool.iss
  • install.cmd
  • install-mousetool.ps1

Uninstaller

The project includes an uninstaller that:

  • stops the running app
  • removes shortcuts
  • removes startup registration
  • removes uninstall registry entries
  • deletes the installed application folder

Uninstaller source files:

  • uninstall.cmd
  • uninstall-mousetool.ps1

Project structure

Main files:

  • App.xaml
  • App.xaml.cs
  • MainWindow.xaml
  • MainWindow.xaml.cs
  • CloseChoiceWindow.xaml
  • CloseChoiceWindow.xaml.cs
  • Program.cs
  • TrayIconHost.cs
  • MonitorManager.cs
  • NativeMethods.cs
  • MouseTool.csproj

Resources:

  • Resources\Lang
  • Installer

Technical notes

  • target framework: net10.0-windows
  • UI framework: WPF
  • tray implementation: native shell icon via Win32 interop
  • execution model: tray app running in the logged-in desktop session
  • monitor detection uses native monitor enumeration with manual selection support
  • touchscreen behavior may vary depending on hardware driver behavior
  • fallback logic exists for systems where touch input is exposed differently

References

Behavior and workflow inspiration:

Installer packaging references:

About

MouseTool is a WPF Windows tray utility that keeps the mouse anchored to the primary monitor while a touchscreen works on a second display, restoring the last saved cursor position for seamless dual-screen control, localization, logging, and setup.

Resources

License

Stars

Watchers

Forks

Packages