Is there a way to find all the modes for a specific output only?

Hello there.
I have a monitor connected to my laptop called DP-1.
Is there a way I can find all the mode associated with that output?
Running xrandr gives me all the modes for all the outputs, but I want to integrate this into a script, so the script will find a specific mode, but that mode is for another monitor.
Maybe I can do something like:

xrandr --output DP-1 --showmodes

Thanks.

Hello,

Most likely you can get all the information from xrandr - ArchWiki
or by running xrandr --help

Yes, it seems that you can only show all modes for each screen via:

xrandr -d :0

EDIT: Maybe there’s a way to do it without xrandr :thinking:

I managed to overcome my issue via a python script, which can be found here.

EDIT: I managed to do it with this bash script:

#!/bin/bash

output="DP-1"
reached_output="false"
number='^[0-9]+$'

while read -r line
do
    if [[ $(echo "$line" | awk '{print $1}') = "$output" ]]; then
        echo "$line"
        reached_output="true"
    elif [[ $reached_output = "true" ]] && [[ $(echo "$line" | cut -d 'x' -f1) =~ $number ]]; then
            echo "$line"
    elif ! [[ $(echo "$line" | cut -d ' ' -f1) = "" ]]; then
            reached_output="false"
    fi
done < <(xrandr)

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.