From 647ea742c11120f262fd11bbf9b826b9e8d0ba01 Mon Sep 17 00:00:00 2001 From: Oliver Blanthorn Date: Wed, 11 Apr 2018 18:19:29 +0100 Subject: [PATCH] Add `fullscreen` command Hold `.` after running for extra fun. --- package-lock.json | 2 +- src/excmds.ts | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 89fa08bc..180c3c6f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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": { diff --git a/src/excmds.ts b/src/excmds.ts index ba82447d..2a6c380c 100644 --- a/src/excmds.ts +++ b/src/excmds.ts @@ -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.