How do I start epiphany browser in fullscreen mode from terminal (not F11)? Documentation says to use arguments
--fullscreen but neither of them work.
Here is how I got the default browser ephiphany working in Kiosk Mode.
First I set the
sudo raspi-config boot option to b2 "command prompt with auto login"
Create a file startB in your home directory
/home/pi/ with following content
sudo nano ./startB
#!/bin/sh xset -dpms # disable DPMS (Energy Star) features. xset s off # disable screen saver xset s noblank # don't blank the video device matchbox-window-manager -use_titlebar no & WEBKIT_DISABLE_TBS=1 epiphany-browser -a --profile /home/pi/.config http://site
now sudo nano
/etc/rc.local and put in the following line before exit 0
sudo xinit ./home/pi/startB &
and Raspberry Pi will boot up in kiosk mode with browser.
I got it working with xautomation. I didn't have any success with "-a".
The script I'm using is:
xte 'sleep 10' 'key F11'& epiphany-browser test.html
This code sends an F11 keystroke 10 seconds after starting the browser.
That was after I installed xautomation, which provides the xte command:
root@nexus:/home/pi/bin# aptitude install xautomation
I got success after tried this.
Save this shell script to:
sudo -u pi epiphany-browser -a --profile ~/.config http://127.0.0.1/index.html --display=:0 & sleep 15s; xte "key F11" -x:0
& is important. This mark is ignoring errors from the epiphany-browser.
& mark because I got an error after I tried this shell script on the command line.
sudo apt-get install epiphany-browser sudo apt-get install xautomation sudo vi /etc/xdg/lxsession/LXDE/autostart @/home/pi/fullscreen.sh sudo chmod 755 /home/pi/fullscreen.sh
(sorry my english is poor because I am japanese.)
-a flag doesn't result in fullscreen for me, and as
F11 toggles fullscreen (rather than just setting it) I wanted something more concrete.
I ended up using
wmctrl -r "<name of window>" -b add,fullscreen which sets fullscreen instead of toggling and calling this in a loop while the browser process is still running. Epiphany responds to this the same as if you'd just pressed F11, hiding the nav bar and removing window decorations.
# disable screensaver and screen blanking xset -dpms s off # create profile folder if it doesn't exist mkdir -p /home/<user>/.config/epiphany-kiosk # launch the browser as a background process epiphany-browser -a --profile /home/<user>/.config/epiphany-kiosk http://localhost:8000/ & # see https://stackoverflow.com/a/20165094/66349 # get the browser PID pid=$! # If this script is killed, kill the main process. trap "kill $pid 2> /dev/null" EXIT # Loop while it's running... while kill -0 $pid 2> /dev/null; do wmctrl -r "<name of window>" -b add,fullscreen sleep 2 done # Disable the trap on a normal exit. trap - EXIT
I find that using a delay between the epiphany launch command and the xte sucks. I looked for a better way (and more reliable).
My first attempt was to open epiphany on a php file that would execute the xte command:
<?php $out = shell_exec("xte 'key F11'"); ?>
Unfortunately it does not work. Cannot tell you why though (if someone knows, I am interested). When I echo the output with
xte -h I do get the help of xte command on my webpage... Anyway I did not have much time, so I try another way around.
The idea is still to launch epiphany to a php file (fs.php) that contains:
$h = fopen("/var/www/fs/FS.chk", "w"); #fwrite($h, "browser opened"); # <- don't really need this fclose($h);
For launching the web browser I will use a bash script that can be run after the boot, or anytime you want. The script contains:
if [ -e "var/www/fs/FS.chk" ]; then rm -f /var/www/fs/FS.chk fi epiphany localhost/fs/fs.php & until [ -e "/var/www/fs/FS.chk" ] do sleep 0.1 done xte "key F11"
As you noticed, my working directory is /var/www/fs/. But you can adapt this to your need. Also, it is quite easy to add a redirection on the php file to switch to the desired webpage once the web browser is running on full screen mode.
The php code create a witness (FS.chk) file while the bash, after having launched epiphany to this php file, is looking for the witness file. This file is only created once epiphany is opened (that get rids off the 15s sleep in previous posts). Once the bash sees the witness file, it executes the xte command...
EDIT: I just find out that it is important not to add "http://" before the URL passed to epiphany. If you do, the xte command will be issued, apparently, too soon.
Do like this! GoTo: https://github.com/elalemanyo/raspberry-pi-kiosk-screen
create the file:
paste this into fullscreen.sh:
#!/bin/bash sleep 20 if [ -z "$(pgrep epiphany)" ]; then (sudo -u pi epiphany-browser -a -i --profile ~/.config http://www.na.se --display=:0) & sleep 5s; xte "key F11" -x:0; fi bash $0 &
And then if your browser crashes, it will come to live again :)
Follow @Jacobm001 and @Adeel post but after all that modify:
#property id="3" value_type="gint">1920< #width
#property id="3" value_type="gint">1080< #height
match these above to the resolution of your device. My comment sections are not in the states.xml file.
Save and Reboot