fix(ags overview): make special workspace with plus sign create new workspace every time

This commit is contained in:
matt1432 2023-09-24 16:29:56 -04:00
parent 113bd1ae88
commit cb7507eedb
2 changed files with 12 additions and 12 deletions

View file

@ -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";
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);
});
}]],
setup: eventbox => {
eventbox.drag_dest_set(Gtk.DestDefaults.ALL, TARGET, Gdk.DragAction.COPY);
},
});

View file

@ -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;