Shell – How to make Firefox auto launch at startup in fullscreen on Linux Ubuntu

firefoxfullscreenshell-scriptstartupUbuntu

Firefox Ready

Objective

I want my ubuntu to start and show a Duck Duck Go in fullscreen.

Motivation

The first thing that I do on my PC is launch the Firefox and do stuff. For other stuff I hit the ctrl+alt+T and do things in the terminal. I want Firefox to start and be ready for me to work on.

Ethics

Saving Time, Making the computer have a better workflow for a person like me [someone who spends most of his time using the browser], serving my laziness.

Initial Hypothesis

I can make linux run Firefox using some commands at startup which will make it run in fullscreen and have opened the Duck Duck Go page.

Updates

20:56:44 15/08/18: I am learning the commands available for Firefox from here.

21:12:15 15/08/18: Done with commands. The command to start Firefox with default user and make it launch Duck Duck Go is firefox “www.duckduckgo.com”. I only need to find a way to make it open in fullscreen now.

21:35:48 15/08/18: There is no way fullscreen launch can be performed using firefox’s commands. Neither does linux have any command to make Firefox launch in fullscreen. I might need to either send a keystroke F11 or use some plugin to accomplish this. But sending a keystore needs moe than one command and I don’t know if that will be as easy or not. And using a plugin is not favourable firstly because I don’t want every Firefox launch to be in fullscreen and secondly I don’t want to install another plugin.

16/08/18

14:07:48 I asked on stack exchange and someone suggested to use xdotool.

14:22:17 I am learning xdotool

14:56:18 The stack exchange command didnot work for me. What works for me instead is xdotool search -class firefox key –-window %@ --delay 1000ms F11.
Now I am not able to give the command to launch firefox and use the xdotool in the same line. I need to learn bash.

16:45:34 04/11/18: Its been so long since I abandoned this project. Let me look at it agian, without revising on any of the updates and the old initial hypothesis.

16:49:51 04/11/18: just added this firefox -url http://superuser.com &
xdotool search --sync --onlyvisible --class "Firefox" windowactivate key F11
to startup application list. It did worked when I passed from the terminal though. Lets see if it works after restart. Will it work on logout and login? Lets see.

16:54:54 04/11/18: It did took me into firefox with duckduckgo but it also tried to take me to the url f11. Maybe I need to tweak it a bit. Its actually ment for terminal and not for single line command which is need in startup application. BTW it did work with log out and in. Second try. This time I removed the ‘&’ from the previous command.

16:58:17 04/11/18: Still didn’t work!! Same issue. I guess I’ll try sending this log to someone inside firefox. Maybe they will be able to help.

Best Answer

Write a miniscript with xdotool:

#!/bin/sh
firefox &
xdotool search --sync --onlyvisible --pid $! windowactivate key F11
Related Question