diff --git a/config/ags/js/overview/dragndrop.js b/config/ags/js/overview/dragndrop.js index 0060535..9abd9ed 100644 --- a/config/ags/js/overview/dragndrop.js +++ b/config/ags/js/overview/dragndrop.js @@ -25,20 +25,24 @@ function createSurfaceFromWidget(widget) { return surface; }; -export const WorkspaceDrop = ({id, name, ...params} = {}) => EventBox({ +let hidden = 0; +export const WorkspaceDrop = params => EventBox({ ...params, //tooltipText: `Workspace: ${id}`, - setup: eventbox => { - if (id < 0) - id = name; + connections: [['drag-data-received', (eventbox, _w, _c, _x, data) => { + let id = eventbox.get_parent()._id; + if (id < -1) + id = eventbox.get_parent()._name; + else if (id === -1) + id = `special:${++hidden}`; else if (id === 1000) id = "empty"; + execAsync(`hyprctl dispatch movetoworkspacesilent ${id},address:${data.get_text()}`) + .catch(print); + }]], + setup: eventbox => { eventbox.drag_dest_set(Gtk.DestDefaults.ALL, TARGET, Gdk.DragAction.COPY); - eventbox.connect('drag-data-received', (_w, _c, _x, _y, data) => { - execAsync(`hyprctl dispatch movetoworkspacesilent ${id},address:${data.get_text()}`) - .catch(print); - }); }, }); diff --git a/config/ags/js/overview/workspaces.js b/config/ags/js/overview/workspaces.js index d4fbc6f..00cb57c 100644 --- a/config/ags/js/overview/workspaces.js +++ b/config/ags/js/overview/workspaces.js @@ -42,8 +42,6 @@ export const WorkspaceRow = (className, i) => Revealer({ ['name', className === 'special' ? 'special' : ''], ], child: WorkspaceDrop({ - id: className === 'special' ? -1 : 1000, - name: className === 'special' ? 'special' : '', child: Box({ className: 'workspace', style: `min-width: ${VARS.SCREEN.X * VARS.SCALE}px; @@ -78,8 +76,6 @@ const Workspace = (id, name) => Revealer({ box.revealChild = Hyprland.getWorkspace(box._id)?.windows > 0 || active; }]], child: WorkspaceDrop({ - id: id, - name: name, child: Box({ className: 'workspace', style: `min-width: ${VARS.SCREEN.X * VARS.SCALE}px;