Skip to content

Commit d376013

Browse files
committed
Update .phoenix.js to filter some more unwanted windows
1 parent 5557946 commit d376013

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

.phoenix.js

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const IGNORE_APPS = [
1212
new RegExp('^1Password'),
1313
new RegExp('^System Settings'),
1414
new RegExp('^Activity Monitor'),
15+
new RegExp('^Remote Desktop'),
1516
];
1617
const IGNORE_WINDOWS = [
1718
// ignore windows that have no title
@@ -34,6 +35,14 @@ class WindowContainer {
3435
}
3536
}
3637

38+
reload() {
39+
for (const window of this.stack) {
40+
if (SpaceManager.isWindowIgnored(window))
41+
this.stack = this.stack.filter(instance => instance.hash() !== window.hash());
42+
}
43+
this.render();
44+
}
45+
3746
has(window) {
3847
if (!window)
3948
false;
@@ -144,6 +153,12 @@ class ContainerManager {
144153
}
145154
}
146155

156+
reload() {
157+
for (const [name, container] of this.containers) {
158+
container.reload();
159+
}
160+
}
161+
147162
setupContainer(screen, name, containerCallback) {
148163
const screenFrame = screen.flippedVisibleFrame();
149164
const frame = containerCallback(screen, screenFrame);
@@ -184,6 +199,8 @@ class ContainerManager {
184199
swapFocused(targetContainerName, render) {
185200
render = render === undefined || render;
186201
const window = Window.focused();
202+
if (SpaceManager.isWindowIgnored(window))
203+
return;
187204
const targetContainer = this.containers.get(targetContainerName);
188205
if (!targetContainer)
189206
return;
@@ -232,7 +249,17 @@ class SpaceManager {
232249
}
233250
}
234251

252+
static reload() {
253+
for (const [key, spaceManager] of SpaceManager.spaceManagers) {
254+
spaceManager.containerManager.reload();
255+
}
256+
}
257+
235258
static isWindowIgnored(window) {
259+
if (!window || `${window.app().name()}` === '' || `${window.title()}` === '') {
260+
log(`ignoring empty app or window title [${window.app().name()}][${window.title()}]`);
261+
return true;
262+
}
236263
if (window.size().width === 0 && window.size().height === 0) {
237264
log(`ignoring size 0 [${window.app().name()}][${window.title()}]`);
238265
return true;
@@ -444,7 +471,7 @@ Key.on('l', mash, () => Window.focused().focusClosestNeighbour('east'));
444471
Key.on('d', mash, () => SpaceManager.debug());
445472
// Phoenix keys
446473
// mash + r => reload
447-
Key.on('r', mash, () => Phoenix.reload())
474+
Key.on('r', mash, () => SpaceManager.reload())
448475

449476
// Event.on('screensDidChange', () => Phoenix.reload());
450477

0 commit comments

Comments
 (0)