From f2ad30d161e6654be5f8368a6711b68907f6d079 Mon Sep 17 00:00:00 2001 From: Agha Shadi <29219050+Agha-Shadi@users.noreply.github.com> Date: Fri, 16 Feb 2024 08:45:17 +0330 Subject: [PATCH 1/2] Added the EnterFulscreen option --- src/_locales/en/messages.json | 8 ++++++++ src/core/commands.mjs | 13 +++++++++++++ src/resources/json/commands.json | 4 ++++ 3 files changed, 25 insertions(+) diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 6f24ba29e..a0d05d88d 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -493,6 +493,10 @@ "message": "New private window", "description": "New private window" }, + "commandLabelEnterFullscreen": { + "message": "Enter full screen", + "description": "Enter full screen" + }, "commandLabelMoveTabToStart": { "message": "Move tab to start", "description": "Move tab to start" @@ -846,6 +850,10 @@ "message": "Opens a new empty private window.", "description": "Opens a new empty private window." }, + "commandDescriptionEnterFullscreen": { + "message": "Activates full screen mode for the current window.", + "description": "Activates full screen mode for the current window." + }, "commandDescriptionMoveTabToStart": { "message": "Moves the current tab to the start of the tab strip.", "description": "Moves the current tab to the start of the tab strip." diff --git a/src/core/commands.mjs b/src/core/commands.mjs index bab01eab9..4adbce3e9 100644 --- a/src/core/commands.mjs +++ b/src/core/commands.mjs @@ -742,6 +742,19 @@ export async function ToggleFullscreen (sender, data) { } +// Activates full screen mode for the current window if it is not already in full screen mode +export async function EnterFullscreen (sender, data) { + const window = await browser.windows.get(sender.tab.windowId); + if (window.state !== 'fullscreen'){ + await browser.windows.update(sender.tab.windowId, { + state: 'fullscreen' + }); + // confirm success + return true; + } +} + + export async function NewWindow (sender, data) { await browser.windows.create({}); // confirm success diff --git a/src/resources/json/commands.json b/src/resources/json/commands.json index 8cea484c6..d85859be7 100644 --- a/src/resources/json/commands.json +++ b/src/resources/json/commands.json @@ -189,6 +189,10 @@ "command": "NewPrivateWindow", "group": "window" }, + { + "command": "EnterFullscreen", + "group": "window.controls" + }, { "command": "MoveTabToStart", "group": "move" From 8a06eb5a7894956aac3df4165f834b3a6f4b9157 Mon Sep 17 00:00:00 2001 From: Robin Thomas Date: Tue, 2 Apr 2024 18:43:27 +0200 Subject: [PATCH 2/2] Formatting --- src/core/commands.mjs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/commands.mjs b/src/core/commands.mjs index 4adbce3e9..7be1f8fb0 100644 --- a/src/core/commands.mjs +++ b/src/core/commands.mjs @@ -745,12 +745,12 @@ export async function ToggleFullscreen (sender, data) { // Activates full screen mode for the current window if it is not already in full screen mode export async function EnterFullscreen (sender, data) { const window = await browser.windows.get(sender.tab.windowId); - if (window.state !== 'fullscreen'){ - await browser.windows.update(sender.tab.windowId, { - state: 'fullscreen' - }); - // confirm success - return true; + if (window.state !== 'fullscreen') { + await browser.windows.update(sender.tab.windowId, { + state: 'fullscreen' + }); + // confirm success + return true; } }