This forum has been archived. All content is frozen. Please use KDE Discuss instead.

HOWTO: Disabling compositing for VNC

Tags: None
(comma "," separated)
pablo
Registered Member
Posts
5
Karma
0
OS

HOWTO: Disabling compositing for VNC

Wed Feb 17, 2021 11:48 pm
highsciguy wrote:How to optimize KDE when VNC'ing


Hi everyone,

I realize this is an old thread. I stumbled upon it when I was trying to optimize VNC access. I figure others might too.

Use Cases
I only have one user remotely accessing my desktop.

On connect

  • Disable compositor
On disconnect

  • Enable compositor
  • Lock screen
  • Enable the display's power save - turn off the display
Implementation

VNC server
I use x11vnc. Its man page documents two arguments:

  • -afteraccept -- run a user supplied command after a client has been accepted and authenticated.
  • -gone -- the companion to the above, except when a client disconnects
In my PATH I have two shell scripts (more below):

  • vnc_client_connect
  • vnc_client_disconnect
Below is an invocation fragment of x11vnc:
Code: Select all
x11vnc -afteraccept 'vnc_client_connect &' -gone 'vnc_client_disconnect &' ...

Scripts
vnc_client_connect
Code: Select all
#!/bin/bash

#
# x11vnc hook script when a VNC cliient connects
#

compositing_off

exit 0

compositing_off
Code: Select all
#!/bin/bash

#
# Use qdbusviewer-qt5 to determine the three parameters
# to pass.
#

qdbus-qt5 org.kde.KWin /Compositor org.kde.kwin.Compositing.suspend

vnc_client_disconnect
Code: Select all
#!/bin/bash

#
# x11vnc hook script when a VNC cliient disconnects
#

compositing_on
lock_screen

exit 0

compositing_on
Code: Select all
#!/bin/bash

#
# Use qdbusviewer-qt5 to determine the three parameters
# to pass.
#

qdbus-qt5 org.kde.KWin /Compositor org.kde.kwin.Compositing.resume

lock_screen
Code: Select all
#!/bin/bash

#
# Lock my screen from the command line ... so I can use a pull-down
# menu ... too.
#
# I'm nearly certain that Kevin K. was instrumental with this
# solution so I'll give full credit to him.
#

# kde 3
# dcop kdesktop KScreensaverIface lock

# kde 4 < 4.10
# qdbus org.kde.krunner /ScreenSaver Lock

# kde 4.10
#
# https://bugzilla.redhat.com/show_bug.cgi?id=922690
#
qdbus-qt5 org.freedesktop.ScreenSaver /ScreenSaver Lock

sleep 5
xset -display :0.0 dpms force off &

exit $?


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]