Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>

<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>

<ItemGroup>
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageVersion Include="coverlet.msbuild" Version="6.0.4" />
<PackageVersion Include="GitVersion.MsBuild" Version="6.3.0" />
<PackageVersion Include="H.NotifyIcon.Wpf" Version="2.3.0" />
<PackageVersion Include="Handlebars.Net" Version="2.1.6" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageVersion Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.3" />
<PackageVersion Include="Microsoft.Windows.CsWin32" Version="0.3.183" />
<PackageVersion Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.135" />
<PackageVersion Include="Moq" Version="4.20.72" />
Expand All @@ -29,5 +28,4 @@
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.0" />
</ItemGroup>

</Project>
</Project>
5 changes: 3 additions & 2 deletions Installer/ShadowKVM.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
<Icon Id="Icon" SourceFile="..\ShadowKVM\UserInterface\Application.ico" />
<Property Id="ARPPRODUCTICON" Value="Icon" />

<!-- Check for Windows 8 or newer -->
<!-- Check for Windows 10 or newer -->
<!-- TODO This actually checks for Windows 8 or newer, find out how to check for Windows 10 -->
<Launch
Condition="Installed OR (VersionNT >= 602)"
Message="This application requires Windows 8 or newer." />
Message="This application requires Windows 10 or newer." />

<!-- Always replace installed package when updating -->
<MajorUpgrade
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ If you have multiple computers connected to the same displays and a USB switch t

## Requirements

- Windows 8.0 or newer
- Windows 10.0 or newer
- Monitors that support DDC/CI for input switching
- A USB switch with a connected keyboard (and optionally a mouse)

Expand Down
2 changes: 1 addition & 1 deletion ShadowKVM.Tests/ShadowKVM.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0-windows</TargetFramework>
<TargetFramework>net9.0-windows10.0.17763.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
Expand Down
6 changes: 3 additions & 3 deletions ShadowKVM.Tests/UserInterface/ConfigEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public async Task EditConfig_WithNoChanges()
_nativeUserInterface.Verify();
_logger.Verify();

_nativeUserInterface.Verify(m => m.InfoBox(It.IsAny<string>(), It.IsAny<string>()), Times.Never);
_nativeUserInterface.Verify(m => m.InfoToast(It.IsAny<string>()), Times.Never);

Assert.True(openedEvent);
Assert.True(closedEvent);
Expand All @@ -70,7 +70,7 @@ public async Task EditConfig_WithChanges()
.Verifiable();

_nativeUserInterface
.Setup(m => m.InfoBox("Configuration file loaded successfully", "Shadow KVM"))
.Setup(m => m.InfoToast("Configuration file loaded successfully"))
.Verifiable();

var editor = new ConfigEditor(_configService.Object, _nativeUserInterface.Object, _logger.Object);
Expand Down Expand Up @@ -184,6 +184,6 @@ public async Task EditConfig_WithoutEventHandlers()
_nativeUserInterface.Verify();
_logger.Verify();

_nativeUserInterface.Verify(m => m.InfoBox(It.IsAny<string>(), It.IsAny<string>()), Times.Never);
_nativeUserInterface.Verify(m => m.InfoToast(It.IsAny<string>()), Times.Never);
}
}
2 changes: 0 additions & 2 deletions ShadowKVM/Devices/WindowsAPI.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Management;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Windows.Win32;
using Windows.Win32.Devices.Display;
using Windows.Win32.Devices.DeviceAndDriverInstallation;
Expand Down Expand Up @@ -113,7 +112,6 @@ public unsafe int GetVCPFeatureAndVCPFeatureReply(
}

// For DeviceNotificationService
[SupportedOSPlatform("windows8.0")]
public unsafe CONFIGRET CM_Register_Notification(CM_NOTIFY_FILTER pFilter, nuint pContext,
PCM_NOTIFY_CALLBACK pCallback, out CM_Unregister_NotificationSafeHandle pNotifyContext)
{
Expand Down
5 changes: 3 additions & 2 deletions ShadowKVM/ShadowKVM.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net9.0-windows</TargetFramework>
<TargetFramework>net9.0-windows10.0.17763.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>

<PropertyGroup>
<ApplicationIcon>UserInterface/Application.ico</ApplicationIcon>
<AssemblyTitle>Shadow KVM: Sync your monitor inputs with a USB switch for seamless multi-PC control</AssemblyTitle>
<AssemblyTitle>Shadow KVM</AssemblyTitle>
<Authors>Matúš Horváth</Authors>
<Copyright>© 2025 Matúš Horváth. All rights reserved.</Copyright>
<Product>Shadow KVM</Product>
Expand All @@ -26,6 +26,7 @@
</PackageReference>
<PackageReference Include="H.NotifyIcon.Wpf" />
<PackageReference Include="Handlebars.Net" />
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" />
<PackageReference Include="Microsoft.Windows.CsWin32">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
2 changes: 1 addition & 1 deletion ShadowKVM/UserInterface/ConfigEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public async Task EditConfig()
return;
}

nativeUserInterface.InfoBox("Configuration file loaded successfully", "Shadow KVM");
nativeUserInterface.InfoToast("Configuration file loaded successfully");
}
finally
{
Expand Down
16 changes: 10 additions & 6 deletions ShadowKVM/UserInterface/NativeUserInterface.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Windows;
using Microsoft.Toolkit.Uwp.Notifications;

namespace ShadowKVM;

Expand All @@ -10,9 +11,10 @@ public interface INativeUserInterface
void OpenUrl(string url);

void ErrorBox(string message, string title);
void InfoBox(string message, string title);
bool QuestionBox(string message, string title);

void InfoToast(string message);

void ShowWindow<TWindow, TDataContext>(TDataContext? dataContext = null, EventHandler? closedHandler = null)
where TWindow : Window, new()
where TDataContext : class;
Expand Down Expand Up @@ -42,17 +44,19 @@ public void ErrorBox(string message, string title)
MessageBox.Show(message, title, MessageBoxButton.OK, MessageBoxImage.Error);
}

public void InfoBox(string message, string title)
{
MessageBox.Show(message, title, MessageBoxButton.OK, MessageBoxImage.Information);
}

public bool QuestionBox(string message, string title)
{
var result = MessageBox.Show(message, title, MessageBoxButton.YesNo, MessageBoxImage.Question);
return result == MessageBoxResult.Yes;
}

public void InfoToast(string message)
{
new ToastContentBuilder()
.AddText(message)
.Show();
}

public void ShowWindow<TWindow, TDataContext>(TDataContext? dataContext = null, EventHandler? closedHandler = null)
where TWindow : Window, new()
where TDataContext : class
Expand Down