LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 01-13-2023, 06:28 PM   #1
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
launch Firefox in a new profile with full screen


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.
 
Old 01-13-2023, 11:46 PM   #2
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 1,959

Rep: Reputation: 271Reputation: 271Reputation: 271
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.
 
Old 01-16-2023, 05:41 PM   #3
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
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.
 
Old 01-17-2023, 09:53 AM   #4
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
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):
Code:
{"chrome://browser/content/browser.xul":{"main-window":{"screenX":"4","screenY":"23","width":"1280","height":"970","sizemode":"fullscreen"},"sidebar-box":{"sidebarcommand":"","width":""},"sidebar-title":{"value":""}}}

Last edited by rknichols; 01-17-2023 at 10:09 AM. Reason: I got it to work
 
Old 01-18-2023, 06:33 AM   #5
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 1,959

Rep: Reputation: 271Reputation: 271Reputation: 271
Quote:
Originally Posted by rknichols View Post
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.
 
Old 01-18-2023, 09:00 AM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by RandomTroll View Post
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?).

Last edited by rknichols; 01-18-2023 at 09:01 AM.
 
Old 01-18-2023, 01:18 PM   #7
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 1,959

Rep: Reputation: 271Reputation: 271Reputation: 271
Quote:
Originally Posted by rknichols View Post
You do have to do that edit while there is no Firefox process running with that profile.
I guessed that, edited it after re-booting to kernel 6.1.7 but before starting X. I had to change only width, height, screenX, and screenY entries.

Quote:
Originally Posted by rknichols View Post
Perhaps it's version dependent.
I think he meant that there's no official way to do it - editing xulstore.json yourself isn't. In the good old days I had a -geometry argument.
 
Old 05-27-2023, 07:22 PM   #8
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
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 View Post
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 View Post
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.
 
Old 05-27-2023, 09:48 PM   #9
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
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.
 
Old 05-28-2023, 06:18 AM   #10
elcore
Senior Member
 
Registered: Sep 2014
Distribution: Slackware
Posts: 1,753

Rep: Reputation: Disabled
IIRC you can simply save resolution to old.json and "cp old.json ~/.mozilla/firefox/*/xulstore.json && firefox-bin"
 
Old 05-29-2023, 05:37 PM   #11
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by elcore View Post
IIRC you can simply save resolution to old.json and "cp old.json ~/.mozilla/firefox/*/xulstore.json && firefox-bin"
do you recall the way to "simply save resolution to old.json"?
 
Old 05-29-2023, 05:50 PM   #12
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by rknichols View Post
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.
 
Old 05-30-2023, 03:20 AM   #13
elcore
Senior Member
 
Registered: Sep 2014
Distribution: Slackware
Posts: 1,753

Rep: Reputation: Disabled
Quote:
Originally Posted by Skaperen View Post
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.
 
Old 05-30-2023, 11:38 PM   #14
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by elcore View Post
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 View Post
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 View Post
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 View Post
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
WithOUT opening profile manager each time, make another firefox launcher to *always* use specific profile LenHoff Linux - Software 3 12-12-2022 06:34 PM
Updating to Firefox 67 switches to a new Profile, makes users worry about old profile onebuck Linux - General 1 05-30-2019 04:06 PM
[SOLVED] full screen not really a full screen - why is that? linux-man Linux - Newbie 6 05-20-2018 08:21 AM
[SOLVED] Firefox nightly: full screen isn't full screen any more. jdkaye Linux - Software 11 08-23-2014 01:37 PM
Konqueror full screen with no menubar can't save profile barnamos Linux - General 5 04-28-2006 04:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration