7

The very top of the physical monitor is obscured by a bezel (don't ask!). I want to use xrandr to redefine actual size of the desktop and so it only uses the usable portion of the monitor.

The actual pixel dimensions of the monitor is 2880x1920 but the top (say) 20 rows are not usable. (Actually it's less but I'll have to experiment). So I want a desktop that's 2880x1900 and set the monitor position such that the desktop is displayed on the monitor starting at row 20 and continuing to the bottom.

I think that means I need to use --pos +0-20 but I get:

$ xrandr  --output eDP-1 --pos +0-20
xrandr: failed to parse '+0-20' as a position

And I've tried other variations:

$ xrandr --fb 2880x1900 --output eDP-1 --size 2880x1900+0+20
xrandr: specified screen 2880x1900 not large enough for output eDP-1 (2880x1920+0+0)

This is very similar to an existing question How to use only part of a monitor for display but that user was asking about Windows and everyone suggests just using the window manager. That would get tiresome pretty quickly given that this is going to be always and for every workspace. I'm looking for a more fundamental solution.

Actually it looks like I'm wrong about it being less than 20 pixel rows.

I've found this:

$ xrandr --output eDP-1 --transform 1,0,0,0,1,-30,0,0,1 

does move the output down just right so that the top isn't cut off. Unfortunately now the whole desktop framebuffer extends below the visible screen. I could add a scale factor to that transform but I would rather just resize the desktop so that the bottom of the desktop lands at the bottom of the monitor.

6
  • 1
    Is a monitor only or a TV? If the latter what you're noticing is called "overscanning". That being the case you can adjust in the monitor/TV itself.
    – user931000
    May 10, 2019 at 16:21
  • 1
    It's a laptop lcd screen. I don't think overscan makes any sense for digital signals and LCD screens. It's a property of CRTs that need retrace time and sync pulses.
    – Greg S
    May 12, 2019 at 12:36
  • It doesn't make sense in a laptop's screen and it means it's either defective or being forced a wrong resolution. But what I mentioned is not about CRTs (of which I barely remember), it is all about modern TVs that often need a certain mode to be changed for computers, otherwise the image "bleeds out".
    – user931000
    May 12, 2019 at 15:55
  • Here's a recent example: superuser.com/a/1435957/931000 but of course, it isn't applicable to internal monitors. Posting this only to illustrate what I meant in the first comment.
    – user931000
    May 12, 2019 at 23:16
  • 1
    IIRC there's a similar question either here or on unix.stackexchange, and the TL;DR is: you can't. If your driver supports specifying overscan, that may be an alternative.
    – dirkt
    Oct 22, 2019 at 13:55

4 Answers 4

5
+300

My configuration:

  • Intel Celeron NUC
  • Ubuntu 18.04.3 LTS
  • Intel i915 drivers (integrated video)
  • HDMI output to an old LCD TV

What didn't work:

  • Driver has no support for over/underscan properties in xrandr
  • Custom video modes still extended past the edges of the monitor

What DID work:

xrandr --output "HDMI-2" --fb 1800x1000 --transform 1,0,-60,0,1,-30,0,0,1

--fb 1800x1000 sets the display area. Using this setting by itself will give you a large margin on the right and bottom, but does not center the image.

--transform 1,0,-60,0,1,-40,0,0,1 shifts the displayed image to the right by 60 pixels (the -60) and down by 40 pixels (the -40).

Combined together, my screen has a 60 pixel left margin, 1800 pixel wide display, and another 60 pixel right margin for a total with of 1920. Vertically, I have a 40 pixel top margin, a 1000 pixel tall display, and a 40 pixel bottom margin for a total of 1080.

I still get the warning:

xrandr: specified screen 1800x1000 not large enough for output HDMI-2 (1920x1080+-60+-40)

However the frame buffer still gets resized and the transform is still applied so that the edges of the screen are no longer extended past the end of the monitor.

Errorlevel after the xrandr is zero (meaning it worked without error) even through the above warning message is displayed.

This is the solution that worked for me, and being on an Intel integrated video driver instead of the more advanced nVidia or Radeon drivers, it's the only solution that's work so far.

For your resolution, I'd suggesting using a way smaller --fb to start with:

xrandr --output eDP-1 --fb 2400x1800 

Then play with the transforms to get the top left corner visible.

Then figure out what you can expand your framebuffer to keep your right edge and bottom edge visible.

None of this changes resolution, your screen is stil 2880x1920. You're just changing the screen size and shifting the screen down and to the right.

5
  • Alas, this does not work for me. My native resolution is 1920x1200. Let's say I want to crop off 10px on the left and 10px on the right; I'd do xrandr --output DP-5 --fb 1900x1200 --transform 1,0,-10,0,1,0,0,0,1. But apart from the "specified screen 1900x1200 not large enough for output DP-5" error, I also get "BadValue (integer parameter out of range for operation)" and an exit status of 1. I'm on Arch Linux by the way, latest Xorg and xrandr and everything, and using an NVIDIA graphics card with proprietary drivers.
    – Thomas
    Oct 25, 2019 at 7:43
  • Run xrandr with one setting at a time and find out which setting it's choking on. Example: xrandr --output DP-5 --fb 1900x1200 xrandr --output DP-5 --transform 1,0,-10,0,1,0,0,0,1
    – Dan
    Oct 26, 2019 at 11:09
  • Apparently it's the -10; if I put 10 it is accepted (but shifts to the left while I want to shift to the right, and I get panning at the edges). Additionally, if I add --fb 1900x1200 then the "not large enough for output" error appears.
    – Thomas
    Oct 26, 2019 at 14:36
  • If you can run 1920x1200 as a native resolution on your monitor, you shouldn't have overscan issues. Try changing resolution to 1920x1080 (standard HD) and use my xrandr line below: ```` xrandr --output HDMI-2 --fb 1920x1080 --panning 1960x1100 --transform 1.075,0,-60,0,1.08,-40,0,0, ````
    – Dan
    Oct 26, 2019 at 20:50
  • Here, have a bounty for actually trying it out for yourself instead of pointing to other answers, even though it didn't work for me.
    – Thomas
    Oct 30, 2019 at 7:06
0

I cannot test xrandr in my environment, but I remark that all the success stories that I have seen involved disabling the bottom part of the monitor, rather than the top, but the most striking part was that they all involved the creation of a new xrandr mode.

I have also found the post of How to disable bottom part of the screen with xrandr, where the poster, by trying to disable the bottom part of his monitor, found that he disabled instead the top part, and asked for help.

Nobody answered his post, but I reproduce below what that poster did, which might help with your problem:

So first I use cvt to get a new mode for xrandr with the new resolution calculated leaving the broken part of the screen out.

cvt 1366 700

Then use this to create a new mode with xrandr

xrandr --newmode 1368x700 77.00  1368 1432 1568 1768  700 703 713 727 -hsync +vsync

Then I setted this mode

xrandr --addmode eDP-1 1368x700
xrandr --output eDP-1 --mode 1368x700

But the part of the screen that gets disabled is the top part of the screen, not the bottom.

2
  • Alas, not working for me. Say I want to crop 10px on left and right of my 1920x1200 screen. cvt gives Modeline "1904x1200_60.00" 191.00 1904 2032 2232 2560 1200 1203 1213 1245 -hsync +vsync so I run xrandr --newmode 1904x1200 191.00 1904 2032 2232 2560 1200 1203 1213 1245 -hsync +vsync which works. However, xrandr --addmode DP-5 1904x1200 then gives me "X Error of failed request: BadMatch (invalid parameter attributes) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 18 (RRAddOutputMode)".
    – Thomas
    Oct 25, 2019 at 7:48
  • 1
    (1) This answer advises to edit it into xorg.conf manually. (2) This answer is about fitting the new mode within the maximum framebuffer size (may not pertain). (3) A huge troubleshooting answer is here.
    – harrymc
    Oct 25, 2019 at 7:54
0

After reading Greg S.'s questions carefully, I noticed:

I've found this:

$ xrandr --output eDP-1 --transform 1,0,0,0,1,-30,0,0,1

does move the output down just right so that the top isn't cut off. Unfortunately now the whole desktop framebuffer extends below the visible screen. I could add a scale factor to that transform but I would rather just resize the desktop so that the bottom of the desktop lands at the bottom of the monitor.

My answer doesn't quite address this issue.

Greg, I can only think of two ways to do what you want.

  • Use the scale transform to shrink the Y axes to squeeze the desktop onto the displayable area. However you mentioned you don't want to do this.

  • Other option is to place a desktop widget along the top edge that takes up the 20-30 pixels of unusable space (probably easiest on KDE).

Changing the --fb doesn't change the desktop size, it just limits the displayed image to the --fb size. Setting a new mode doesn't help, since it will start at the top of the screen which is blocked by your bezel.

If it were me, I'd either take a dremel tool to the top bezel or live with a compressed desktop:

xrandr --output eDP-1 --fb 2880x1920 --panning 2880x1950 --transform 1,0,0,0,1.02,-30,0,0,1 

If the command errors out, try without the --fb parameter.

0

After reading and testing all of these answers (and from anothers questions), I found a tricky way to achieve what you were looking for... that it is the same that I needed. I have a laptop with 200px of the left side totally lost (I think something hit the screen phisicaly). Screen is 1366x768. I needed to make a 1166x768 screen, with 200px of horizontal offset to the right. I did this script to run at startup:

#!/bin/bash
# This works for my laptop!
xrandr --output LVDS --mode 1366x768 --panning 1366x768 && sleep 5
xrandr --output LVDS --mode 1366x768 --panning 1166x768 --transform 1,0,-200,0,1,0,0,0,1

It's important to run both commands with a delay of some seconds (you can try with less time). I think the first command set the panning like the monitor resolution. To the naked eye, it does nothing. The second one makes a smaller screen and move it 200px to the right.

  • If I run xrandr --output LVDS --mode 1366x768 --transform 1,0,-200,0,1,0,0,0,1 (without panning), screen moves 200px to right, but, even mouse doesn't go beyond display limitations, desktop does. I maximize a window and min-max-close buttons are lost: invisibles and unreachables.

  • If I run the second command without the first one, it doesn't work, it shows me an error. The only way to achieve it is by running both commands, one after the other.

For your need, you have to play with --mode, --panning and --transform values, but I think this would be right for you:

#!/bin/bash
# This *may* works for you.
xrandr --output LVDS --mode 2880x1920 --panning 2880x1920 && sleep 5
xrandr --output LVDS --mode 2880x1920 --panning 2880x1900 --transform 1,0,0,0,1,-20,0,0,1

Hope this helps you or someone else.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.