Added "Make active window borderless" hotkey

This commit is contained in:
Jaex 2024-06-25 21:06:34 +03:00
parent c87c3f66bc
commit 7d1724edf3
4 changed files with 27 additions and 1 deletions

View file

@ -1279,6 +1279,15 @@ internal class Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Make active window borderless.
/// </summary>
internal static string HotkeyType_ActiveWindowBorderless {
get {
return ResourceManager.GetString("HotkeyType_ActiveWindowBorderless", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Auto capture.
/// </summary>

View file

@ -1299,4 +1299,7 @@ Would you like to download and install it?</value>
<data name="DownloaderForm_FileDownloader_ProgressChanged_FileSize" xml:space="preserve">
<value>File size</value>
</data>
<data name="HotkeyType_ActiveWindowBorderless" xml:space="preserve">
<value>Make active window borderless</value>
</data>
</root>

View file

@ -302,6 +302,8 @@ public enum HotkeyType // Localized
[Category(EnumExtensions.HotkeyType_Category_Tools)]
BorderlessWindow,
[Category(EnumExtensions.HotkeyType_Category_Tools)]
ActiveWindowBorderless,
[Category(EnumExtensions.HotkeyType_Category_Tools)]
InspectWindow,
[Category(EnumExtensions.HotkeyType_Category_Tools)]
MonitorTest,

View file

@ -270,7 +270,10 @@ public static async Task ExecuteJob(TaskSettings taskSettings, HotkeyType job, C
OpenClipboardViewer();
break;
case HotkeyType.BorderlessWindow:
OpenBorderlessWindow();
OpenBorderlessWindow(safeTaskSettings);
break;
case HotkeyType.ActiveWindowBorderless:
MakeActiveWindowBorderless(safeTaskSettings);
break;
case HotkeyType.InspectWindow:
OpenInspectWindow();
@ -938,6 +941,14 @@ public static void OpenBorderlessWindow(TaskSettings taskSettings = null)
borderlessWindowForm.Show();
}
public static void MakeActiveWindowBorderless(TaskSettings taskSettings = null)
{
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
IntPtr handle = NativeMethods.GetForegroundWindow();
BorderlessWindowManager.ToggleBorderlessWindow(handle, taskSettings.ToolsSettings.BorderlessWindowSettings.ExcludeTaskbarArea);
}
public static void OpenInspectWindow()
{
InspectWindowForm inspectWindowForm = new InspectWindowForm();
@ -1731,6 +1742,7 @@ public static void OpenCustomUploaderSettingsWindow()
case HotkeyType.IndexFolder: return Resources.folder_tree;
case HotkeyType.ClipboardViewer: return Resources.clipboard_block;
case HotkeyType.BorderlessWindow: return Resources.application_resize_full;
case HotkeyType.ActiveWindowBorderless: return Resources.application_resize_full;
case HotkeyType.InspectWindow: return Resources.application_search_result;
case HotkeyType.MonitorTest: return Resources.monitor;
case HotkeyType.DNSChanger: return Resources.network_ip;