archlinux/plasma/entrypoint

75 lines
1.4 KiB
Text
Raw Normal View History

2024-07-25 01:26:27 +00:00
#!/usr/bin/env bash
2025-01-21 00:50:32 +00:00
# Export all variables
set -a
# Abort if an error is encountered
set -e
# SSH config
if [ -f ~/.ssh/id_ed25519 ]
then
chmod 0600 ~/.ssh/id_ed25519
fi
# Create base directories
for dir in ssh config/tigervnc
do
[ -d ~/.${dir} ] || mkdir -p ~/.${dir}/
done
2024-07-25 01:26:27 +00:00
# Check for MYVNC_VNCPASS variable
if [ -z ${MYVNC_VNCPASS} ]
then
echo "MYVNC_VNCPASS env variable is missing"
exit 1
fi
# Configure tigervnc auth
2025-01-20 02:16:04 +00:00
if [ ! -f ~/.config/tigervnc/passwd ]
2024-07-25 01:26:27 +00:00
then
2025-01-20 02:16:04 +00:00
echo "${MYVNC_VNCPASS}" | vncpasswd -f >~/.config/tigervnc/passwd
chmod 0600 ~/.config/tigervnc/passwd
2024-07-25 01:26:27 +00:00
fi
# Remove VNCPASS env
unset MYVNC_VNCPASS
# VNC xstartup
2025-01-20 02:16:04 +00:00
install /dev/stdin ~/.config/tigervnc/xstartup <<- xstartup
#!/usr/bin/env bash
2024-07-25 01:26:27 +00:00
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec ${STARTXBIN}
xstartup
# Turn vnc sharing on/off
if [[ ${MYVNC_VNCSHARING} == "true" ]] || [[ ${MYVNC_VNCSHARING} == "1" ]]
then
_MYVNC_VNCSHARING=alwaysshared
else
_MYVNC_VNCSHARING=nevershared
fi
# VNC config
2025-01-20 02:16:04 +00:00
cat >~/.config/tigervnc/config <<- vncconfig
2024-07-25 01:26:27 +00:00
session=plasmax11
dpi=192
geometry=1920x1080
framerate=60
depth=32
${_MYVNC_VNCSHARING}
vncconfig
# Disable KDE screenlock
cat >~/.config/kscreenlockerrc <<- 'kscreenlockerrc'
[Daemon]
Autolock=false
LockOnResume=false
Timeout=0
kscreenlockerrc
2025-01-21 00:50:32 +00:00
# Read cli parameters, if any
exec "${@}" &
2025-01-21 00:50:32 +00:00
# Launch Tigervnc
/usr/bin/dbus-launch vncserver :0