Add container support for winopen

This commit is contained in:
fluem 2021-02-04 15:09:29 +01:00
parent b1cc20cc4a
commit d9ac0cf2c5
2 changed files with 13 additions and 3 deletions

View file

@ -2291,6 +2291,7 @@ export async function tabopen(...addressarr: string[]): Promise<browser.tabs.Tab
args.shift()
argParse(args)
} else if (args[0] === "-c") {
if (args.length < 2) throw new Error(`You must provide a container name!`)
// Ignore the -c flag if incognito as containers are disabled.
if (!win.incognito) {
if (args[1] === "firefox-default" || args[1].toLowerCase() === "none") {
@ -2729,6 +2730,8 @@ export async function mute(...muteArgs: string[]): Promise<void> {
*
* `winopen -popup [...]` will open it in a popup window. You can combine the two for a private popup.
*
* `winopen -c containername [...]` will open the result in a container while ignoring other options given. See [[tabopen]] for more details on containers.
*
* Example: `winopen -popup -private ddg.gg`
*/
//#background
@ -2740,15 +2743,20 @@ export async function winopen(...args: string[]) {
switch (args[0]) {
case "-private":
createData.incognito = true
args = args.slice(1, args.length)
args.shift()
firefoxArgs = "--private-window"
break
case "-popup":
createData.type = "popup"
args = args.slice(1, args.length)
args.shift()
break
case "-c":
if (args.length < 2) throw new Error(`You must provide a container name!`)
args.shift()
return composite(`tabopen -c ${args.join(" ")} | sleep 100 | tabdetach`)
default:
done = true
break

View file

@ -9,8 +9,10 @@ The perceived benefits of this feature are as described by the Firefox Test Pilo
### Container related commands
* `containercreate name [color] [icon]` Creates a new container. Supplying `name` only will create a container called `name`, a random color and the fingerprint icon.
* `containerupdate name newname color icon` Updates the container.
* `containerupdate name newname color icon` Updates the container.
* `containerclose name` Closes all tabs in a specified container.
* `containerdelete name` Deletes a container, calls `containerclose` before deletion
* `tabopen -c name [url]` Opens a new tab in the container called `name`
* `winopen -c name [url]` Opens a new window in the container called `name`
The <a href='./7-native_messenger.html' rel='next'>next page</a> is about the native messenger. <a href='./5-settings.html' rel="prev"></a>