Linux узнать текущее разрешение экрана

Как узнать разрешение экрана linux

How can I get the monitor resolution using the command line?

I would like to find a wallpaper that best suits my resolution. How can I get the resolution just by writing commands in the command line?

10 Answers 10

Or to get just the resolution:

Here I have two screens, the resolution are:

To get only the resolution of your primary monitor, you can also use this python oneliner:

To get the resolution of your extanded desktop (for a multi monitor setup):

The request was for the resolution. That is given by

Example of output on one of my machines:

On a raspberry pi without X, I was able to get the screen resolution by running:

You can get your current screen’s resolution as follows:

Get the X resolution by running:

Get the Y resolution by running:

Output the X and Y resolution by running:

That should be possible to do like this without using awk too.

You can start by terminal your preferred website which show you your screen resolution.

You can show the webpage on your terminal too by useing https://www.brow.sh/

If you like, you can skrapping this page by terminal by include appropriate python website skrapping tools and export the output to a terminal var.

Another solution is to use xprop:

If anyone cares, it was slightly faster on my machine than grepping xdpyinfo

Or, if you only care about width:

Tested only on multiple displays organized via Xinerama.

For what it’s worth, when using multiple connected displays and/or offsets with TwinView then xdpyinfo will give you the resolution of the entire set of displays the way they are configured. If you require the resolution of a single monitor or a monitor connected to one of the display ports you need to use xrandr. However, even in that configuration xrandr can be unreliable and not show the resolution. See this example entry from my X windows config file:

Читайте также:  Network up and down in linux

The xrandr output looks like this:

You can see that DP-3 isn’t showing a resolution on the line that a grep for «connected» would show. So the best, most consistent, and reliable command I’ve found for identifying the resolution of any individual connected display is:

At that point, it’s pretty trivial to pick out the different resolutions or grep for only one port.

unixforum.org

Решено: Как узнать текущее разрешение экрана из консоли?

Модератор: Bizdelnick

Решено: Как узнать текущее разрешение экрана из консоли?

Сообщение zshgm » 04.07.2010 17:57

Как узнать текущее разрешение экрана из КОНСОЛИ?

В /etc/X11/xorg.conf сразу несколько допустимых разрешений экрана, а как узнать текущее?

Section «Screen»
Identifier «Default Screen»
Device «Intel Corporation 82915G/GV/910GL Integrated Graphics Controller»
Monitor «LCD73V»
DefaultDepth 24
SubSection «Display»
Depth 1
Modes «1280×1024» «1152×864» «1024×768» «832×624» «800×600» «720×400» «640×480»
EndSubSection
.

How to query X11 display resolution?

It seems like an simple problem, but I can’t find the answer: How do you query (via X11) what monitors exist and their resolutions?

8 Answers 8

  • From the first link: ScreenCount() , ScreenOfDisplay()
  • From the second link: WidthOfScreen() , HeightOfScreen()

This might be helpfull for cli and scripting

But xRandR might be more accurate, especially, when there is multiple monitor environment:

If Xinerama is in use, try XineramaQueryScreens . Otherwise, you may be able to assume a single screen and use (X)WidthOfScreen / (X)HeightOfScreen.

(Also see the other answer. It’s remotely possible someone is using the old X screen model where your screens are :x.0 , :x.1 , etc.)

For modern X servers, there’s also the XRandR extension, which provides the most up-to-date model of multi screen layout information, including overlapping screens and dynamic screen changes.

Documentation of it is available in the XRandR 1.3.1 Protocol spec and the libXrandr man page.

The library X11 working only with unix-like OS, so it is a not cross-platform solution.

How do I find out my screen resolution from a shell script?

How do I find out my screen resolution from a shell script?

9 Answers 9

Command xdpyinfo displays various information about your X server. It writes a lot of things to the standard output but we only need the line starting with the word dimensions , thus we use grep . Finally we use sed to clean the result.

Читайте также:  Nvidia linux driver documentation

xdpyinfo | grep dimensions will give you the total resolution, if you have multiple monitors it will be the sum of all of them. xrandr —current will give you the resolution for each monitor.

I use this snippet to find the maximum possible resolution for rDesktop without going to full screen:

Minus windows decoration (more or less):

Which is the max resolution for rDesktop without going full screen.

It works fine so far but I haven’t tested thoroughly though.

Another example is for screencast with avconv :

You could use the xrandr -q command. From that you can create a shell script if needed.

For more information on the command go here or type man xrandr

A very simple method is to read out the modes file in the sys-directory:

xdpyinfo will do it, with some parsing. It gives a lot of info which you’ll then have to dig the screen number, and dimensions from

Two possible alternatives produced combining the answers of @user31752 and @eliezer-e-vargas

The use of grep ‘*’ | uniq from @eliezer-e-vargas get a different line (ex. » 1440×900 59.90*+ 59.89″ ) of xrandr output, while the grep ‘ connected ‘ get a simple one (ex. «LVDS1 connected 1440×900+0+0 . «).

The use of regex by @user31752 is nice, so the line that I’m using needs a simpler regex, or can be substituted whit the simpler cut command.

Reading the Monitor Screen Data

The vesa standard provides a method of how to read the monitor screen resolution.

Extended Display Identification Data (EDID): This standard defines data formats to carry configuration information, allowing optimum use of displays.

A monitor typically supports multiple resolutions and refreshrates. Of course someone will prefer the maximum (physical) one.

To read this monitor data, try one of these solutions:

Then read via i2c the screen monitor data and parse it

Hexdump the edid data

In case edid-tools are not installed, you can dump the edid hex-file, e.g.:

To encrypt this hex file take a look at wiki or download the edid specifications.

Читайте также:  Full screen launcher linux

Источник

Как найти разрешение экрана в среде рабочего стола Linux

Одним из системных параметров, который вы часто проверяете или изменяете в среде рабочего стола Linux, является параметр дисплея, в частности разрешение экрана. Существуют различные способы получения информации о разрешении экрана в Linux: либо из командной строки, либо из настроек дисплея на основе графического интерфейса.

В этом руководстве я опишу, как найти разрешение экрана в среде рабочего стола Linux.

Способ первый: xdyinfo

Одним из способов определения разрешения монитора является использование xdpyinfo , утилиты командной строки для отображения информации о X-сервере, включая текущее разрешение экрана. Чтобы проверить текущее разрешение экрана из командной строки, просто запустите:

$ xdpyinfo | grep "dimensions" | awk '< print $2 >'

Второй метод: xrandr

Вторая команда разрешения экрана — xrandr , интерфейс командной строки для RandR (сокращение от «X Resize, Rotate and Reflect Extension»). Команда xrandr может показать вам текущее разрешение экрана, а также все возможные настройки дисплея.

Screen 0: minimum 320 x 200, current 1366 x 768, maximum 8192 x 8192 LVDS1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 194mm 1366x768 60.0*+ 40.1 1360x768 59.8 60.0 1024x768 60.0 800x600 60.3 56.2 640x480 59.9 VGA1 disconnected (normal left inverted right x axis y axis) HDMI1 disconnected (normal left inverted right x axis y axis) DP1 disconnected (normal left inverted right x axis y axis)

Как вы можете видеть выше, если вы запустите команду xrandr без каких-либо аргументов, вы можете получить список всех доступных разрешений экрана. Текущее установленное разрешение экрана обозначается маркером * . Поэтому, чтобы найти только текущее разрешение экрана, используйте следующую команду.

Способ третий: настройки дисплея

Каждая среда рабочего стола Linux поставляется со своими собственными системными настройками на основе графического интерфейса, включая настройки дисплея. Таким образом, вы можете использовать настройки дисплея на основе графического интерфейса для определения текущего разрешения экрана. Чтобы запустить параметры отображения на основе графического интерфейса, вы можете использовать интерфейс командной строки для рабочего стола, как показано ниже.

Чтобы запустить настройки отображения в среде рабочего стола GNOME, используйте одну из следующих команд:

$ gnome-control-center display

Чтобы запустить настройки отображения в среде рабочего стола KDE, запустите:

Чтобы запустить настройки отображения в среде рабочего стола LXDE, запустите:

Чтобы запустить настройки отображения в среде рабочего стола Xfce, запустите:

Источник

Оцените статью
Adblock
detector