diff --git a/config/ags/js/overview/clients.js b/config/ags/js/overview/clients.js index cc0a2beb..576a5187 100644 --- a/config/ags/js/overview/clients.js +++ b/config/ags/js/overview/clients.js @@ -70,9 +70,6 @@ const Client = (client, active, clients) => Revealer({ }); export function updateClients(box) { - if (!App.getWindow('overview').visible) - return; - execAsync('hyprctl clients -j').then( result => { let clients = JSON.parse(result).filter(client => client.class) diff --git a/config/ags/js/overview/main.js b/config/ags/js/overview/main.js index 91bc2daa..4c5dd388 100644 --- a/config/ags/js/overview/main.js +++ b/config/ags/js/overview/main.js @@ -1,10 +1,15 @@ -import { Hyprland, Widget } from '../../imports.js'; +import { App, Hyprland, Widget } from '../../imports.js'; const { Box } = Widget; import { PopupWindow } from '../misc/popup.js'; import { WorkspaceRow, getWorkspaces, updateWorkspaces } from './workspaces.js'; import { updateClients } from './clients.js'; +function update(box) { + box._getWorkspaces(box); + box._updateWorkspaces(box); + box._updateClients(box); +} export default PopupWindow({ name: 'overview', @@ -27,11 +32,15 @@ export default PopupWindow({ ], }), ], + // The timeout is because the list of clients is async + setup: box => setTimeout(() => update(box), 100), connections: [ [Hyprland, box => { - box._getWorkspaces(box); - box._updateWorkspaces(box); - box._updateClients(box); + if (!App.getWindow('overview').visible) + return; + + print('running overview'); + update(box); }], ], properties: [