I'm trying to start Firefox from bash and I want it to open the webconsole on start (this can be done by pressing F12 rigth after it started). Is there a bash command that starts the programm and sends the F12 key while starting? I already looked at xdotool and tried to create a bash script, that starts firefox and then sends the key with xdotool, but the xdotool command isn't run until I close firefox.
#!/bin/sh set -e #abort if anything fails firefox & #run firefox in the background pid=$! #remember its pid #Poll X until firefox sets up a window #remember the X id of the window while [ -z "$id" ]; do id=$(xdotool search --onlyvisible --pid $pid) sleep 0.1 #poll interval done #Bring the window to the front and send it the F12 key xdotool windowactivate $id && xdotool key F12 disown "$pid"
This isn't very robust, though. Configuring
firefox to open the console by itself would be better.