archlinux/i3/entrypoint

89 lines
1.7 KiB
Text
Raw Normal View History

2024-07-16 18:33:38 +00:00
#!/usr/bin/env bash
# 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 config/i3 config/menus
do
[ -d ~/.${dir} ] || mkdir -p ~/.${dir}/
done
2024-07-16 18:33:38 +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
if [ ! -f ~/.config/tigervnc/passwd ]
2024-07-16 18:33:38 +00:00
then
echo "${MYVNC_VNCPASS}" | vncpasswd -f >~/.config/tigervnc/passwd
chmod 0600 ~/.config/tigervnc/passwd
2024-07-16 18:33:38 +00:00
fi
# Remove VNCPASS env
unset MYVNC_VNCPASS
# VNC xstartup
install /dev/stdin ~/.config/tigervnc/xstartup <<- xstartup
2024-07-16 18:33:38 +00:00
#!/usr/bin/env bash
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
cat >~/.config/tigervnc/config <<- vncconfig
2024-07-16 18:33:38 +00:00
session=i3
dpi=192
2024-07-16 18:33:38 +00:00
geometry=1920x1080
framerate=60
depth=32
${_MYVNC_VNCSHARING}
vncconfig
# Dolphin default apps fix
kbuildsycoca6
# i3 status
cat >~/.i3status.conf <<- 'i3status'
# i3status configuration file.
# see "man i3status" for documentation.
# It is important that this file is edited as UTF-8.
# The following line should contain a sharp s:
# ß
# If the above line is not correctly displayed, fix your editor first!
general {
colors = true
interval = 5
}
order += "tztime local"
tztime local {
format = "%Y-%m-%d %H:%M:%S"
}
i3status
# Launch Tigervnc
/usr/bin/dbus-launch vncserver :0