Skip to content

Commit

Permalink
Focus app with many windows in overview
Browse files Browse the repository at this point in the history
  • Loading branch information
fthx authored Mar 30, 2024
1 parent a1a13e5 commit 41a7321
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,20 +267,25 @@ export default class DockFromDashExtension {
}
break;
default:
let app_has_focus = false;
let app_focused_window_index = 0;
for (var index = 0; index < app_windows.length; index++) {
if (app_windows[index].has_focus()) {
app_has_focus = true;
app_focused_window_index = index;
if (Main.overview.visible) {
this.app.activate();
Main.overview.hide();
} else {
let app_has_focus = false;
let app_focused_window_index = 0;
for (var index = 0; index < app_windows.length; index++) {
if (app_windows[index].has_focus()) {
app_has_focus = true;
app_focused_window_index = index;
}
}
}

if (app_has_focus) {
let next_index = (app_focused_window_index + 1) % app_windows.length;
this.app.activate_window(app_windows[next_index], global.get_current_time());
} else {
this.app.activate();
if (app_has_focus) {
let next_index = (app_focused_window_index + 1) % app_windows.length;
this.app.activate_window(app_windows[next_index], global.get_current_time());
} else {
this.app.activate();
}
}
}
}
Expand Down

0 comments on commit 41a7321

Please sign in to comment.