perf(ags overview): move window check to improve perf
This commit is contained in:
parent
8ea47d4932
commit
a24736ea1c
2 changed files with 13 additions and 7 deletions
|
@ -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)
|
||||
|
|
|
@ -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: [
|
||||
|
|
Loading…
Reference in a new issue