KASM-1851 Disable Screensaver

- Utilize xinitrc scripts to disbale X screensaver
- Utilize colordepth env var instead of hardcoded value
This commit is contained in:
Justin Travis 2021-08-12 17:05:32 -04:00
parent b5cf973c59
commit 84fd2059eb
3 changed files with 36 additions and 7 deletions

View File

@ -57,7 +57,7 @@ function start_kasmvnc (){
rm -rf $HOME/.vnc/*.pid
vncserver $DISPLAY -depth 24 -geometry $VNC_RESOLUTION -websocketPort $NO_VNC_PORT -cert ${HOME}/.vnc/self.pem -httpd ${KASM_VNC_PATH}/www -sslOnly -FrameRate=$MAX_FRAME_RATE -interface 0.0.0.0 $VNCOPTIONS
vncserver $DISPLAY -depth $VNC_COL_DEPTH -geometry $VNC_RESOLUTION -websocketPort $NO_VNC_PORT -cert ${HOME}/.vnc/self.pem -httpd ${KASM_VNC_PATH}/www -sslOnly -FrameRate=$MAX_FRAME_RATE -interface 0.0.0.0 $VNCOPTIONS
KASM_PROCS['kasmvnc']=$(cat $HOME/.vnc/*${DISPLAY_NUM}.pid)

View File

@ -3,11 +3,6 @@ set -e
echo -e "\n------------------ Xfce4 window manager startup------------------"
### disable screen saver and power management
xset -dpms &
xset s noblank &
xset s off &
if [ "${START_XFCE4}" == "1" ] ;
then
echo "Starting XFCE"

View File

@ -14,6 +14,32 @@ get_rid_of_xfce_battery_widget() {
yum remove -y xfce4-power-manager
}
config_xinit_disable_screensaver() {
mkdir -p /etc/X11/xinit/xinitrc.d/
cat >/etc/X11/xinit/xinitrc.d/disable_screensaver.sh <<EOL
#!/bin/sh
set -x
xset -dpms
xset s off
xset q
EOL
chmod +x /etc/X11/xinit/xinitrc.d/disable_screensaver.sh
}
replace_default_xinit() {
cat >/etc/X11/xinit/xinitrc <<EOL
#!/bin/sh
for file in /etc/X11/xinit/xinitrc.d/* ; do
. \$file
done
. /etc/X11/Xsession
EOL
chmod +x /etc/X11/xinit/xinitrc
}
echo "Install Xfce4 UI components"
if [ "$DISTRO" != "centos" ]; then
apt-get update
@ -43,6 +69,14 @@ else
apt-get clean -y
fi
if [ "$DISTRO" = "centos" ]; then
config_xinit_disable_screensaver
else
replace_default_xinit
config_xinit_disable_screensaver
fi
# Override default login script so users cant log themselves out of the desktop dession
cat >/usr/bin/xfce4-session-logout <<EOL
#!/usr/bin/env bash
@ -72,4 +106,4 @@ cat >>/etc/xdg/Thunar/accels.scm<<EOL
(gtk_accel_path "<Actions>/ThunarLauncher/delete" "Delete")
(gtk_accel_path "<Actions>/ThunarLauncher/trash-delete-2" "")
(gtk_accel_path "<Actions>/ThunarLauncher/trash-delete" "")
EOL
EOL