You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ublinux-init/ublinux/rc.desktop/deonly/xfce4-screensaver-fix

31 lines
1.3 KiB

#!/usr/bin/bash
#
# Author: Dmitry Razumov <asmeron@ublinux.com>
# Copyright (c) 2021-2025 UBLinux <support@ublinux.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
#
ENABLED=yes
[[ ${ENABLED} == "yes" ]] || { return 0 2>/dev/null && return 0 || exit 0; }
#. /etc/ublinux/config
# Если не загружен ни один драйвер видео KMS, то xfce4-screensaver закрываем, т.к. не правильно отрабатывает блокировка
sleep 5
if pidof -qx xfce4-screensaver; then
if ! lspci -k | grep -Ei -A 3 'VGA|3D' | grep -q 'Kernel driver in use:'; then
BLOBPS=$(ps -u $(id -u) -o pid= | xargs -I{} cat /proc/{}/environ 2>/dev/null | tr '\0' '\n')
DISPLAY=$(grep -m1 '^DISPLAY=' <<< "${BLOBPS}")
# XAUTHORITY=$(grep -m1 '^XAUTHORITY=' <<< "${BLOBPS}")
DBUS_SESSION_BUS_ADDRESS=$(grep -m1 '^DBUS_SESSION_BUS_ADDRESS=' <<< "${BLOBPS}")
# USER=$(cut -d/ -f3 <<< "${XAUTHORITY}")
# su -l ${USER} -c "${DISPLAY} ${XAUTHORITY} ${DBUS_SESSION_BUS_ADDRESS} xfce4-screensaver-command -i -r 'UBLinux fix: KMS video driver not loaded' &"
export ${DISPLAY}
export ${DBUS_SESSION_BUS_ADDRESS}
# xfce4-screensaver-command -i -r 'UBLinux fix: KMS video driver not loaded' &
xfce4-screensaver-command --exit
fi
fi