Skip to content

Instantly share code, notes, and snippets.

@meyt
Last active September 2, 2024 02:03
Show Gist options
  • Save meyt/c68f26140ba1b133d2714398a847da74 to your computer and use it in GitHub Desktop.
Save meyt/c68f26140ba1b133d2714398a847da74 to your computer and use it in GitHub Desktop.
Custom viewport size for Linux/Xorg

Due to backpack pressure, a dark shadow appread on my laptop screen like this:

┌────────────┬┬┬┬┬┬──────┐
│ ┌─terminal─┼┼┼┼┼┼────┐ │
│ │          ││││││    │ │
│ │          ││││││    │ │
│ │          ││││││    │ │
│ │          ││││││    │ │
│ │          ││││││    │ │
│ └──────────┼┼┼┼┼┼────┘ │
└────────────┴┴┴┴┴┴──────┘
                             

Now i need to limit the viewport area until the new screen arrives:

xrandr --output eDP-1 --mode 1920x1080 --fb 960x1080 --transform 1,0,0,0,1,0,0,0,1
  • eDP-1 is my laptop display name. you can find that using "xrandr"
  • 1920x1080 is the actual resolution
  • 960x1080 is the expected viewport size

Result:

┌────────────┬┬┬┬┬┬──────┐   
│ ┌temrinal┐ ││││││      │   
│ │        │ ││││││      │   
│ │        │ ││││││      │   
│ │        │ ││││││      │   
│ │        │ ││││││      │   
│ │        │ ││││││      │   
│ └────────┘ ││││││      │   
└────────────┴┴┴┴┴┴──────┘   
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment