Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion background_scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,16 @@ const BackgroundCommands = {
// In Firefox, Ctrl-W will not close a pinned tab, but on Chrome, it will. We try to be
// consistent with each browser's UX for pinned tabs.
if (tab.pinned && BgUtils.isFirefox()) return;
chrome.tabs.remove(tab.id);
if(Settings.get("keepLastTabOpen")){
chrome.tabs.query({ currentWindow: true }, function (tabs) {
if(tabs.length == 1){
chrome.tabs.create({ url: Settings.get("newTabUrl") });
}
chrome.tabs.remove(tab.id);
});
} else {
chrome.tabs.remove(tab.id);
}
});
},
restoreTab: mkRepeatCommand((request, callback) =>
Expand Down
1 change: 1 addition & 0 deletions lib/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ w: https://www.wikipedia.org/w/index.php?title=Special:Search&search=%s Wikipedi
waitForEnterForFilteredHints: true,
helpDialog_showAdvancedCommands: false,
ignoreKeyboardLayout: false,
keepLastTabOpen: false,
};

/*
Expand Down
14 changes: 14 additions & 0 deletions pages/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,20 @@
</label>
</td>
</tr>
<tr>
<td class="caption"></td>
<td verticalAlign="top" class="booleanOption">
<div class="help">
<div class="example">
Do not close the last tab
</div>
</div>
<label>
<input id="keepLastTabOpen" type="checkbox" />
Do not close the last tab
</label>
</td>
</tr>
<tr>
<td class="caption">Default search<br />engine</td>
<td verticalAlign="top">
Expand Down
1 change: 1 addition & 0 deletions pages/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const options = {
searchUrl: "string",
settingsVersion: "string", // This is a hidden field.
userDefinedLinkHintCss: "string",
keepLastTabOpen: "boolean",
};

const OptionsPage = {
Expand Down