2

I have a display and the right-most edge of my monitor is busted! So to make it work, I'm trying to somehow restrict my desktop to the pixels that actually work.

This would mean:

  • The pointer shouldn't enter the black region ever
  • Windows if maximized should take up only the pixels that work.

I use Ubuntu 13.10! Any terms that I can research would be great!

enter image description here

5

1 Answer 1

2

We will be using two tools to achieve our goal. The first is cvt and the second is xrandr.

FIRST you need to know how much space you want to trim and from what side of your screen. In my case, I had dead pixels at the top of my laptop screen, taking up about 20 pixels (guestimate) so I wanted to reduce the screen size at the top of my screen and them and not have them cover the top of title bars. I will walk you through how I did this, you can adopt it to fit your situation.

So I started with running xrandr so that I could see what size my display was

$ xrandr 
Screen 0: minimum 320 x 200, current 1280 x 800, maximum 32767 x 32767
LVDS1 connected primary 1280x800+0+0 (normal left inverted right x axis y axis) 331mm x 207mm
   1280x800       60.0*+   50.0  
   1024x768       60.0  
   800x600        60.3     56.2  
   640x480        60.0     59.9  
VGA1 disconnected (normal left inverted right x axis y axis)
TV1 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)

So the screen size is 1280x800

Since my estimate is that the pixels have taken up 20 pixels across the top of the screen, so the new value will be 1280x780.

SECOND: werun cvt so that we can get the 'magic values' for this size:

 $ cvt 1280 770
# 1280x770 59.91 Hz (CVT) hsync: 47.93 kHz; pclk: 79.75 MHz                                                                 
Modeline "1280x770_60.00"   79.75  1280 1344 1472 1664  770 773 783 800 -hsync +vsync

The important part is the one starting with "Modeline" - the values given in this line are the ones you will need to pass to xrandr so that it can cause the screen to display the new size. Xrandr does this using something called a "mode".

THIRD: It is time to make a new mode using the values we have gotten from cvt.

The command that allows us to do this (using the values I got above) looks like this:

$ xrandr --newmode 1280x770   79.75  1280 1344 1472 1664  770 773 783 800 -hsync +vsync

FOURTH: we add that new mode to the ones that are available in xrandr. This is done using the "--addmode" command in xrandr. In my particular case, I was adding it to the LVDS1.

So the command is going to be:

$ xrandr --addmode LVDS1 1280x770

FIFTH: We check whether the new mode has been added to xrandr. This is done using:

$ xrandr -q

I got:

    $ xrandr -q
Screen 0: minimum 320 x 200, current 1280 x 800, maximum 32767 x 32767
LVDS1 connected primary 1280x800+0+0 (normal left inverted right x axis y axis) 331mm x 207mm
   1280x800       60.0*+   50.0  
   1024x768       60.0  
   800x600        60.3     56.2  
   640x480        60.0     59.9  
   1280x770       59.9
VGA1 disconnected (normal left inverted right x axis y axis)
TV1 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)

You can see it has been added and is now listed at the bottom - 1280x770 59.9

So now time to run the new mode! We do this by running:

$ xrandr --output LVDS1 --mode 1280x770

The screen should go off and come back on with the new mode applied and the screen size reduced.

The result is a black bar across the top of the screen, with the mouse and applications using this as the boundary of the screen.

So now the last step is to have that command run at login so that I don't have to deal with it. The manner of doing so depends on your desktop and is beyond the scope of this answer.

1
  • Which part in this answer makes sure the “black bar” end up at the top of the screen (and not at the bottom for example)?—My solution positions the image anywhere you want. Commented Apr 25, 2023 at 23:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .