Click anywhere to drag window #23804

Open
opened 2026-01-31 08:53:02 +00:00 by claunia · 1 comment
Owner

Originally created by @gfody on GitHub (Nov 17, 2025).

Description of the new feature

I find myself missing this subtle feature from ConsoleZ where you could ctrl+click to grab the window from anywhere instead of having to hit the (increasingly small) non-client area of the titlebar, eg:

https://github.com/user-attachments/assets/77227fbe-4187-4793-ac2b-109804735ebe

the feature was called "drag window" and by default ctrl+left activated it but being able to configure it as middle click no modifier seems cool too.

Image

I propose ripping this feature off whole-hog 😁

Proposed technical implementation details

besides plumbing the options, I think the actual functionality could be as easy as copying this old trick I used in ConsoleZ, basically:
- on mouse down, if feature enabled and conditions met
- release the mouse capture
- send a WM_NCLBUTTONDOWN w/HTCAPTION to the main window handle

(assuming uwp apps still have main window handles and message pumps 🤷)

edit: it might be sylish to flip the pointer to "grab" and then "grabbing" on the modifier keydown and then the mousedown (assuming those pointers don't look/feel out of place, and only it's not problematic like #1441)

edit2: tried the easy thing and it did not work:

diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp
index b079dbbc3..42459713f 100644
--- a/src/cascadia/TerminalControl/TermControl.cpp
+++ b/src/cascadia/TerminalControl/TermControl.cpp
@@ -1954,6 +1954,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
             const auto contactRect = point.Properties().ContactRect();
             _interactivity.TouchPressed({ contactRect.X, contactRect.Y });
         }
+        else if (args.KeyModifiers() == Windows::System::VirtualKeyModifiers::Control)
+        {
+            ReleaseCapture();
+            SendMessage((HWND)OwningHwnd(), WM_NCLBUTTONDOWN, HTCAPTION, 0);
+        }
         else
         {
             const auto cursorPosition = point.Position();
Originally created by @gfody on GitHub (Nov 17, 2025). ### Description of the new feature I find myself missing this subtle feature from ConsoleZ where you could ctrl+click to grab the window from anywhere instead of having to hit the (increasingly small) non-client area of the titlebar, eg: https://github.com/user-attachments/assets/77227fbe-4187-4793-ac2b-109804735ebe the feature was called "drag window" and by default ctrl+left activated it but being able to configure it as middle click no modifier seems cool too. <img width="533" height="554" alt="Image" src="https://github.com/user-attachments/assets/f1d45885-118d-4750-92d1-106ae9cbaacd" /> I propose ripping this feature off whole-hog 😁 ### Proposed technical implementation details besides plumbing the options, ~~I think the actual functionality could be as easy as copying [this old trick](https://github.com/gfody/console/blob/99d317e111267e3b18adcf287f9f70c7cb38a358/Console/MainFrame.cpp#L1862-L1863) I used in ConsoleZ, basically:~~ ~~- on mouse down, if feature enabled and conditions met - release the mouse capture - send a `WM_NCLBUTTONDOWN` w/`HTCAPTION` to the main window handle~~ (assuming uwp apps still have main window handles and message pumps 🤷) edit: it might be sylish to flip the pointer to "grab" and then "grabbing" on the modifier keydown and then the mousedown (assuming those pointers don't look/feel out of place, and only it's not problematic like #1441) edit2: tried the easy thing and it did not work: ```diff diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index b079dbbc3..42459713f 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -1954,6 +1954,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation const auto contactRect = point.Properties().ContactRect(); _interactivity.TouchPressed({ contactRect.X, contactRect.Y }); } + else if (args.KeyModifiers() == Windows::System::VirtualKeyModifiers::Control) + { + ReleaseCapture(); + SendMessage((HWND)OwningHwnd(), WM_NCLBUTTONDOWN, HTCAPTION, 0); + } else { const auto cursorPosition = point.Position(); ```
claunia added the Issue-FeatureProduct-TerminalArea-Extensibility labels 2026-01-31 08:53:02 +00:00
Author
Owner

@carlos-zamora commented on GitHub (Nov 19, 2025):

Thanks for filing! This sounds like a pretty cool feature. It's admittedly a little weird that this deviates from the standard behavior of dragging windows, but that's not the end of the world. We're going to keep this open and tagged as a possible extension, but we realistically won't be able to work on this in the near future.

@carlos-zamora commented on GitHub (Nov 19, 2025): Thanks for filing! This sounds like a pretty cool feature. It's admittedly a little weird that this deviates from the standard behavior of dragging windows, but that's not the end of the world. We're going to keep this open and tagged as a possible extension, but we realistically won't be able to work on this in the near future.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#23804