Как изменить dpi linux

How to Find and Change Screen DPI in Linux

The DPI value of a screen indicates how many dots per inch or pixels per inch it supports. As the resolution increases, the display density also increases. You may know what resolution your display has but you may have no idea what your screen’s DPI is. It is important to find the proper DPI value in Linux. Setting it to an incorrect value will make controls and icons look blurry or small. In this article, we will see how to find the right value for your screen.

In modern distros, the X server can automatically detect the right value. If the value is incorrect, you can calculate it manually and change it in your Linux desktop environment and for the X server globally.

Note: Not all Linux software looks okay in high-resolution mode yet. For example, LibreOffice supports HiDPI well, but does not come with a single icon theme which suits high-resolutions. The scaling factor of Mozilla Firefox also needs to be adjusted manually. Only the Cinnamon desktop environment has perfect DPI scaling support out-of-the-box.

Let’s see how to find your DPI value in Linux.

Find the DPI value for your screen

To find the current DPI value of the screen used by Xserver, do the following.

  1. Open your favorite terminal emulator.
  2. Type or copy-paste the following command:
xdpyinfo | grep -B 2 resolution

Find Current Dpi Value

The output will be something like this:

The line «resolution» shows the actual value.

If this value is not correct, you can calculate it yourself. Here is how.

How to calculate the right DPI value

To calculate the proper DPI value, do the following.

  1. Open your favorite terminal emulator
  2. Get your screen size in millimeters by running the command:

Find Current Screen Size

The output contains the physical display size in millimeters. In my case, it is 340mm x 190mm.

  • Convert it to centimeters. My values are 34 x 19.
  • Convert centimeters to inches. Divide the values by 2.54. In my case, the values are as follows: 13.39in x 7.48in.
  • Finally, divide your screen resolution values by inch values. In my case, the values are as follows:
    1920/13.39 = 143,390589993=~144.
    1080/7.48 = 144,385026738=~144.
  • That’s it. For my screen, I need to use 144 as my DPI value. Let’s see how to change it.

    How to change the DPI value

    Depending on the graphical desktop environment you are using, the procedure can be different. I’ll review some common cases which will give you an idea of what to do.

    No desktop environment/barebones window manager

    If you are running a window manager without a full featured DE (for example, Fluxbox), you must create or modify the /home/your user name/.Xresources file and add the following line:

    Here and in all examples below, substitute the 144 portion with your actual DPI value.

    If your .Xresources file is not processed, add the following line to your startup file (e.g. .xinitrc or some window manager-specific file)

    Alternatively, you can try with the following line:

    However, xrandr may have issues with certain display drivers. Try and see if this works or not. In my case, this doesn’t work.

    Gnome 3

    Open a new terminal window and execute the command:

    gsettings set org.gnome.desktop.interface scaling-factor 2

    The scaling-factor parameter allows only whole numbers to be set. 1 = 100%, 2 = 200% and so on.

    Xfce

    The DPI can be set to what you want under Settings — Appearance — Font.

    Change Screen DPI Linux

    For further reading, I recommend you to refer to this page . It is dedicated to Arch Linux, but the tips are common between all modern distros or can be easily adapted.

    Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

    If you like this article, please share it using the buttons below. It won’t take a lot from you, but it will help us grow. Thanks for your support!

    Author: Sergey Tkachenko

    Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube. View all posts by Sergey Tkachenko

    2 thoughts on “How to Find and Change Screen DPI in Linux”

    Thanks!
    I change my display setup from time to time, but I can never remember where to find the appropriate setting. I would have NEVER expected it to be in the ‘Fonts’ section lol

    Leave a Reply Cancel reply

    Connect with us

    Here you can subscribe to our channels. We have Twittеr, YouTube, and Telegram, along with an RSS feed and Email newsletter.

    We discontinued Facebook to deliver our post updates.

    • Disable ads in Windows 11
    • Disable Defender in Windows 11
    • Disable SmartScreen in Windows 11
    • Disable web links in Search in Windows 11
    • Download Windows 11 ISO file for any build or version
    • Generic keys for Windows 11 (all editions)
    • Install Windows 11 with a local account
    • URI commands for Windows 11 apps
    • Windows 10 release history
    • Windows 11 ms-settings commands
    • Windows 11 Release history

    Recently updated

    Источник

    Как найти и изменить DPI экрана?

    Я пытаюсь найти, а затем изменить настройку разрешения экрана (точек на дюйм) в 12.04 и 12.10. Тем не менее, я не могу найти приложение или файл конфигурации, который может сделать это. Для этого есть какое-нибудь приложение или файл conf?

    Обратите внимание, что это для 12.04+, поэтому следующее не будет работать:

    Более того, они в основном меняют размер шрифта, а не фактическое разрешение экрана.

    11 ответов

    Это обновленная версия моего предыдущего ответа, который был связан с Ubuntu 12.04. В 16.04 (Xenial) необходимо 3 шага для правильной установки DPI вместо 2.

    Я объясню на примере системы с Ubuntu 12.04 с Gnome Classic и монитора с разрешением 1680×1050. Мои стартовые настройки: xdpyinfo | grep dots сообщается 96×96 dots , xrdb -query | grep dpi сообщается Xft.dpi: 96 , grep DPI /var/log/Xorg.0.log сообщил о некоторых странных настройках NOUVEAU(0): DPI set to (90, 88) ,

    В 16.04 выходные данные всех этих 3 команд были согласованы и равны 96. Хотя такой консенсус лучше, чем беспорядок 12.04, сообщаемое значение жестко закодировано и далеко от реального значения DPI.

    Давайте посчитаем оптимальное значение DPI для моего монитора. Фактический размер экрана можно узнать с помощью команды xrandr | grep -w connected (преобразовать вывод в сантиметры) или с длинной линейкой вручную. В моем случае: X = 47.4cm ; Y = 29.6cm , Разделите их на 2,54, чтобы получить размер в дюймах: X ~ 18.66in ; Y ~ 11.65in , Наконец, разделите фактическое количество точек (в зависимости от вашего разрешения) на размер в дюймах: X = 1680/18.66 ~ 90dpi ; Y = 1050/11.65 ~ 90dpi , Так что мой реальный dpi — 90.

    Помните, что ручной метод измерения может быть более точным, чем вывод команды xrandr | grep -w connected потому что более новые версии X-сервера игнорируют размер, сообщаемый EDID, и рассчитывают размер, используя разрешение экрана и жестко заданное значение DPI (дополнительная информация здесь).
    Другой способ найти размер монитора — это напрямую прочитать его EDID. устанавливать read-edid упаковать и запустить команду sudo get-edid | parse-edid | grep DisplaySize в терминале. Его вывод даст вам фактический размер вашего монитора в миллиметрах. Если нет — используйте линейку.

    Давайте начнем исправлять DPI:

    1) В 12.04 запустить gksudo gedit , открыть /etc/lightdm/lightdm.conf и добавить параметр в [SeatDefaults] раздел:

    В 16.04 по умолчанию такого файла нет, поэтому необходимо создать lightdm.conf вручную и положить его в /etc/lightdm/lightdm.conf.d/ , Содержимое этого файла одинаково:

    [SeatDefaults] xserver-command=X -dpi 90 

    Перезагрузите компьютер или перезагрузите X. Теперь grep DPI /var/log/Xorg.0.log покажет желаемую настройку.

    2) В моем предыдущем ответе я предложил создать файл в /etc/X11/Xsession.d/ содержащий строку xrandr —dpi 90 , Это работало в 12.04, но в 16.04 этот параметр не является постоянным. В более новых системах мы можем добавить желаемое значение при запуске сеанса. Запустите «Автозагрузка приложений», нажмите кнопку «Добавить», назовите ее «Fix DPI» и установите команду xrandr —dpi 90 в поле. Сохраните изменения и войдите снова. Сейчас xdpyinfo | grep dots сообщит 90×90 dots ,

    Если xdpyinfo все еще показывает 96, затем добавить тайм-аут перед запуском xrandr , Отредактируйте команду в «Автозагрузке приложений» и измените ее на:

    bash -c "sleep 15; xrandr --dpi 90" 

    Шаг 2 не является обязательным для 12.04, потому что в старых системах шаг 1 исправляет оба Xorg.0.log а также xdpyinfo ценности.

    3) В GNOME3 DPI настройка жестко задана на 96 и не может быть изменена напрямую, но вместо этого можно масштабировать текст. Рассчитаем нужный множитель: desired_DPI / 96 (в моем случае 90/96 = 0.9375 ). Теперь запустите команду (или используйте dconf Если вы предпочитаете):

    gsettings set org.gnome.desktop.interface text-scaling-factor 0.9375 

    Изменения будут применены сразу. xrdb -query | grep dpi сообщит желаемое Xft.dpi: 90 ,

    PS Есть еще один способ исправить настройку DPI, который намного сложнее и описан в этом руководстве. Я попробовал это также, и результат был тем же самым (по крайней мере в 12.04).

    Послесловие: Только разработчики Ubuntu могут с уверенностью сказать, действительно ли значения, измененные в соответствии с шагами 1 и 2, действительно имеют значение в современной Ubuntu, или они молча игнорируются. Только Шаг 3 производит изменения, которые мгновенно заметны. Тем пользователям, которые считают, что определенные приложения могут по-прежнему полагаться на настройки X-сервера, рекомендуется выполнить все 3 шага, описанных выше. В остальном достаточно шага 3 — это единственный способ настройки, принятый в современных дистрибутивах Ubuntu.

    Источник

    How do I change the font DPI settings?

    I installed Oneiric on a clean system, and found that the font tab is gone from the Appearance settings. This is a problem, because by default the text in Ubuntu is too large. I changed the text from normal to small in the Universal Access settings, but then it was way too small. I also tried it this way, but it doesn’t appear to have any effect. How can I get back the fine control and change my DPI from 96 to 90?

    @BartVanHeukelom: Please explain, why do you want to change the FONT DPI and not the whole SCREEN DPI? as @user294881 said, this is possible now in System Settings -> «Displays» -> «Scale for menu and title bars» Screenshot

    6 Answers 6

    Gnome Tweak Tool

    This is a common issue on the forums — the move to gnome3 has dumped many of the customisation features that were available in gnome2.

    One GUI tool that exists in Software Center is gnome-tweak-tool — its a partial solution to allow you to customise some aspects of fonts.

    enter image description here

    The «Text scaling factor» is the option you are interested in — its unfortunate that it is a sliding bar so you will not be able to enter the actual DPI value. Click on the sliding bar and use the left/right arrow keys to decrease/increase the font size.

    dconf-editor

    Using dconf-editor which is available in the dconf-tools package allows you to set the «Text Scaling Factor» numerically i.e. changing the default value by fractions of numbers (1.2, 0.9 etc) changes the overall screen font size:

    enter image description here

    Universal Access

    If you just want to adjust the text size universally without need detail you can do this from the universal access tool:

    Источник

    Читайте также:  Linux команда задать время
    Оцените статью
    Adblock
    detector