Mozilla 도움말 검색

고객 지원 사기를 피하세요. 저희는 여러분께 절대로 전화를 걸거나 문자를 보내거나 개인 정보를 공유하도록 요청하지 않습니다. "악용 사례 신고"옵션을 사용하여 의심스러운 활동을 신고해 주세요.

자세히 살펴보기

How to set the default zoom level depending on the screen under Linux?

  • 5 답장
  • 4 이 문제를 만남
  • 23 보기
  • 최종 답변자: vinc17

more options

From the same account, I can use different kinds of screens: low dpi and high dpi. I'd like to have the font size (and more generally, zoom level) right for each screen.

To set the default zoom level, one can set layout.css.devPixelsPerPx, but one can only set it to some fixed value, which is not OK, because I would like the value to depend on the environment (like for the font size in the menu, which is always OK, as it depends on the Xft.dpi X11 resource).

Note: I have multiple profiles, so that it is not even possible to write a wrapper that would modify the prefs.js file, because I don't know in advance which file I would need to modify.

What can I do?

From the same account, I can use different kinds of screens: low dpi and high dpi. I'd like to have the font size (and more generally, zoom level) right for each screen. To set the default zoom level, one can set layout.css.devPixelsPerPx, but one can only set it to some fixed value, which is not OK, because I would like the value to depend on the environment (like for the font size in the menu, which is always OK, as it depends on the Xft.dpi X11 resource). Note: I have multiple profiles, so that it is not even possible to write a wrapper that would modify the prefs.js file, because I don't know in advance which file I would need to modify. What can I do?

선택된 해결법

A possibility would to to use the mozilla.cfg file in the Firefox program folder. This file can contain JavaScript that runs with full chrome privileges and it it not difficult the set the layout.css.devPixelsPerPx pref to a value that is correct for the currently attached screen. You would have to find out how to calculate the screen dimensions.

문맥에 따라 이 답변을 읽어주세요 👍 1

모든 댓글 (5)

more options

if you want to set the text size/pixel density in firefox different from that of your system's settings like it was handled in prior versions, enter about:config into the firefox address bar (confirm the info message in case it shows up) & search for the preference named layout.css.devPixelsPerPx. double-click it and change its value to 1.0 (or any other zoom factor that fits your purpose; -1.0 is the default value and will adhere to the system settings).

more options

선택된 해결법

A possibility would to to use the mozilla.cfg file in the Firefox program folder. This file can contain JavaScript that runs with full chrome privileges and it it not difficult the set the layout.css.devPixelsPerPx pref to a value that is correct for the currently attached screen. You would have to find out how to calculate the screen dimensions.

more options

cor-el said

Thanks. This works. More precisely I have in the application directory defaults/pref/default-prefs.js with:

pref("general.config.obscure_value", 0); pref("general.config.filename", "firefox.cfg");

And firefox.cfg contains:

// IMPORTANT: Start your code on the 2nd line var hdef = getenv("X11_HDEF"); if (hdef >= 2400) {

 pref("layout.css.devPixelsPerPx", "1.77");

} else {

 pref("layout.css.devPixelsPerPx", "-1.0");

}

My configuration system makes sure that the X11_HDEF environment variable is up-to-date, even when using GNU screen and recalling a session from another machine via SSH.

The only minor problem is that while default-prefs.js can be put under the profiles, firefox.cfg must be in the application directory (I did several tests with strace), which first means that I need to install Firefox under my $HOME, but also I fear that the file is not kept after an upgrade (I have not tried, so I'm not sure); however if this is the case and I'm annoyed by that, I could reinstall it automatically.

more options

You can install Firefox anywhere. It doesn't have to be in the home directory (I install under usr/local) as long as the mozilla.cfg file is in the main application directory where the firefox startup script is located and the script to specify using the mozilla.cfg in the defaults/pref directory.

The defaults/pref directory also stores the channel-prefs.js file and is never affected by an update (only installing a full version could).

more options

I meant for machines shared by several users (who are not admins), in particular on a network with heterogeneous machines and a NFS-mounted home.