Change display settings via command line (?)

Please post suggestions for improvement of Cinnamon on:
https://github.com/linuxmint/Cinnamon
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
kernelcrunch
Level 1
Level 1
Posts: 16
Joined: Thu Sep 23, 2021 2:37 am
Location: Dallas, TX

Change display settings via command line (?)

Post by kernelcrunch »

I have three displays attached to my desktop. I switch between a pair of them (in one location) and one of them (in another location) at least twice a day. (Below are the two settings I switch between) I was wondering if it was possible set the display settings via command line? Maybe with xrandr or something. Or must the Cinnamon UI be used to set the displays? (If it is possible to use the command line, then I plan to try building a script which I can assign to a hotkey.) Thank you.

Code: Select all

xrandr
Screen 0: minimum 320 x 200, current 3840 x 2160, maximum 16384 x 16384
DisplayPort-0 connected (normal left inverted right x axis y axis)
   3840x2160     60.00 +  50.00    59.94    30.00    25.00    24.00    29.97    23.98  
   4096x2160     60.00    50.00    59.94    30.00    25.00    24.00    29.97    23.98  
   2560x1440    120.00  
   1920x1200     60.00  
   1920x1080    120.00   100.00   119.88    60.00    60.00    50.00    59.94    30.00    25.00    24.00    29.97    23.98  
   1600x1200     60.00  
   1680x1050     60.00  
   1280x1024     60.02  
   1440x900      60.00  
   1280x800      60.00  
   1280x720      60.00    50.00    59.94  
   1024x768      60.00  
   800x600       60.32  
   720x576       50.00  
   720x480       60.00    59.94  
   640x480       60.00    59.94  
   720x400       70.08  
DisplayPort-1 disconnected (normal left inverted right x axis y axis)
HDMI-A-0 connected (normal left inverted right x axis y axis)
   3840x2160     60.00 + 120.00   100.00    96.02    72.00    60.00    50.00    48.00   119.88    50.00    59.94    30.00    25.00    24.00    29.97    23.98  
   4096x2160    120.00   100.00   119.88    60.00    50.00    59.94    30.00    25.00    24.00    29.97    23.98  
   2560x1440    120.00  
   1920x1200     60.00  
   1920x1080    120.00   100.00   119.88    60.00    60.00    50.00    59.94    30.00    25.00    24.00    29.97    23.98  
   1600x1200     60.00  
   1680x1050     60.00  
   1280x1024     60.02  
   1440x900      60.00  
   1280x800      60.00  
   1280x720      60.00    50.00    59.94  
   1024x768      60.00  
   800x600       60.32  
   720x576       50.00  
   720x480       60.00    59.94  
   640x480       60.00    59.94  
   720x400       70.08  
HDMI-A-1 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 1600mm x 900mm
   3840x2160     60.00 + 120.00*  100.00    96.02    72.00    60.00    50.00    48.00   119.88    50.00    59.94    30.00    25.00    24.00    29.97    23.98  
   4096x2160    120.00   100.00   119.88    60.00    50.00    59.94    30.00    25.00    24.00    29.97    23.98  
   2560x1440    120.00  
   1920x1200     60.00  
   1920x1080    120.00   100.00   119.88    60.00    60.00    50.00    59.94    30.00    25.00    24.00    29.97    23.98  
   1600x1200     60.00  
   1680x1050     60.00  
   1280x1024     60.02  
   1440x900      60.00  
   1280x800      60.00  
   1280x720      60.00    50.00    59.94  
   1024x768      60.00  
   800x600       60.32  
   720x576       50.00  
   720x480       60.00    59.94  
   640x480       60.00    59.94  
   720x400       70.08  
Attachments
2023-05-29_03-55.png
2023-05-29_03-54.png
Last edited by LockBot on Wed Nov 29, 2023 11:00 pm, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
SMG
Level 25
Level 25
Posts: 31760
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: Change display settings via command line (?)

Post by SMG »

kernelcrunch wrote: Mon May 29, 2023 5:10 am I have three displays attached to my desktop. I switch between a pair of them (in one location) and one of them (in another location) at least twice a day.
How are you "switching" between them? A KVM switch of some type? Or do you always have all of them attached and you are just using either the one or the pair? I'm not understanding what you mean by "switching".

When reading xrandr output, *= current resolution and += preferred resolution. I'm guessing this output is from when you are only using #1?

Code: Select all

Screen 0: minimum 320 x 200, current 3840 x 2160, maximum 16384 x 16384
DisplayPort-0 connected (normal left inverted right x axis y axis)
   3840x2160     60.00 +  50.00    59.94    30.00    25.00    24.00    29.97    23.98  
HDMI-A-0 connected (normal left inverted right x axis y axis)
   3840x2160     60.00 + 120.00   100.00    96.02    72.00    60.00    50.00    48.00   119.88    50.00    59.94    30.00    25.00    24.00    29.97    23.98  
HDMI-A-1 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 1600mm x 900mm
   3840x2160     60.00 + 120.00*  100.00    96.02    72.00    60.00    50.00    48.00   119.88    50.00    59.94    30.00    25.00    24.00    29.97    23.98 
Image
A woman typing on a laptop with LM20.3 Cinnamon.
kernelcrunch
Level 1
Level 1
Posts: 16
Joined: Thu Sep 23, 2021 2:37 am
Location: Dallas, TX

Re: Change display settings via command line (?)

Post by kernelcrunch »

SMG wrote: Thu Jun 01, 2023 10:27 pm How are you "switching" between them?
(Sorry for the delay in replying) All three are always connected. I am not using a KVM switch. I don't believe there are any KVM swtiches that will not degrade the 4K/120Mhz resolution of one or all the displays. I change between the 1 display vs the other 2 displays by using the Cinnamon Display Utility (in the UI) to turn them off/on and rearrange each time (as shown in my two screenshots).
SMG wrote: Thu Jun 01, 2023 10:27 pm I'm guessing this output is from when you are only using #1?
Correct, I ran this xrandr output when I was using just the one display.

To add, I will always either run them in just one of two ways:

Display 1 @ 3840x2160, 120Hz, Primary
-or-
Display 2 @ 3840x2160, 120Hz
Display 3 @ 3840x2160, 60Hz - Primary
User avatar
SMG
Level 25
Level 25
Posts: 31760
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: Change display settings via command line (?)

Post by SMG »

kernelcrunch wrote: Sun Jun 04, 2023 9:21 am All three are always connected. I am not using a KVM switch.
In that case you will want to use xrandr commands. I do not know of a way to automate switching back and forth in the Display app for the scenario you want to use.

With xrandr you will be switching the monitors on (--auto) and --off. You may want to attach the commands to a launcher on your panel so all you have to do is click an icon to have the command run.

Here are some resources to help you. Let us know if you have any questions regarding the specifics of what you want to do.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
Locked

Return to “Cinnamon”