From 4ea876062a5dbefd19d4e32bb77b7feeeefe6a90 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 11 Dec 2024 15:07:25 +0000 Subject: [PATCH] deploy: 03e48ec11ead99e4fff7a66162d13dcd90dca4b7 --- catalog.json | 20 ++++ changelogs/remove-quotes-from-ctrl-shift-c.md | 3 + mods/remove-quotes-from-ctrl-shift-c.wh.cpp | 92 +++++++++++++++++++ updates.atom | 34 ++++--- 4 files changed, 135 insertions(+), 14 deletions(-) create mode 100644 changelogs/remove-quotes-from-ctrl-shift-c.md create mode 100644 mods/remove-quotes-from-ctrl-shift-c.wh.cpp diff --git a/catalog.json b/catalog.json index 0b5c16cf..28910df4 100644 --- a/catalog.json +++ b/catalog.json @@ -2362,6 +2362,26 @@ "version": "1.0.0" } }, + "remove-quotes-from-ctrl-shift-c": { + "details": { + "defaultSorting": 0, + "published": 1733929613000, + "rating": 0, + "ratingUsers": 0, + "updated": 1733929613000, + "users": 0 + }, + "metadata": { + "author": "draxas", + "description": "Intercepts the copied file path (CTRL+SHIFT+C in Explorer) and removes surrounding quotes", + "github": "https://github.com/draxas", + "include": [ + "explorer.exe" + ], + "name": "CTRL+SHIFT+C quotes remover", + "version": "1.0" + } + }, "ribbon-caption-icon-fix": { "details": { "defaultSorting": 3080, diff --git a/changelogs/remove-quotes-from-ctrl-shift-c.md b/changelogs/remove-quotes-from-ctrl-shift-c.md new file mode 100644 index 00000000..88e2cbb9 --- /dev/null +++ b/changelogs/remove-quotes-from-ctrl-shift-c.md @@ -0,0 +1,3 @@ +## 1.0 ([Dec 11, 2024](https://github.com/ramensoftware/windhawk-mods/blob/03e48ec11ead99e4fff7a66162d13dcd90dca4b7/mods/remove-quotes-from-ctrl-shift-c.wh.cpp)) + +Initial release. diff --git a/mods/remove-quotes-from-ctrl-shift-c.wh.cpp b/mods/remove-quotes-from-ctrl-shift-c.wh.cpp new file mode 100644 index 00000000..7e956353 --- /dev/null +++ b/mods/remove-quotes-from-ctrl-shift-c.wh.cpp @@ -0,0 +1,92 @@ +// ==WindhawkMod== +// @id remove-quotes-from-ctrl-shift-c +// @name CTRL+SHIFT+C quotes remover +// @description Intercepts the copied file path (CTRL+SHIFT+C in Explorer) and removes surrounding quotes +// @version 1.0 +// @author draxas +// @github https://github.com/draxas +// @include explorer.exe +// ==/WindhawkMod== + +// ==WindhawkModReadme== +/* +# Remove quotes from CTRL+SHIFT+C file paths + +When you press `CTRL+SHIFT+C` on a file in Windows Explorer, the file’s full path is usually copied to the clipboard with quotes, for example: `"C:\Path\To\File.txt"`. With this mod, those quotes are automatically removed, leaving you with a clean, unquoted path for easier use. + +## How it works +- Whenever you copy a file path using `CTRL+SHIFT+C`, this mod intercepts the text before it’s placed into the clipboard. +- If the path is enclosed in quotes, they are removed. +- You end up with a path like `C:\Path\To\File.txt` instead of `"C:\Path\To\File.txt"`. + +No additional configuration is needed—just use CTRL+SHIFT+C as you normally would. +*/ +// ==/WindhawkModReadme== + +// ==WindhawkModSettings== +// No settings are defined for this mod. +// ==/WindhawkModSettings== + +#include +#include + +typedef HANDLE (WINAPI *SetClipboardData_t)(UINT uFormat, HANDLE hMem); +SetClipboardData_t SetClipboardData_Original; + +static void RemoveSurroundingQuotes(wchar_t* str) { + size_t len = wcslen(str); + if (len >= 2 && str[0] == L'\"' && str[len - 1] == L'\"') { + wmemmove(str, str + 1, len - 2); + str[len - 2] = L'\0'; + } +} + +HANDLE WINAPI SetClipboardData_Hook(UINT uFormat, HANDLE hMem) { + if (uFormat == CF_UNICODETEXT && hMem) { + LPWSTR pData = (LPWSTR)GlobalLock(hMem); + if (pData) { + size_t len = wcslen(pData); + wchar_t* buffer = (wchar_t*)HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(wchar_t)); + if (buffer) { + wcscpy_s(buffer, len + 1, pData); + GlobalUnlock(hMem); + + RemoveSurroundingQuotes(buffer); + + size_t newLen = wcslen(buffer); + HGLOBAL hNew = GlobalAlloc(GMEM_MOVEABLE, (newLen + 1) * sizeof(wchar_t)); + if (hNew) { + LPWSTR pNewData = (LPWSTR)GlobalLock(hNew); + if (pNewData) { + wcscpy_s(pNewData, newLen + 1, buffer); + GlobalUnlock(hNew); + HeapFree(GetProcessHeap(), 0, buffer); + return SetClipboardData_Original(uFormat, hNew); + } + GlobalFree(hNew); + } + HeapFree(GetProcessHeap(), 0, buffer); + } else { + GlobalUnlock(hMem); + } + } + } + + return SetClipboardData_Original(uFormat, hMem); +} + +BOOL Wh_ModInit() { + Wh_Log(L"Init remove-quotes-from-ctrl-shift-c mod"); + + Wh_SetFunctionHook((void*)SetClipboardData, (void*)SetClipboardData_Hook, (void**)&SetClipboardData_Original); + + return TRUE; +} + +void Wh_ModUninit() { + Wh_Log(L"Uninit remove-quotes-from-ctrl-shift-c mod"); +} + +void Wh_ModSettingsChanged() { + Wh_Log(L"SettingsChanged remove-quotes-from-ctrl-shift-c mod"); +} diff --git a/updates.atom b/updates.atom index 53f02e52..fb766e05 100644 --- a/updates.atom +++ b/updates.atom @@ -2,12 +2,31 @@ https://windhawk.net/ Windhawk Mod Updates - 2024-12-10T14:57:10.000Z + 2024-12-11T15:06:53.000Z https://github.com/jpmonette/feed Updates in the official collection of Windhawk mods https://windhawk.net/favicon.ico Ramen Software + + <![CDATA[CTRL+SHIFT+C quotes remover 1.0]]> + https://windhawk.net/mods/remove-quotes-from-ctrl-shift-c#03e48ec11ead99e4fff7a66162d13dcd90dca4b7 + + 2024-12-11T15:06:53.000Z + Remove quotes from CTRL+SHIFT+C file paths +

When you press CTRL+SHIFT+C on a file in Windows Explorer, the file’s full path is usually copied to the clipboard with quotes, for example: "C:\Path\To\File.txt". With this mod, those quotes are automatically removed, leaving you with a clean, unquoted path for easier use.

+

How it works

+
    +
  • Whenever you copy a file path using CTRL+SHIFT+C, this mod intercepts the text before it’s placed into the clipboard.
  • +
  • If the path is enclosed in quotes, they are removed.
  • +
  • You end up with a path like C:\Path\To\File.txt instead of "C:\Path\To\File.txt".
  • +
+

No additional configuration is needed—just use CTRL+SHIFT+C as you normally would.

]]>
+ + draxas + https://github.com/draxas + +
<![CDATA[Windows 11 Start Menu Styler 1.2]]> https://windhawk.net/mods/windows-11-start-menu-styler#8db53b86b7fb576eaf44aaa772c00a53a8933590 @@ -288,19 +307,6 @@ center, etc. to another monitor.

2024-11-16T00:41:37.000Z
  • Fix resource leak
  • -]]>
    - - aubymori - https://github.com/aubymori - -
    - - <![CDATA[Fix Basic Caption Text 1.1.1]]> - https://windhawk.net/mods/fix-basic-caption-text#2613791dbe45f4777ff658a06d3cb430e8b26285 - - 2024-11-15T07:36:59.000Z - -
  • Make behavior accurate to Windows 7; custom frames (e.g. UIRibbon) will always show active color when composition is enabled
  • ]]>
    aubymori