Skip to content

Commit 0e16abb

Browse files
authored
Merge pull request #17 from epilande/epilande/fix-safari-focus
Fix Safari window focus
2 parents 842aef7 + 0f3f2bd commit 0e16abb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/focus-tab-webkit.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ function run(args) {
44
let safari = Application("Safari");
55
let query = args[0];
66
let [windowIndex, url] = query.split(",");
7+
let window = safari.windows[windowIndex]();
78

89
function getTab() {
910
let result;
10-
let window = safari.windows[windowIndex];
1111
if (window) {
1212
for (let index in window.tabs) {
1313
let tab = window.tabs[index];
@@ -23,5 +23,8 @@ function run(args) {
2323

2424
let tab = getTab();
2525
safari.activate();
26-
safari.windows[windowIndex].currentTab = tab;
26+
window.currentTab = tab;
27+
// Force tab window to front
28+
window.visible = false;
29+
window.visible = true;
2730
}

0 commit comments

Comments
 (0)