Skip to content

Commit 68437e5

Browse files
committed
Server: Allow X cleanup script to be specified
Referring to #490, it is necessary to set $userDBus=1; in turbovncserver.conf to prevent GNOME shell issues with the Cinnamon window manager on Mint 22.3 or Ubuntu 24.04. However, with this configuration, cinnamon-session fails to shut down when Xvnc is killed. I observed this issue with TigerVNC's systemd-friendly vncsession approach as well, although the OP did not. This commit introduces a new $xcleanup variable that allows an optional X cleanup script to be specified. If specified, vncserver executes the X cleanup script just before attempting to kill Xvnc. Specifying $xcleanup="cinnamon-session-quit --logout --no-prompt"; in turbovncserver.conf effectively works around the issue with Cinnamon.
1 parent 340633a commit 68437e5

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

unix/turbovncserver.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@
6565
## [equivalent of -x509key command-line option]
6666
## $xstartup -- path to alternative X startup script
6767
## [equivalent of -xstartup command-line option]
68+
## $xcleanup -- path to optional X cleanup script to execute before Xvnc is
69+
## killed
6870
##
6971

7072
## These settings are the default. Uncomment and edit to change.
@@ -86,6 +88,7 @@
8688
# $vncUserDir = "$ENV{HOME}/.vnc";
8789
# $wm = "";
8890
# $xstartup = "${exedir}xstartup.turbovnc";
91+
# $xcleanup = "";
8992

9093
## Here is an example of setting the font path:
9194
#

unix/vncserver.in

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env perl
22
#
3-
# Copyright (C) 2009-2018, 2020-2022, 2024-2025 D. R. Commander.
3+
# Copyright (C) 2009-2018, 2020-2022, 2024-2026 D. R. Commander.
44
# All Rights Reserved.
55
# Copyright (C) 2021 Steffen Kieß
66
# Copyright (C) 2010 University Corporation for Atmospheric Research.
@@ -1082,6 +1082,11 @@ sub Kill
10821082
}
10831083
}
10841084

1085+
if ($xcleanup) {
1086+
warn "Running X cleanup script $xcleanup\n";
1087+
system("$xcleanup");
1088+
}
1089+
10851090
unless (-r $pidFile) {
10861091
die "\nCan't find file $pidFile\n".
10871092
"You'll have to kill the Xvnc process manually\n\n";
@@ -1303,7 +1308,8 @@ sub ReadConfiguration
13031308
wm
13041309
x509CertFile
13051310
x509KeyFile
1306-
xstartup);
1311+
xstartup
1312+
xcleanup);
13071313

13081314
if (open CONF, "<$configFile") {
13091315
while (<CONF>) {

0 commit comments

Comments
 (0)