Add fullscreen command

Hold `.` after running for extra fun.
This commit is contained in:
Oliver Blanthorn 2018-04-11 18:19:29 +01:00
parent 87574e0d6d
commit 647ea742c1
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3
2 changed files with 14 additions and 1 deletions

2
package-lock.json generated
View file

@ -9518,7 +9518,7 @@
}
},
"web-ext-types": {
"version": "github:kelseasy/web-ext-types#5fa885198a9d43a35dfd0afec64c5ff89338f8a0",
"version": "github:kelseasy/web-ext-types#daae1085685b97efdb98c59668cbdfd91c5c874c",
"dev": true
},
"webidl-conversions": {

View file

@ -975,6 +975,19 @@ export async function tabdetach(index?: number) {
browser.windows.create({tabId: await idFromIndex(index)})
}
/** Toggle fullscreen state
*/
//#background
export async function fullscreen() {
// Could easily extend this to fullscreen / minimise any window but seems like that would be a tiny use-case.
const currwin = await browser.windows.getCurrent()
const wid = currwin.id
// This might have odd behaviour on non-tiling window managers, but no-one uses those, right?
const state = currwin.state == "fullscreen" ? "normal" : "fullscreen"
browser.windows.update(wid,{state})
}
/** Close a tab.
Known bug: autocompletion will make it impossible to close more than one tab at once if the list of numbers looks enough like an open tab's title or URL.