Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i want to make a script that will launch an instance of Firefox under a newly created profile in such a way that it opens in full screen mode in that profile. i do not see any command line options to specify full screen mode. i tried the X standard option --geometry=1920x1080 but that seems to be ignored. if it gets opened in a normal screen mode that is full screen in size, that's OK. i am using --no-remote and creating a new profile on the fly every time i try. when i get this to work, i plan to add a way to recycle profiles so it does not end up making a million profiles. any ideas how to do this?
i grepped every file in the profile directory, after manually setting that profile to full screen, for the string "1920", hoping it is stored in decimal text, but nothing is found. any ideas how this setting is stored?
if i know how it is stored i could have it be created when i create the new profile. i am not interested in discussions about why i am doing this or other off-topic things.
Have you checked in about:config? I've gotten useful responses on Mozilla's fora. I noticed -geometry stopped working. Curiously they have one for the size of the screenshot, --window-size; odd that they don't have one for starting geometry. tor deliberately randomizes starting screen size, discourages going fullscreen; that could tip off your surveillors.
it would matter where about:config settings are stored. i believe they would be stored in the profile. that would make about:config totally unusable since the whole effort involves a newly created profile which would force about:config to the default values.
i am wanting the full screen on the physical display. it can just be a specified size, added by my script. the script could discover that size during its initialization then specify that size everywhere. if there is any way to force a window size for firefox that actually works, that should be a solution. if i knew where and how about:config is stored, maybe i can make such file(s) for the physical size and put those in the profile before first use.
You can make firefox start with the window fullscreen by creating, in the newly created profile, a file "xulstore.json" with the following content (some of the parameters are irrelevant):
You can make firefox start with the window fullscreen by creating...
FWIW I edited my xulstore.json and Firefox just replaced it with what it had been before, so if it works for rknichols then creating a new profile is necessary.
I searched on Mozilla support. The only answer I could find is that there is no longer a way to start fullscreen.
FWIW I edited my xulstore.json and Firefox just replaced it with what it had been before, so if it works for rknichols then creating a new profile is necessary.
You do have to do that edit while there is no Firefox process running with that profile. That xulstore.json file is the only memory Firefox has of "what it had been before," but it's only read once when Firefox starts, and gets rewritten with the current state when Firefox exits.
Quote:
I searched on Mozilla support. The only answer I could find is that there is no longer a way to start fullscreen.
Perhaps it's version dependent. I'm running Rocky Linux 8 with Firefox 102.6.0esr, and it works there, though when Firefox first starts up it doesn't look like it's in fullscreen mode until you click somewhere in the main window. Until you do that, there are a couple of toolbars displayed at the top. It's a safety thing, to avoid the possibility of starting up with a completely blank full screen, or perhaps very misleading content (screengrab of your desktop, perhaps?).
yeah, this thread is old but i am still looking for a way to start Firefox with a size equivalent to full screen (not necessarily directly on the screen device as X sees it; a plain window sized to cover all of the screen is OK ... the position will always be 0,0).
Quote:
Originally Posted by RandomTroll
I searched on Mozilla support. The only answer I could find is that there is no longer a way to start fullscreen.
i wonder if that refers to the mode where X gives the client added API to control the screen, as opposed to just operating a window of a size equal to the screen size. is it the case that there is no longer a way to specify the window size at startup even if the previous time it ran it was stretched out to a preferred size?
suppose i stretch out the window to be 1920x1080 on my 1920x1080 display, exit Firefox gracefully, then start it up, again, in that profile? or what if i stretch it to just 1280x720
on my 1920x1080 display?
Quote:
Originally Posted by RandomTroll
FWIW I edited my xulstore.json and Firefox just replaced it with what it had been before, so if it works for rknichols then creating a new profile is necessary.
i want to do the same size, every time (the size of my display). maybe i can manually stretch out a window once and copy that profile as a prototype, for each time i want to do this.
Here's an excerpt from a script I have that forces the height, width, and sizemode to preset values in the Firefox xulstore.json file. It's a shell function that runs an awk script that generates an ed script that modifies the file. Yes, I know it's a horrible way to edit an xml file. How it grew to be this way is a long story. Note that the height and width are passed as parameters to awk. The size mode is hard-coded as "normal".
Code:
finder-json() {
# Any explanation of how these match and print operations work would be even
# harder to understand than the statements themselves. Thanks to the "ed"
# command handling essentially unlimited line lengths, they work whether or
# not the xml file has any line breaks.
awk -v Width=$FFwidth -v Height=$FFheight \
'
match($0, "(browser/content/browser.xhtml\":{\"main-window\":{[^}]*\"height\":)\"([0-9]+)\"", aa) && aa[2] != Height {
print FNR "s/\\(.\\{" RSTART "\\}[^}]*\"height\":\"\\)[0-9]\\+/\\1" Height "/"
}
match($0, "(browser/content/browser.xhtml\":{\"main-window\":{[^}]*\"width\":)\"([0-9]+)\"", aa) && aa[2] != Width {
print FNR "s/\\(.\\{" RSTART "\\}[^}]*\"width\":\"\\)[0-9]\\+/\\1" Width "/"
}
match($0, "(browser/content/browser.xhtml\":{\"main-window\":{[^}]*\"sizemode\":)\"([[:alnum:]]+)\"", aa) && aa[2] != "normal" {
print FNR "s/\\(.\\{" RSTART "\\}[^}]*\"sizemode\":\"\\)[[:alnum:]]\\+/\\1" "normal" "/"
}' "$1"
}
The invocation is basically
Code:
FFwidth=1128 # example
FFheight=1000 # example
EdCmds=`finder-json /path/to/xulstore.json`
ed -s /path/to/xulstore.json <<EOF
$EdCmds
w
q
EOF
These are excerpts from a much larger script that does a lot of other stuff for Firefox and other apps. I hope I've included everything relevant.
These are excerpts from a much larger script that does a lot of other stuff for Firefox and other apps. I hope I've included everything relevant.
as long as it edits the correct places in the correct format, it should be good enough. my programming background is C, no C++, bash, awk, no Perl, Pike and Python (2 && 3). my plan is to do the hard work in Python and wrap it in a bash function.
love those functions. i have probably 50 or so commands implemented that way. they beat aliases, too.
do you recall the way to "simply save resolution to old.json"?
What is so difficult about replacing few numbers and saving a static copy of a dynamic file?
If your backup file's outside the profile, it's not going to change on its own, so I guess just write to it with an editor of your choice.
Maybe there's a real reason to automate this but I have missed it.
Additionally:
Quote:
a way to recycle profiles so it does not end up making a million profiles. any ideas how to do this?
I use tmpfs, and "profile" here's just a temporary copy in system memory. Basically 'cp -R oldprofile /tmp/profile' on boot, and some symlink in ~/mozilla/firefox/[symlink to /tmp/profile]
Quote:
it would matter where about:config settings are stored. i believe they would be stored in the profile. that would make about:config totally unusable since the whole effort involves a newly created profile which would force about:config to the default values.
So, you're looking to generate a default prefs.js on each new launch, or keeping the old prefs.js in this new profile? It's not very clear.
Note: prefs.js is dynamic, user.js is static. On launch, it'd usually read user.js and write everything found there into prefs.js overriding the defaults.
What is so difficult about replacing few numbers and saving a static copy of a dynamic file?
knowing exactly which file, which numbers, any variant semantics. i have not looked inside a profile, yet. i'm holding that off for now while talking here. i'm hoping to know if what i want to do is feasible. what gets said about Firefox gets me worried. if the data is straight texty XML then it should easy enough to change the "window geometry last time ran" to whatever was obtained from "xwininfo -root" for Width and Height (or whatever tool someone is using).
Quote:
Originally Posted by elcore
If your backup file's outside the profile, it's not going to change on its own, so I guess just write to it with an editor of your choice.
this will all be done a part of another script. it will "create" the profile from pieces of a previous profile or construct a new one from pieces embedded in the script. then it will start up "firefox -p $profilename ..." then do whatever needs to be next like dealing with firefox exiting.
Quote:
Originally Posted by elcore
Maybe there's a real reason to automate this but I have missed it.
i didn't give the reason and intend not to, to keep discussion focused.
Quote:
Originally Posted by elcore
Additionally:
I use tmpfs, and "profile" here's just a temporary copy in system memory. Basically 'cp -R oldprofile /tmp/profile' on boot, and some symlink in ~/mozilla/firefox/[symlink to /tmp/profile]
So, you're looking to generate a default prefs.js on each new launch, or keeping the old prefs.js in this new profile? It's not very clear.
Note: prefs.js is dynamic, user.js is static. On launch, it'd usually read user.js and write everything found there into prefs.js overriding the defaults.
i haven't thought about this, yet. i'm looking to see what shortcuts might be available. but it looks like i need to tweak something that convinces it that it was at a particular size last time hoping it will launch this size (that i substituted) this time.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.