fix overview drag n drop update

This commit is contained in:
end-4 2024-01-25 19:51:57 +07:00
parent b696e51fb2
commit f52bf51d6b

View file

@ -1,6 +1,7 @@
const { Gdk, Gtk } = imports.gi;
import { SCREEN_HEIGHT, SCREEN_WIDTH } from '../../imports.js';
import App from 'resource:///com/github/Aylur/ags/app.js';
import Variable from 'resource:///com/github/Aylur/ags/variable.js';
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
import * as Utils from 'resource:///com/github/Aylur/ags/utils.js';
@ -14,6 +15,8 @@ const OVERVIEW_WS_NUM_SCALE = 0.09;
const OVERVIEW_WS_NUM_MARGIN_SCALE = 0.07;
const TARGET = [Gtk.TargetEntry.new('text/plain', Gtk.TargetFlags.SAME_APP, 0)];
const overviewTick = Variable(false);
function truncateTitle(str) {
let lastDash = -1;
let found = -1; // 0: em dash, 1: en dash, 2: minus, 3: vertical bar, 4: middle dot
@ -213,6 +216,7 @@ const workspace = index => {
eventbox.drag_dest_set(Gtk.DestDefaults.ALL, TARGET, Gdk.DragAction.COPY);
eventbox.connect('drag-data-received', (_w, _c, _x, _y, data) => {
Hyprland.sendMessage(`dispatch movetoworkspacesilent ${index},address:${data.get_text()}`)
overviewTick.setValue(!overviewTick.value);
});
},
child: fixed,
@ -276,6 +280,7 @@ const OverviewRow = ({ startWorkspace, workspaces, windowName = 'overview' }) =>
}
},
setup: (box) => box
.hook(overviewTick, (box) => box.attribute.update(box))
// .hook(Hyprland, (box, name, data) => { // idk, does this make it lag occasionally?
// console.log(name)
// if (["changefloatingmode", "movewindow"].includes(name))