mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 17:42:27 +01:00
Allow :q! and :qa!, as in vim.
This commit is contained in:
@@ -362,12 +362,12 @@ const liberator = (function () //{{{
|
||||
|
||||
liberator.commands.add(["q[uit]"],
|
||||
liberator.has("tabs") ? "Quit current tab" : "Quit application",
|
||||
function ()
|
||||
function (args, special)
|
||||
{
|
||||
if (liberator.has("tabs"))
|
||||
liberator.tabs.remove(getBrowser().mCurrentTab, 1, false, 1);
|
||||
else
|
||||
liberator.quit(false);
|
||||
liberator.quit(false, special);
|
||||
},
|
||||
{ argCount: "0" });
|
||||
|
||||
@@ -963,14 +963,20 @@ const liberator = (function () //{{{
|
||||
plugins: {},
|
||||
|
||||
// quit liberator, no matter how many tabs/windows are open
|
||||
quit: function (saveSession)
|
||||
quit: function (saveSession, force)
|
||||
{
|
||||
if (saveSession)
|
||||
liberator.options.setPref("browser.startup.page", 3); // start with saved session
|
||||
else
|
||||
liberator.options.setPref("browser.startup.page", 1); // start with default homepage session
|
||||
|
||||
goQuitApplication();
|
||||
const nsIAppStartup = Components.interfaces.nsIAppStartup;
|
||||
if (force)
|
||||
Components.classes["@mozilla.org/toolkit/app-startup;1"]
|
||||
.getService(nsIAppStartup)
|
||||
.quit(nsIAppStartup.eForceQuit);
|
||||
else
|
||||
goQuitApplication();
|
||||
},
|
||||
|
||||
restart: function ()
|
||||
|
||||
@@ -471,9 +471,9 @@ liberator.Tabs = function () //{{{
|
||||
|
||||
liberator.commands.add(["quita[ll]", "qa[ll]"],
|
||||
"Quit " + liberator.config.name,
|
||||
function ()
|
||||
function (args, special)
|
||||
{
|
||||
liberator.quit(false);
|
||||
liberator.quit(false, special);
|
||||
},
|
||||
{ argCount: "0" });
|
||||
|
||||
@@ -743,11 +743,8 @@ liberator.Tabs = function () //{{{
|
||||
// quitOnLastTab = 2: quit and save session
|
||||
remove: function (tab, count, focusLeftTab, quitOnLastTab)
|
||||
{
|
||||
var removeOrBlankTab = (function ()
|
||||
{
|
||||
if (liberator.config.hostApplication == "Firefox")
|
||||
{
|
||||
return function (tab)
|
||||
var removeOrBlankTab = {
|
||||
Firefox: function (tab)
|
||||
{
|
||||
if (getBrowser().mTabs.length > 1)
|
||||
getBrowser().removeTab(tab);
|
||||
@@ -762,20 +759,15 @@ liberator.Tabs = function () //{{{
|
||||
else
|
||||
liberator.beep();
|
||||
}
|
||||
};
|
||||
}
|
||||
else if (liberator.config.hostApplication == "Thunderbird")
|
||||
{
|
||||
return function (tab)
|
||||
},
|
||||
Thunderbird: function (tab)
|
||||
{
|
||||
if (getBrowser().mTabs.length > 1)
|
||||
getBrowser().removeTab(tab);
|
||||
else
|
||||
liberator.beep();
|
||||
};
|
||||
}
|
||||
return function () { return null; };
|
||||
})();
|
||||
}
|
||||
}[liberator.config.hostApplication] || function () {};
|
||||
|
||||
if (typeof count != "number" || count < 1)
|
||||
count = 1;
|
||||
|
||||
Reference in New Issue
Block a user