Skip to content

danielrosehill/KScreen-Config-Scripts-And-Docs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kscreen Config Scripts For Multimonitor Control: KDE Plasma + Wayland

alt text

Some setup notes for multiscreen use on KDE + Wayland

Validated: Ubuntu 11-09

If you use multiple screens on Linux you don't want to have to reset your layouts persistently. In my experience, KDE can be spotty about maintaining your layouts, particularly (for some reason) when you go above 3 physical displays.

These are some notes and scripts to make things a bit more stable.

Stabilise your setup

Step 1: Go into display config (via the GUI) and get things set up as you like them and then apply.

If you're already in your working setup, the quick workaround is to just change one trivial value (like refresh rate), apply, change it back, reapply.

alt text

Recording this good config

Step 2:

Using kscreen-doctor record the params you are using.

To get a human readable:

kscreen-doctor -o

You can pipe to a txt like:

kscreen-doctor -o > myscreens.txt

Next, grab the JSON for this conifg. The operator is -j:

kscreen-doctor -j > myscreens.json

Recommendation: call your something descriptive like good-config.json

Recommedation 2: if you want to alternate between a couple of configs, set them up and repeat the process. I don't always want to use the mini display for IP cam viewing, so I exported one without it to no_ip_cam.json

Recommendation 3: save a 1 screen config for recovery if your system is messed up. This will simplify your workspace to one good (physical) output. If you have a Stream Deck or macropad on hand this can be really handy. Then you can just go back to your regular setup when you've fixed things.

Notes on Kscreen output

Some notes for others who (like me) like these things spelled out!

You'll notice that kscreen-doctor spits out a large JSON file that contains far more than just your active configs (as xrandr might). The export iterates through all the possible modes (resolutions).

To replicate a configuration reliably, however, you only need to know your desired configuration, of course.

Namely:

  • Which physical (GPU) port
  • Which mode we wish to set that output to
  • What position we wish to define that as - in X and Y

I have my four monitors set up in this order, left to right: HDMI-2, DP-1, DP-2, HDMI-1 (names simplified). You can rearrange your cables to make this more logical or just deal with the randomness.

alt text

The first three screens are displaying at 1920x1080 as they are 1080P. The furthest left screen has an offset of 0,0. Screen 1 (center) is 1920 pixels to the right of that (and no vertical offset); the right screen is 1920x2=3860. So its position is 3860,0.

Simply adjust these calculations based upon your displays and layouts.

Kscreen Doctor command syntax

Kscreen-doctor is atomic so you pass the whole config in one go.

By looking at your current setup and ignoring the modes you're not using, you can form the command needed to set this layout or force it back:

kscreen-doctor \
  output.HDMI-A-2.enable output.HDMI-A-2.mode.1920x1080@60 output.HDMI-A-2.position.0,0 \
  output.DP-1.enable output.DP-1.mode.1920x1080@60 output.DP-1.position.1920,0 \
  output.DP-2.enable output.DP-2.mode.1920x1080@60 output.DP-2.position.3840,0 \
  output.HDMI-A-1.enable output.HDMI-A-1.mode.1024x600@60 output.HDMI-A-1.position.5760,240 output.HDMI-A-1.rotation.inverted

Next, write a simple wrapper to it (see: default-laytout.sh)

Note: Kscreen does not include a parameter for screen priority.

Covering your bases

If (like me) you use the same specific monitor layout day to day, and that changes very infrequently, save the JSON you pulled out to a couple of places.

These are my recommendations (we'll use them later):

~/.local/share/kscreen

This is the default Kscreen directory.

So you can:

kscreen-doctor -j > ~/local/share/kscreen/default_config.json

Now, I'll create a folder for keybindings:

mkdir -p ~/scripts/keybindings/monitor-control

Nominate a test screen

If you've got multiple monitors and are working on this in the middle of your work day, pick one config to play around with to verify that the syntax and commands work.

About

Some scripts for saving good multiscreen configs for easy shortcutting and DPMS

Resources

Stars

Watchers

Forks

Languages