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



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:



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

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