Skip to content

Commit

Permalink
fix: when no window launched, didn't launch a new application
Browse files Browse the repository at this point in the history
  • Loading branch information
e3rd committed May 30, 2018
1 parent 903f4e3 commit b194872
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,15 @@ const Controller = new Lang.Class({ // based on https://superuser.com/questions/
return false;
};

if(is_conforming(global.display.get_tab_list(0, null)[0])) {
var loop;
if(global.display.get_tab_list(0, null).length === 0) {
loop = [];
} else if(is_conforming(global.display.get_tab_list(0, null)[0])) {
// current window conforms, let's focus the oldest windows of the group
var loop = global.display.get_tab_list(0, null).slice(0).reverse();
loop = global.display.get_tab_list(0, null).slice(0).reverse();
} else {
// current window doesn't conform, let's find the youngest conforming one
var loop = global.display.get_tab_list(0, null); // Xglobal.get_window_actors()
loop = global.display.get_tab_list(0, null); // Xglobal.get_window_actors()
}
for (var wm of loop) {
if(is_conforming(wm)) {
Expand All @@ -122,8 +125,8 @@ const Controller = new Lang.Class({ // based on https://superuser.com/questions/
}
}
if(seen) {
if (!wm.has_focus()) {
log('no focus, go to:' + wm.get_wm_class());
if (!seen.has_focus()) {
log('no focus, go to:' + seen.get_wm_class());
focusWindow(seen);
} else if (settings.get_boolean('switch-back-when-focused')) {
window_monitor = wm.get_monitor();
Expand Down

0 comments on commit b194872

Please sign in to comment.