I save the following AppleScript as application, to open Firefox in full screen and without the menu bar:
tell application "Firefox" to activate
delay 0.8
do shell script "lsappinfo setinfo -app Firefox ApplicationType=UIElement"
tell application "System Events" to tell process "Firefox" to set value of attribute "AXFullScreen" of last window to true
And execute it as:
open -a "Firefox Full Screen"
This works as expected, Firefox is opened, goes full screen, without the menu bar. The problem is when I try to call open with a URL:
open -a "Firefox Full Screen" "https://google.com"
This still opens Firefox, with the given URL in a new tab, but it doesn't execute the lines after delay 0.8
, so it doesn't open in full screen. I don't understand why this happens and how to fix it.
I know those lines are not executed because the system doesn't warn that I need to add the application as an accessibility exception (when I don't have one added/enabled). It always warns if I don't pass the URL (and don't have an exception added/enabled).
EDIT 1
I also tried to execute the following version with open -a "Firefox Full Screen"
, open -a "Firefox Full Screen" "https://google.com"
, open -a "Firefox Full Screen" --args "https://google.com"
and it's worse given that it doesn't execute the last lines in any case:
on run argv
tell application "Firefox"
activate
repeat with arg in argv
open location (arg as text)
end repeat
end tell
delay 0.8
do shell script "lsappinfo setinfo -app Firefox ApplicationType=UIElement"
tell application "System Events" to tell process "Firefox" to set value of attribute "AXFullScreen" of last window to true
end run
EDIT 2
It seems the problem is related with https://stackoverflow.com/questions/14419700.
Best Answer
It looks like passing arguments to an AppleScript saved as an application has become broken at some point. I accomplished my task by using Automator to create an equivalent new Application that makes use of an
Action > Utilities > Run Shell Script
:I set the shell script
Shell:
to/bin/sh
andPass input:
toas arguments
, save it as "Firefox Full Screen" in/Applications
, change its icon as explained here and add it as an exception inSystem Preferences > Security & Privacy > Privacy Tab > Accessibility
.I then can run any of the following and it works as expected:
open -a "Firefox Full Screen"
open -a "Firefox Full Screen" --args "https://google.com"
open -a "Firefox Full Screen" --args "https://google.com" "https://twitter.com"
I'm using this coupled with the following
userChrome.css
to both evade a well known issue with the macOS menu bar on full screen applications and another long standing address bar and tab auto-hide bug that Firefox have with macOS native full screen.userChrome.css
For a generic approach, check my other answer.
TIP
userChrome.css
from my ArchLinux setup. I use it on i3 and sway tiling window managers, with all the[inFullscreen]
removed, to get address bar and tabs to auto-hide in normal bordless windows.