Score:2

How to create a script to change the screen resolution? (Wayland)

lk flag

I just want to make a script to change my screen resolution. I found many guides to do that, but all of them are made for Xorg Display Server users and i could't find one for Wayland. My question is, there is any way to make a script for that using Wayland?
I want to change the main "XWAYLAND1" monitor to 1280x720 and back to 1920x1080. I'm using Ubuntu 22.10
xrandr output:

Screen 0: minimum 16 x 16, current 3360 x 1080, maximum 32767 x 32767
XWAYLAND1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 340mm x 190mm
   1920x1080     59.96*+
   1440x1080     59.99  
   1400x1050     59.98  
   1280x1024     59.89  
   1280x960      59.94  
   1152x864      59.96  
   1024x768      59.92  
   800x600       59.86  
   640x480       59.38  
   320x240       59.52  
   1680x1050     59.95  
   1440x900      59.89  
   1280x800      59.81  
   720x480       59.71  
   640x400       59.95  
   320x200       58.96  
   1600x900      59.95  
   1368x768      59.88  
   1280x720      59.86  
   1024x576      59.90  
   864x486       59.92  
   720x400       59.55  
   640x350       59.77  
   1280x720_60.00  60.00  
   1920x1080_60.00  60.00  
   1024x768_60.00  60.00  
XWAYLAND2 connected 1440x900+1920+0 (normal left inverted right x axis y axis) 410mm x 260mm
   1440x900      59.75*+
   1152x864      59.78  
   1024x768      59.68  
   800x600       59.47  
   640x480       59.38  
   320x240       59.52  
   1280x800      59.81  
   720x480       59.71  
   640x400       59.20  
   320x200       58.96  
   1368x768      59.71  
   1280x720      59.86  
   1024x576      59.58  
   864x486       59.45  
   720x400       59.55  
   640x350       58.91 

gtf 1280 720 60 output:

# 1280x720 @ 60.00 Hz (GTF) hsync: 44.76 kHz; pclk: 74.48 MHz
  Modeline "1280x720_60.00"  74.48  1280 1336 1472 1664  720 721 724 746  -HSync +Vsync

gtf 1920 1080 60 output:

# 1920x1080 @ 60.00 Hz (GTF) hsync: 67.08 kHz; pclk: 172.80 MHz
  Modeline "1920x1080_60.00"  172.80  1920 2040 2248 2576  1080 1081 1084 1118  -HSync +Vsync

pl flag
Does this answer your question? [Change screen resolution using the terminal (command line) in Wayland - Ubuntu 18.04](https://askubuntu.com/questions/1067018/change-screen-resolution-using-the-terminal-command-line-in-wayland-ubuntu-1)
EndRE32 avatar
lk flag
Sadly not, when i run the python file i get an error message:`ValueError: could not convert string to float: '60,000'` (I replaced the first line with this: `#!/usr/bin/env python3` )
ArrayBolt3 avatar
ls flag
@EndRE32 Try removing the quote marks from around the number.
EndRE32 avatar
lk flag
@ArrayBolt3 Hello, there are no quote marks around the number, i tried `float(rate[1:-1])` and the output was '9,88' from '59,887'
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.