MAUI Cloud Clipboard Client
SCAND developed a desktop background application that enables copying text from any application to a specialized cloud clipboard website, or pasting text from the cloud clipboard based on the current text selection and/or cursor position using specific hotkey combinations.
Challenge
The need to share text between user devices is a common scenario in both business and personal settings. This can be facilitated through a cloud clipboard service. While such a service typically offers a UI web page for setting and reading clipboard text across most platforms, desktop operating systems are more reliant on keyboard shortcuts for these operations. Users should be able to copy and paste text to and from the cloud clipboard using key combinations similar to the local clipboard operations like Ctrl+C and Ctrl+V on Windows, or Command+C and Command+V on macOS, with the ability to monitor the process, configure shortcuts, and adjust other settings.
Approach
The .NET framework has been cross-platform for many years. The SCAND development team chose the SharpHook .NET library for global keyboard hooking and event simulation, and the .NET MAUI platform for UI operations such as cloud sign-in, keyboard shortcuts configuration, and enabling run on system startup.
Additional third-party code and technologies used include:
- CommunityToolkit.Mvvm for facilitating the MVVM (Model-View-ViewModel) pattern.
- H.NotifyIcon library for the Notification Area (System Tray) functionality, typical for similar projects.
- Riok.Mapperly library for model/DTO mapping. The team is moving away from AutoMapper for various reasons.
- System.Runtime.InteropServices for implementing wrappers over Win32 API functions to change the mouse pointer for progress indication.
- XUnit, NSubstitute, FluentAssertions for unit and integration testing.
Description
The application emulates local clipboard behavior on desktop operating systems, allowing users to connect to a cloud service while running in the background. Users can select text in any application and transfer it to the cloud clipboard using hotkeys.
Conversely, users can place the text cursor wherever needed and press special hotkeys to paste text from the cloud clipboard to that location. The cloud clipboard text can also be managed on other devices via a web browser.
Key Features
The solution provides the following functionality:
- Configurable hotkeys for copying and pasting to/from the cloud clipboard.
- Default hotkeys: Shift + Windows (Command on macOS) + C/V.
- A dedicated window for managing the cloud clipboard through the User Interface, with a hotkey combination to access it.
- Visual indicators of ongoing cloud clipboard operations in the Notification Area (System Tray) and via the mouse pointer.
Result
Our team has developed the .NET MAUI-based cross-platform GUI application that functions seamlessly on both Windows and macOS desktops, streamlining the management of cloud clipboard text through hotkeys.