Screen Resizing when part of the screen broken

×

Statusmeldung

You are not a member of this team. If you want to be part of this team, click on 'Subscribe to this team'.

Hi there!

I have discovered one thing today which made me pretty happy :)

I had received a Mac Book Air donated, which worked pretty good. The only problem was that the top part of the screen was broken, let say like 2 cm
I research to replace the screen but just the replacement is $300 :O

So after a small research in Internet I found this post
https://askubuntu.com/questions/261363/screen-resolution-repositioning-b...

Creating an script you can resize the screen at the start-up and the laptop is completly usefull now
(Before it was really anoying because you could not click on the top borders)

I leave the script here, in case they delete the post :)

#!/bin/bash

#change these 4 variables accordingly
ORIG_X=1280
ORIG_Y=800
NEW_X=1160
NEW_Y=800
###

X_DIFF=$(($NEW_X - $ORIG_X))
Y_DIFF=$(($NEW_Y - $ORIG_Y))

ORIG_RES="$ORIG_X"x"$ORIG_Y"
NEW_RES="$NEW_X"x"$NEW_Y"

ACTIVEOUTPUT=$(xrandr | grep -e " connected [^(]" | sed -e "s/\([A-Z0-9]\+\) connected.*/\1/")
MODELINE=$(cvt $NEW_X $NEW_Y | grep Modeline | cut -d' ' -f3-)

xrandr --newmode $NEW_RES $MODELINE
xrandr --addmode $ACTIVEOUTPUT $NEW_RES
xrandr --output $ACTIVEOUTPUT --fb $NEW_RES --panning $NEW_RES --mode $NEW_RES
xrandr --fb $NEW_RES --output $ACTIVEOUTPUT --mode $ORIG_RES --transform 1,0,$X_DIFF,0,1,$Y_DIFF,0,0,1

Kommentare

Bild des Benutzers jordi
Gespeichert von jordi am Mo, 04/19/2021 - 07:54

Juan, this is very interesting, and can really help save laptops that have slightly broken screen. Thanks very much for sharing!