KDE Resolution Question

I have a laptop with a 4k screen and the monitor on my desk is 2k. If I plug my laptop into the monitor it really messes up my panels and widgets. Unplug it from the monitor and the panels go back to where they should, but I need to move the widgets back in place.

Is there any way to handle desktop monitor resolution changes gracefully like this on the fly? I don’t need to dock/un-dock the laptop from my monitor frequently, so having a “low res” user account is what I’m doing to get around this right now. Just wondering if there is a better way.

Have you tried locking the widgets? Doing so should also lock the panels at the same time.

Yeah they are locked. since the monitor has lower resolution than my laptop, it’s just moving stuff around so that you can still see the screen on the monitor. Which makes sense, it stays garbled up when I unplug the monitor.
I guess I would need a way to switch between desktop configs for a single user, which I don’t think is possible. I don’t do a ton of tweaking, so a low rez user account is really only a bummer for any steam/wine games that have already installed in my original users home.

Hello,
Might help to post " Dump your inxi -Fxzc0 here and bookmark it"

Then this may be a stupid question, but what happens when you use the FN+ whatever FKey allows you to switch between monitors? Usually this will set the monitor correctly with the desktop, but if one is smaller, different resolutions, then it may cause issues, it will only output whatever resolution your laptop monitor will handle.

However if you set the monitor as primary, and close the lid on the laptop, then the desktop should scale to whatever the monitor will allow.

Thanks
Yawanathan

Tried ‘Systems Settings’ --> Display and Monitor ?
I don’t know if you use Unified Screen or Break Screen, but both allows you to to change resolution in each. Normally we don’t have to do that. KDE just use what’s best in each. Maybe you set it to be fixed.
Try Default or Reset.

ps: unless somebody here says the kde system settings cannot handle 4K screen yet.

i dont have a dual/multi-monitor setup but isn’t this easily handled with arandr? or a multihead xorg configuration? arandr would be easier i would think and lets you assign settings to each display separately.

A new tool has just been released for this type of setup … dpi switcher.

It is still very new and probably a little buggy, but your use case seems to fit this little tool perfectly.

My use case: This tool came into existence when I switched to a 13" HiDPI laptop while still using non HiDPI external monitors. Laptop needed 1.5 scaling to be optimally usable (or at least according to my preferences) while the external monitors work fine with 1.0 scaling.

Each time I would undock the laptop and work for more than a couple of minutes I would have to manually change screen scaling on system settings, unlock widgets, resize panel, change cursor size then log out. And all of this was to be repeated again when the laptop is docked.

It is only cli currently but apparently a gui frontend is planned.

Thanks for all the responses!

Dual monitors actually works decent because my monitor scales down the video signal (much more cleanly than xrandr), but I don’t have enough room for dual display - it’s one or the other.

xrander/arander do scale the display, but this results in blurry text and panel dimensions aren’t scaled the same amount for some reason.

The DPI switcher that sueridgepipe linked is exactly what I’m looking for. I also figured out how to switch back and fourth more gracefully manually (just change display scaling and cursor size and log in/out).

I found a bug in the software, but it appears to have already been reported - I had to manually make my profiles, other than that it works.

Just in case this will spur more discussion, here is inxi -Fxc0

System:    Host: nicks-pc Kernel: 5.0.3-1-MANJARO x86_64 bits: 64 compiler: gcc v: 8.2.1 
           Desktop: KDE Plasma 5.15.3 Distro: Manjaro Linux 
Machine:   Type: Convertible System: HP product: HP Spectre Convertible v: N/A serial: <filter> 
           Mobo: HP model: 827F v: 95.10 serial: <filter> UEFI: American Megatrends v: F.36 
           date: 04/24/2018 
Battery:   ID-1: BAT0 charge: 74.6 Wh condition: 74.6/74.6 Wh (100%) model: HP Primary status: Full 
CPU:       Topology: Quad Core model: Intel Core i7-8550U bits: 64 type: MT MCP arch: Kaby Lake rev: A 
           L2 cache: 8192 KiB 
           flags: lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 31880 
           Speed: 800 MHz min/max: 400/4000 MHz Core speeds (MHz): 1: 800 2: 800 3: 800 4: 800 5: 800 
           6: 800 7: 800 8: 800 
Graphics:  Device-1: Intel UHD Graphics 620 vendor: Hewlett-Packard driver: i915 v: kernel bus ID: 00:02.0 
           Device-2: NVIDIA GP108M [GeForce MX150] driver: N/A bus ID: 01:00.0 
           Display: x11 server: X.Org 1.20.4 driver: intel resolution: 2560x1440~60Hz 
           OpenGL: renderer: Mesa DRI Intel UHD Graphics 620 (Kabylake GT2) v: 4.5 Mesa 18.3.4 
           direct render: Yes 
Audio:     Device-1: Intel Sunrise Point-LP HD Audio vendor: Hewlett-Packard driver: snd_hda_intel 
           v: kernel bus ID: 00:1f.3 
           Sound Server: ALSA v: k5.0.3-1-MANJARO 
Network:   Device-1: Intel Wireless 8265 / 8275 driver: iwlwifi v: kernel port: f040 bus ID: 3b:00.0 
           IF: wlo1 state: up mac: <filter> 
Drives:    Local Storage: total: 594.33 GiB used: 32.94 GiB (5.5%) 
           ID-1: /dev/nvme0n1 vendor: Toshiba model: KXG50ZNV512G size: 476.94 GiB 
           ID-2: /dev/sda type: USB vendor: A-Data model: USB Flash Drive size: 117.39 GiB 
Partition: ID-1: / size: 75.08 GiB used: 32.89 GiB (43.8%) fs: ext4 dev: /dev/nvme0n1p8 
           ID-2: swap-1 size: 9.31 GiB used: 0 KiB (0.0%) fs: swap dev: /dev/nvme0n1p6 
Sensors:   System Temperatures: cpu: 40.0 C mobo: N/A 
           Fan Speeds (RPM): N/A 
Info:      Processes: 212 Uptime: 1h 12m Memory: 15.54 GiB used: 1.58 GiB (10.2%) Init: systemd Compilers: 
           gcc: 8.2.1 Shell: bash v: 5.0.0 inxi: 3.0.32 

I was inspired by maldoinc’s plasma-dpi-switcher. I originally had some success, but got blocked by bugs.

I did manage to create some really crude python scripts that change the display scaling factor, cursor size, and text DPI - executing them via bash let’s me change variables and log out in one line. It does nothing for panel and widgets, so maldoinc’s tool is way better if it works.

I’ll share my hack foranyone who is interested.

python for HiDPI (HiDPI.py)

import os
CONFIG_KDEGLOBALS = os.path.expanduser('~/.config/kdeglobals')
CONFIG_KCMFONTS = os.path.expanduser('~/.config/kcmfonts')
CONFIG_KCMINPUT = os.path.expanduser('~/.config/kcminputrc')
CONFIG_STARTUP = os.path.expanduser('~/.config/startupconfig')
# EDIT THE STARTUP CONFIG
# Read in the file
with open(CONFIG_STARTUP, 'r') as file :
  filedata = file.read()

# Replace the target string
filedata = filedata.replace('kcminputrc_mouse_cursorsize=24', 'kcminputrc_mouse_cursorsize=48')
filedata = filedata.replace('kdeglobals_kscreen_scalefactor=1', 'kdeglobals_kscreen_scalefactor=2')
filedata = filedata.replace('eDP1=1;DP1=1;DP2=1;HDMI1=1;VIRTUAL1=1;', 'eDP1=2;DP1=2;DP2=2;HDMI1=2;VIRTUAL1=2;')
filedata = filedata.replace('kcmfonts_general_forcefontdpi=96', 'kcmfonts_general_forcefontdpi=216')

# Write the file out again
with open(CONFIG_STARTUP, 'w') as file:
  file.write(filedata)

# EDIT THE KCMINPUT
# Read in the file
with open(CONFIG_KCMINPUT, 'r') as file :
  filedata = file.read()

# Replace the target string
filedata = filedata.replace('cursorSize=24', 'cursorSize=48')

# Write the file out again
with open(CONFIG_KCMINPUT, 'w') as file:
  file.write(filedata)

# EDIT THE KCMFONTS
# Read in the file
with open(CONFIG_KCMFONTS, 'r') as file :
  filedata = file.read()

# Replace the target string
filedata = filedata.replace('forceFontDPI=96', 'forceFontDPI=216')

# Write the file out again
with open(CONFIG_KCMFONTS, 'w') as file:
  file.write(filedata)

# EDIT THE KDEGLOBAL
# Read in the file
with open(CONFIG_KDEGLOBALS, 'r') as file :
  filedata = file.read()

# Replace the target string
filedata = filedata.replace('ScaleFactor=1', 'ScaleFactor=2')
filedata = filedata.replace('ScreenScaleFactors=eDP1=1;DP1=1;DP2=1;HDMI1=1;VIRTUAL1=1;', 'ScreenScaleFactors=eDP1=2;DP1=2;DP2=2;HDMI1=2;VIRTUAL1=2;')

# Write the file out again
with open(CONFIG_KDEGLOBALS, 'w') as file:
  file.write(filedata)

python for LoDPI (LoDPI.py)


import os
CONFIG_KDEGLOBALS = os.path.expanduser('~/.config/kdeglobals')
CONFIG_KCMFONTS = os.path.expanduser('~/.config/kcmfonts')
CONFIG_KCMINPUT = os.path.expanduser('~/.config/kcminputrc')
CONFIG_STARTUP = os.path.expanduser('~/.config/startupconfig')
# EDIT THE STARTUP CONFIG
# Read in the file
with open(CONFIG_STARTUP, 'r') as file :
  filedata = file.read()

# Replace the target string
filedata = filedata.replace('kcminputrc_mouse_cursorsize=48', 'kcminputrc_mouse_cursorsize=24')
filedata = filedata.replace('kdeglobals_kscreen_scalefactor=2', 'kdeglobals_kscreen_scalefactor=1')
filedata = filedata.replace('eDP1=2;DP1=2;DP2=2;HDMI1=2;VIRTUAL1=2;', 'eDP1=1;DP1=1;DP2=1;HDMI1=1;VIRTUAL1=1;')
filedata = filedata.replace('kcmfonts_general_forcefontdpi=192', 'kcmfonts_general_forcefontdpi=96')

# Write the file out again
with open(CONFIG_STARTUP, 'w') as file:
  file.write(filedata)

# EDIT THE KCMINPUT
# Read in the file
with open(CONFIG_KCMINPUT, 'r') as file :
  filedata = file.read()

# Replace the target string
filedata = filedata.replace('cursorSize=48', 'cursorSize=24')

# Write the file out again
with open(CONFIG_KCMINPUT, 'w') as file:
  file.write(filedata)

# EDIT THE KCMFONTS
# Read in the file
with open(CONFIG_KCMFONTS, 'r') as file :
  filedata = file.read()

# Replace the target string
filedata = filedata.replace('forceFontDPI=216', 'forceFontDPI=96')

# Write the file out again
with open(CONFIG_KCMFONTS, 'w') as file:
  file.write(filedata)

# EDIT THE KDEGLOBAL
# Read in the file
with open(CONFIG_KDEGLOBALS, 'r') as file :
  filedata = file.read()

# Replace the target string
filedata = filedata.replace('ScaleFactor=2', 'ScaleFactor=1')
filedata = filedata.replace('ScreenScaleFactors=eDP1=2;DP1=2;DP2=2;HDMI1=2;VIRTUAL1=2;', 'ScreenScaleFactors=eDP1=1;DP1=1;DP2=1;HDMI1=1;VIRTUAL1=1;')

# Write the file out again
with open(CONFIG_KDEGLOBALS, 'w') as file:
  file.write(filedata)

Execute LoDPI via bash

#! /bin/sh
python LoDPI.py
qdbus org.kde.ksmserver /KSMServer logout 0 0 0

Execute HiDPI via bash

#! /bin/sh
python HiDPI.py
qdbus org.kde.ksmserver /KSMServer logout 0 0 0

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.