diff --git a/config/src/keyassignment.rs b/config/src/keyassignment.rs index f6628dde5..e692f07d0 100644 --- a/config/src/keyassignment.rs +++ b/config/src/keyassignment.rs @@ -193,6 +193,7 @@ pub enum KeyAssignment { OpenLinkAtMouseCursor, CompleteSelection(ClipboardCopyDestination), CompleteSelectionOrOpenLinkAtMouseCursor(ClipboardCopyDestination), + StartWindowDrag, AdjustPaneSize(PaneDirection, usize), ActivatePaneDirection(PaneDirection), @@ -532,6 +533,14 @@ impl InputMap { }, PasteFrom(ClipboardPasteSource::PrimarySelection) ], + [ + Modifiers::SUPER, + MouseEventTrigger::Drag { + streak: 1, + button: MouseButton::Left, + }, + StartWindowDrag + ], ); } diff --git a/docs/changelog.md b/docs/changelog.md index d5827148b..86b298751 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -38,6 +38,8 @@ brief notes about them may accumulate here. * Fixed: line-based mouse selection (default: triple click) now extends forwards to include wrapped lines. [#466](https://github.com/wez/wezterm/issues/466) * New: introduced [custom_block_glyphs](config/lua/config/custom_block_glyphs.md) option to ensure that block glyphs don't have gaps. [#433](https://github.com/wez/wezterm/issues/433) * Fixed: the [RIS](https://vt100.net/docs/vt510-rm/RIS) escape wasn't clearing the scrollback. [#511](https://github.com/wez/wezterm/issues/511) +* New: you can now drag the wezterm window via the tab bar +* New: holding SUPER+Drag will drag the wezterm window. This is assignable, but not yet documented. ### 20210203-095643-70a364eb diff --git a/wezterm-gui/src/termwindow/mod.rs b/wezterm-gui/src/termwindow/mod.rs index 268461c34..4acf2e238 100644 --- a/wezterm-gui/src/termwindow/mod.rs +++ b/wezterm-gui/src/termwindow/mod.rs @@ -115,6 +115,7 @@ pub struct TermWindow { scroll_drag_start: Option, split_drag_start: Option, window_drag_position: Option, + current_mouse_event: Option, prev_cursor: PrevCursorPos, last_scroll_info: RenderableDimensions, @@ -262,6 +263,7 @@ impl WindowCallbacks for TermWindow { scroll_drag_start: self.scroll_drag_start.clone(), split_drag_start: self.split_drag_start.clone(), window_drag_position: None, + current_mouse_event: None, prev_cursor: self.prev_cursor.clone(), last_scroll_info: self.last_scroll_info.clone(), clipboard_contents: Arc::clone(&clipboard_contents), @@ -477,6 +479,7 @@ impl TermWindow { scroll_drag_start: None, split_drag_start: None, window_drag_position: None, + current_mouse_event: None, prev_cursor: PrevCursorPos::new(), last_scroll_info: RenderableDimensions::default(), clipboard_contents: Arc::clone(&clipboard_contents), @@ -1251,6 +1254,9 @@ impl TermWindow { ExtendSelectionToMouseCursor(mode) => { self.extend_selection_at_mouse_cursor(*mode, pane) } + StartWindowDrag => { + self.window_drag_position = self.current_mouse_event.clone(); + } OpenLinkAtMouseCursor => { // They clicked on a link, so let's open it! // We need to ensure that we spawn the `open` call outside of the context diff --git a/wezterm-gui/src/termwindow/mouseevent.rs b/wezterm-gui/src/termwindow/mouseevent.rs index 508ac74ed..1e43192e1 100644 --- a/wezterm-gui/src/termwindow/mouseevent.rs +++ b/wezterm-gui/src/termwindow/mouseevent.rs @@ -24,6 +24,8 @@ impl super::TermWindow { None => return, }; + self.current_mouse_event.replace(event.clone()); + let config = &self.config; // Round the x coordinate so that we're a bit more forgiving of // the horizontal position when selecting cells