10

I've installed Raspian Jessie Lite and added on the minimum I can to get a browser running fullscreen. I started off with IceWeasel:

sudo apt-get install -y x-window-system iceweasel

And put this into my .xinitrc:

iceweasel "http://localhost/"

Now, when I run startx it loads IceWeasel. However, it only took up a small; portion of the screen. I was able to fix that by loading IceWeasel, closing it, then modifying the file that stored the window size and make it 1920x1080.

That was all fine, until I discovered IceWeasel didn't support all th nice new ECAMScript goodness Chrome did. So, I'm trying to swap for Chromium. I've managed to get it all installed, and I've changed my .xinitrc to this:

chromium-browser --start-maximized --kiosk http://localhost/

However, when this launches it only uses about (possibly exactly) half of the screen! I've tried various options but can't get it working. --start-fullscreen is even weirder and renders correctly but gets chopped in half! :(

Note: I'm trying to avoid installing any window manager/etc, as it seems like it shouldn't be required when IceWeasel is already all working correctly!?

IceWeasel:

Iceweasel fullscreen

Chromium (--start-maximized and --kiosk):

Chromium not-quite fullscreen!

Chromium (--start-fullscreen):

Chromium chopped in half

7 Answers 7

12

Ok, with help from this thread I got it working. Although that poster said it didn't work, I edited .config/chromium/Default/Preferences and explicitly set the window size:

Before

"window_placement":
{
    "bottom":1060,
    "docked":false,
    "left":10,
    "maximized":true,
    "right":950,
    "top":10
    // ...

After

"window_placement":
{
    "bottom":1080,
    "docked":false,
    "left":0,
    "maximized":true,
    "right":1920,
    "top":0
    // ...

I wondered if maybe this had been set badly by the first load of the app not being fullscreen, but I tried deleting ~/.config and then loading it again, but it just recreated it with the left half of the screen. I guess I'll have to script loading Chromium, killing it, then rewriting that part of the file in my setup script! ;(

2
  • 2
    Mate you are a genius! This drove me nuts for days and I had almost given up -- I thought it was an xserver issue but apparently, Chromium has an issue when started in Kiosk right away -- thanks so much! Jun 6, 2017 at 21:01
  • 1
    If your Preferences file is missing window_placement, it can be added under the browser key. Reference: chromium.googlesource.com/chromium/chromium/+/…
    – Nemo
    Mar 9, 2019 at 14:06
7

even simpler that tweaking ~/.config/chromium/Default/Preferences, just use --window-position=0,0 flag during chromium startup.

see Chromium Command Line Switches for full list of available chromium switches

1
  • This solved it for me. Here is the full combinations of switches I'm using for a raspberry pi kiosk for anyone who finds themselves in my position: chromium-browser \ --window-size=1920,1080 \ --kiosk \ --incognito \ --disable-infobars \ --noerrdialogs \ --disable-crash-report \ --start-fullscreen \ --start-maximized \ --window-position=0,0 \ --ignore-certificate-errors \ --test-type \ $(cat /boot/websites)
    – w2bro
    Jul 28, 2020 at 3:14
4

Assuming your monitor is smaller then 7000px

chromium-browser --window-size=7000,7000 --start-fullscreen

This command will detect your screen height / width

Now you also can use it in a bash script:

/home/pi/full.sh

#!/bin/bash/ 
chromium-browser --window-size=7000,7000 --start-fullscreen

and then run

startx /home/pi/full.sh

It will launch a fullscreen browser, from a non-gui terminal :D.

NOT NEEDED,

but for fun I tested a bash code to get the screen resolution, but you don't need it..

#!/bin/bash
CMD="$(fbset -s | awk '$1 == "geometry" { print $2" "$3 }')"
echo "$CMD"
2
  • doesn't work for me
    – LtWorf
    Oct 13, 2017 at 10:50
  • --window-size=7000,7000 sort of worked. Oct 29, 2017 at 17:02
1

If you want to start Chromium in fullscreen then try adding this to /etc/xdg/lxsession/LXDE/autostart

@chromium-browser -e Fullscreen -a http://google.com
1

I had the exact same symptoms, 10px offset top and left and only half the screen filled. I had trouble with the window_placement property not being there. Hardcoding the resolution wasn't an option for me since I want to support a wide range of monitors so I wrote this script that adds the window_placement property to the preferences file before starting the Chrome kiosk. It uses jq to manipulate the JSON file and xdpyinfo to grab the resolution, so before you can use it run:

sudo apt install jq

kiosk.sh

#!/bin/bash

CHROMIUM_FILE=~/.config/chromium/Default/Preferences
RESOLUTION=$(xdpyinfo | grep -Po "(?<=dimensions:)\s*([0-9]{1,}x[0-9]{1,})" | sed "s: ::g")
SCREEN_WIDTH=$(echo $RESOLUTION | cut -d'x' -f1)
SCREEN_HEIGHT=$(echo $RESOLUTION | cut -d'x' -f2)
printf -v WINDOW_PLACEMENT '.browser.window_placement |= {bottom: %s, right: %s, top: 0, left: 0, maximized: true}' $SCREEN_WIDTH $$

jq "$WINDOW_PLACEMENT" $CHROMIUM_FILE > tmp.json && mv tmp.json $CHROMIUM_FILE

chromium-browser --window-size=$SCREEN_WIDTH,$SCREEN_HEIGHT --start-maximized --no-default-browser-check --kiosk https://google.com

Interestingly, just writing the resolution into the JSON file wasn't enough. It fixed the 10px offset and made the window a little bit bigger but didn't fill the screen. Using the --window-size flag fixed that for me.

1

After trying several of the answers given, the most robust solution seems to be to detect screen resolution and then set --window-size=$WIDTH,$HEIGHT, and add --window-position=0,0 to position the window in the left top corner.

Here is a sample .xinitrc with useful options for starting is --kiosk mode:

#!/bin/bash

GEO="$(fbset -s | awk '$1 == "geometry" { print $2":"$3 }')"
WIDTH=$(echo "$GEO" | cut -d: -f1)
HEIGHT=$(echo "$GEO" | cut -d: -f2)

echo "Resolution: $WIDTH x $HEIGHT"

xset -dpms
xset s off
xset s noblank

unclutter &

chromium-browser --window-position=0,0 --window-size=$WIDTH,$HEIGHT  --app="https://google.com/" --start-maximized --no-default-browser-check --start-fullscreen --kiosk --noerrdialogs --disable-translate --fast --fast-start --disable-features=TranslateUI --disk-cache-dir=/dev/null  --password-store=basic

A full list of startup flags can be found here: https://codefodder.github.io/chrome-chromium-startup-flags/

0

You can try

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

as listed by Peter Beverloo's automatic web page of options.

5
  • 1
    Well, that one's even weirder... the window now takes up the full screen, yet the right half is black! I've edited a screenshot into my original question :( Apr 3, 2016 at 12:16
  • That is weird! Does the cursor manage to travel over the black half?
    – meuh
    Apr 3, 2016 at 12:22
  • 1
    Yeah, the cursor can go around the whole screen; just only the left half of Chromium is rendered. It's very weird; the rendered part is the same portion that --start-maximized set the window too. It's like some things are reading the screen size as half of what it actually is, and some is getting it correct (but why there would be two different ways for Chrome to figure out the screen size, I dunno!) Apr 3, 2016 at 13:09
  • Got it sorted; see my answer. I can't explain why it happens (it also added a 10px border!), but I have a solution to it at least. Thanks! Apr 3, 2016 at 13:29
  • 1
    doesn't work for me
    – LtWorf
    Oct 13, 2017 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.