Starting chrome browser in full screen mode

Hi all, Has anyone been able to accomplish this?
I know I can simply hit the 3 dot menu and click on the full screen option but we would prefer to have the browser come up in full screen automatically.

Anyone know which file and what setting I would need to change?

Thanks

Hey Stephane,

1 Like

Thanks for the link, unfortunately, none of the proposed solutions seems to work.
all say to modify the autostart file but it doesn’t exist where it is supposed to and sudo will not allow me to create the file

Hey Stephane,

as root@onefinity, you can create any file anywhere (except when the partition is mounted read-only, as e.g. /boot is, in this case you would need to remount it read-write before you can write). You become root with

sudo -i

I am no chromium user but as it is based on chrome, the most-used browser in the world, I allowed myself to just provide you with a metasearch link – I assumed that thousands have already got the answer. Did you go to the chromium docs home page and to the ‘chromium-discuss’ group and searched there?

Hey Stephane,

–start-fullscreen ⊗ Specifies if the browser should start in fullscreen mode, like if the user had pressed F11 right after startup. :arrow_right_hook:

– Source: List of Chromium Command Line Switches

Could you login into the controller, become root with ‘sudo -i’, then do ‘killall chromium-browser’, and then edit (e.g. with nano) the file /etc/chromium-browser/default and modify or patch it this way:

default.diff

--- default.old 2016-08-30 15:33:20.000000000 +0200
+++ default     2023-11-25 06:13:48.000000000 +0100
@@ -2,4 +2,4 @@
 # /usr/bin/chromium-browser
 
 # Options to pass to chromium-browser
-CHROMIUM_FLAGS=""
+CHROMIUM_FLAGS="--start-fullscreen"

(=replace the red line by the green line, this is unified diff format. The leading plus and minus signs MUST NOT be entered, they are part of the unified diff format and also allow the correct Syntax highlighting in Markdown (how nice that looks :slight_smile:)

Hi Aiph5u,
Tried this but unfortunately, no go.
The browser still comes up normal.

I think @OnefinityCNC would need to let us know exactly what needs to be done in this case.

Thanks for trying.

Hey Stephane,

I find this important and I also had the idea already. There is not reason to waste space on the display, especially when the content is a web page and has to be scrolled anyway.

By the way, have you tried to rotate the display by 90° in order to use the monitor in portrait orientation instead of landscape orientation, as the MASSO G3 Touch does? Also pressing Ctrl-minus and Ctrl-plus at least on my remote browser can adjust the size of the web page so that the Jog pane and the positions and offsets table finally fit on the display.

But at the moment I don’t have the machine assembled and the controller runs, but only without the machine and over Ethernet, I have no monitor attached to it because of limited space problems as it is in my electronics lab. So I would only be able to test that if I managed to…

…okay here’s what I did:

Test 1: Calling ‘chromium-browser’ with ‘–start-fullscreen’ manually from command line

(as user ‘pi’)

As I don’t know the passwd for user ‘pi’, I set it to ‘raspberry’:

Log in via ssh on host onefinity.local as user ‘bbmc’ with password ‘onefinity’.

ssh bbmc@onefinity

Then as user bbmc, I do

sudo -i

Now I am root. As root I do:

passwd pi

and set a new password for user ‘pi’. Then I exit completely from the ssh, and then I re-open it with X forwarding enabled (see   ‘man ssh’   to read the man page):

ssh -X pi@onefinity.local

Then I am user pi@onefinity. As the user who runs the chromium-browser and the X display, I kill all that:

killall startx

I check with

ps -ef --forest | less

that there is no X display process running anymore (and subsequently, no chromium-browser).

Then I do

chromium-browser --start-fullscreen http://localhost/

:white_check_mark: This works, chromium-browser starts in full-screen mode, I get this (on my remote computer):

It also displays a popup saying “Press F11 to exit fullscreen mode” for a few seconds.

Test 2: Modifying the global chromium-browser config file:

Okay, now I will edit the config file /etc/chromium-browser/default as explained above. For editing files under /etc, I need to be root. So I do:

sudo -i

Now I am root. As root I do:

cp -ai /etc/chromium-browser/default /etc/chromium-browser/default_orig 

for backing up my file, and then I edit the file (e.g. with ‘nano’) and modify the line

CHROMIUM_FLAGS=""

to this:

CHROMIUM_FLAGS="--start-fullscreen"`

(or by applying the diff file default.diff in the previous posting with ‘patch’)

Then I exit the root shell…

exit

until I am user ‘pi’ again, and (still logged in as user pi@onefinity, remotely over a ssh with X forwarding enabled), I do:

chromium-browser http://localhost/

:white_check_mark: Okay this works too. The browser starts in full-screen mode.
See screenhot above.

But why doesn’t it work on your try? Have you made a typo somewhere?

Note that is a global variable that will affect all instances of chromium-browser, with no respect to the user that calls it. That may not be desirable, so now test no. 3:

Test 3: Modifying the bootup autostart call of chromium-browser for user ‘pi’:

Next thing I will do is to change the call where chromium is started as user ‘pi’. The X display is auto-started after boot with ‘startx’ as user ‘pi’ from the global file /etc/rc.local.

Then the browser is auto-started as user ‘pi’ from /home/pi/.xinitrc:

hostinfo.sh &

ratpoison &

xset -dpms
xset s off
xset s noblank

while true; do
    tvservice -s 2>&1 | grep "state 0x40001" >/dev/null
    if [ $? -ne 0 ]; then
        # Clear browser errors
        PREFS='/home/pi/.config/chromium/Default/Preferences'
        sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' $PREFS
        sed -i 's/"exit_type":"Crashed"/"exit_type":"Normal"/' $PREFS

        xrdb /home/pi/.Xresources

        # Start browser
        /usr/local/bin/browser --no-first-run --disable-infobars \
         --noerrdialogs --disable-3d-apis http://localhost/
    fi

    sleep 1
done

So you could add your ‘–start-fullscreen’ option to the ‘/usr/local/bin/browser’ call in /home/pi/.xinitrc.

Backing up the original file…

cp -ai .xinitrc .xinitrc_orig 

Applying the patch (or manually adding the ‘–start-fullscreen’ option, e.g. with the command ‘nano .xinitrc’ ):

.xinitrc.diff

--- .xinitrc_orig       2021-05-24 19:24:48.139999053 +0200
+++ .xinitrc    2023-11-26 02:29:35.549773119 +0100
@@ -18,7 +18,7 @@
 
         # Start browser
         /usr/local/bin/browser --no-first-run --disable-infobars \
-         --noerrdialogs --disable-3d-apis http://localhost/
+         --noerrdialogs --disable-3d-apis --start-fullscreen http://localhost/
     fi
 
     sleep 1

This solution will start the chromium-browser in fullscreen mode on bootup for user ‘pi’ (that is the user that runs the Onefinity CNC User Interface in a monitor directly connected to the Onefinity Controller, in a chromium web browser). This will not affect the User Interface if it is opened in the web browser of a remote computer.

:ballot_box_with_check: :question: As I don’t have a monitor on my controller, I cannot test it. Maybe someone else could test this. I can still change from an X-less runlevel back to a X runlevel to restart the X display client (which will subsequently autostart the chromium-browser), but I cannot see whether or not the chromium-browser started in fullscreen mode or not.

:white_check_mark: EDIT: Confirmed that it works by @stleroux and @SurfinGump (see below)

1 Like

Hi Aiph5u,

WOW. That’s what is called attention to details.
Thanks so much for doing this and being so thorough.
My wife will be extremely happy. :slight_smile:

For others that also want to do this, all I had to do at the end is this:

  • login with ssh bbmc@onefinity
  • copied the .xinitrc file using : cp -ai /home/pi/.xinitrc /home/pi/.xinitrc_orig
  • ran sudo nano /home/pi/.xinitrc
  • added the --start-fullscreen flag (as indicated above)
    And voila.
    Along with presetting the zoom on the browser to 125% prior to making the changes, we now have exactly the outcome we wanted.

Again, thank you so much.
It is always nice to know you can get great support from the community.

1 Like

Confirming this worked for me (v1.0.9) and thanks to both @Aiph5u and @stleroux for their work!

Hey Stephane, hey Forrest,

glad that I could help. As said above, this was on my list too :slight_smile:

Just glad the info was useful for someone else.