hotkey-config #1

Merged
scoped merged 10 commits from hotkey-config into master 2026-02-22 12:45:38 -05:00
4 changed files with 27 additions and 12 deletions
Showing only changes of commit 52a2515e2d - Show all commits

View File

@@ -18,12 +18,12 @@
<PackageCertificateThumbprint>4A55954F2A73A9D620442C7DFBFC7C95A71D8D24</PackageCertificateThumbprint> <PackageCertificateThumbprint>4A55954F2A73A9D620442C7DFBFC7C95A71D8D24</PackageCertificateThumbprint>
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm> <AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision> <AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
<AppxPackageDir>C:\Users\Blade\Desktop\Clipforge Packaged\V1\</AppxPackageDir> <AppxPackageDir>C:\Users\Blade\Desktop\Clipforge Packaged\V0.1\</AppxPackageDir>
<AppxSymbolPackageEnabled>False</AppxSymbolPackageEnabled> <AppxSymbolPackageEnabled>False</AppxSymbolPackageEnabled>
<GenerateTestArtifacts>True</GenerateTestArtifacts> <GenerateTestArtifacts>True</GenerateTestArtifacts>
<AppxBundle>Auto</AppxBundle> <AppxBundle>Auto</AppxBundle>
<AppxBundlePlatforms>x64</AppxBundlePlatforms> <AppxBundlePlatforms>x64</AppxBundlePlatforms>
<AppInstallerUri>J:\Projects\ClipForge\ClipForge\bin\x64\Release\net8.0-windows10.0.19041.0</AppInstallerUri> <AppInstallerUri>C:\Users\Blade\Desktop\Clipforge Packaged</AppInstallerUri>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks> <HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
</PropertyGroup> </PropertyGroup>

View File

@@ -371,22 +371,24 @@
FontWeight="SemiBold" FontWeight="SemiBold"
VerticalAlignment="Center"/> VerticalAlignment="Center"/>
</StackPanel> </StackPanel>
<TextBlock Text="The key combination to save a clip." <TextBlock Text="Click the key below, then press your desired combination."
FontSize="12" FontSize="12"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"/> Foreground="{ThemeResource TextFillColorSecondaryBrush}"/>
<Border Background="#1a1a2e" <Button x:Name="HotkeyRecorderButton"
HorizontalAlignment="Left"
Click="HotkeyRecorderButton_Click"
Background="#1a1a2e"
BorderThickness="0"
CornerRadius="6" CornerRadius="6"
Padding="16,10" Padding="16,10"
HorizontalAlignment="Left"> MinWidth="140">
<TextBlock Text="Alt + F9" <TextBlock x:Name="HotkeyRecorderText"
Text="Alt + F9"
FontFamily="Consolas" FontFamily="Consolas"
FontSize="14" FontSize="14"
FontWeight="Bold" FontWeight="Bold"
Foreground="#E8FF47"/> Foreground="#E8FF47"/>
</Border> </Button>
<TextBlock Text="Hotkey remapping coming in a future update."
FontSize="11"
Foreground="{ThemeResource TextFillColorTertiaryBrush}"/>
</StackPanel> </StackPanel>
</Border> </Border>

View File

@@ -1,10 +1,12 @@
using Microsoft.UI.Xaml; using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media.Animation; using Microsoft.UI.Xaml.Media.Animation;
using Microsoft.Win32; using Microsoft.Win32;
using System; using System;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Windows.System;
using WinRT.Interop; using WinRT.Interop;
namespace ClipForge namespace ClipForge
@@ -16,6 +18,7 @@ namespace ClipForge
private ClipLibraryService _clipLibrary; private ClipLibraryService _clipLibrary;
private SettingsService _settingsService; private SettingsService _settingsService;
private ThumbnailService _thumbnailService; private ThumbnailService _thumbnailService;
private bool _isRecordingHotkey;
private delegate IntPtr WinProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam); private delegate IntPtr WinProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);
private WinProc _newWndProc; private WinProc _newWndProc;
@@ -41,6 +44,13 @@ namespace ClipForge
private static extern IntPtr SendMessage(IntPtr hWnd, uint msg, private static extern IntPtr SendMessage(IntPtr hWnd, uint msg,
IntPtr wParam, IntPtr lParam); IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll")]
private static extern short GetAsyncKeyState(int vk);
private const int VK_SHIFT = 0x10;
private const int VK_CONTROL = 0x11;
private const int VK_MENU = 0x12; // Alt
private const int VK_LWIN = 0x5B;
private const int GWLP_WNDPROC = -4; private const int GWLP_WNDPROC = -4;
private const uint WM_HOTKEY = 0x0312; private const uint WM_HOTKEY = 0x0312;
private const int GWL_EXSTYLE = -20; private const int GWL_EXSTYLE = -20;
@@ -78,7 +88,10 @@ namespace ClipForge
_hotkeyService = new GlobalHotkeyService(); _hotkeyService = new GlobalHotkeyService();
_hotkeyService.ClipRequested += OnClipRequested; _hotkeyService.ClipRequested += OnClipRequested;
_hotkeyService.Initialize(hwnd); var mod = _settingsService.Settings.HotkeyModifiers;
var vk = _settingsService.Settings.HotkeyVirtualKey;
if (mod == 0 && vk == 0) { mod = 1; vk = 0x78; }
_hotkeyService.Initialize(hwnd, (uint)mod, (uint)vk);
ClipGrid.ItemsSource = _clipLibrary.Clips; ClipGrid.ItemsSource = _clipLibrary.Clips;
UpdateClipCount(); UpdateClipCount();

View File

@@ -11,7 +11,7 @@
<Identity <Identity
Name="735fb287-32b4-4217-b84a-302365dc5e23" Name="735fb287-32b4-4217-b84a-302365dc5e23"
Publisher="CN=SCOPEDD" Publisher="CN=SCOPEDD"
Version="1.0.0.0" /> Version="0.1.0.0" />
<mp:PhoneIdentity PhoneProductId="735fb287-32b4-4217-b84a-302365dc5e23" PhonePublisherId="00000000-0000-0000-0000-000000000000"/> <mp:PhoneIdentity PhoneProductId="735fb287-32b4-4217-b84a-302365dc5e23" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>