kasper / phoenix

A lightweight macOS window and app manager scriptable with JavaScript
https://kasper.github.io/phoenix/
Other
4.36k stars 129 forks source link

Is it possible to get window created time? #344

Closed gutenye closed 6 months ago

gutenye commented 6 months ago

app.windows(), Window.all(), Window.recent() all return windows in recent order. But I want to get the windows in fixed order. If there's a window created time, then I can sort the windows.

kasper commented 6 months ago

@gutenye Hey! At the moment, there is nothing in the API that would give this to you directly. You could use events for this, something like the following.

Event.on('windowDidOpen', (window) => {
  window.createdAt = new Date(); // Or save the timestamp somewhere else in the scope to retain it
});
gutenye commented 6 months ago

Thank you!