[gnome-shell-extensions/wip/rstrode/heads-up-display: 35/62] window-list: Turn workspace thumbs into drop targets
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions/wip/rstrode/heads-up-display: 35/62] window-list: Turn workspace thumbs into drop targets
- Date: Thu, 26 Aug 2021 19:31:31 +0000 (UTC)
commit 7e07fecb603b722c837f1ca9feae4ea0c3c0fe46
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Jun 11 23:01:20 2019 +0000
window-list: Turn workspace thumbs into drop targets
It makes some sense to allow using the workspace indicator for moving
windows between workspaces as well as for workspace switching. This
applies particularly in GNOME classic after we disabled the overview
there, so that there is again a non-shortcut way of moving windows
between workspaces.
https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/74
extensions/window-list/workspaceIndicator.js | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
---
diff --git a/extensions/window-list/workspaceIndicator.js b/extensions/window-list/workspaceIndicator.js
index 01b41a9..b8b0f81 100644
--- a/extensions/window-list/workspaceIndicator.js
+++ b/extensions/window-list/workspaceIndicator.js
@@ -1,6 +1,8 @@
/* exported WorkspaceIndicator */
const { Clutter, Gio, GObject, Meta, St } = imports.gi;
+const DND = imports.ui.dnd;
+const Main = imports.ui.main;
const PanelMenu = imports.ui.panelMenu;
const PopupMenu = imports.ui.popupMenu;
@@ -16,6 +18,31 @@ let WorkspaceThumbnail = GObject.registerClass({
});
this._index = index;
+ this._delegate = this; // needed for DND
+ }
+
+ acceptDrop(source) {
+ if (!source.realWindow)
+ return false;
+
+ let window = source.realWindow.get_meta_window();
+ this._moveWindow(window);
+ return true;
+ }
+
+ handleDragOver(source) {
+ if (source.realWindow)
+ return DND.DragMotionResult.MOVE_DROP;
+ else
+ return DND.DragMotionResult.CONTINUE;
+ }
+
+
+ _moveWindow(window) {
+ let monitorIndex = Main.layoutManager.findIndexForActor(this);
+ if (monitorIndex != window.get_monitor())
+ window.move_to_monitor(monitorIndex);
+ window.change_workspace_by_index(this._index, false);
}
// eslint-disable-next-line camelcase
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]