feat[scripts]: add 'install_qtile' script

This commit is contained in:
Dennis Buchhorn 2023-07-13 19:37:17 +02:00
parent ffe0cf5ea4
commit fd057cc368

66
scripts/install_qtile Executable file
View File

@ -0,0 +1,66 @@
#!/bin/bash
echo "##########################################################################################"
echo "# install script for qtile window manager"
echo "# Dennis Buchhorn - code@b-eit.de"
echo "##########################################################################################"
echo ""
if ! [[ $(id -u) == "0" ]]; then
echo "The script need to be run as root!" >&2
exit 1
fi
if [[ $SUDO_USER ]]; then
REAL_USER=$SUDO_USER
else
REAL_USER=$(whoami)
fi
for ARG in "$@"; do
if [[ $ARG == "--repo-dir="* ]]; then
REPO_DIR=$(echo $ARG | cut -c 12-)
fi
done
## copied from https://github.com/JerrySM64/Qtile-Debian/blob/main/qtile-setup.sh
# Remove the EXTERNALLY-MANAGED file so pip works again
rm /usr/lib/python3.11/EXTERNALLY-MANAGED
# Install the full python 3 suite, pip, git and all dependencies
apt update
apt install python3-full python3-pip libpangocairo-1.0-0 python3-cffi python3-xcffib git -y
# Install cairocffi using pip
sudo -u $REAL_USER pip install --no-cache-dir cairocffi
if [[ $REPO_DIR == "" ]]; then
REPO_DIR="/home/$REAL_USER/qtile"
fi
sudo -u $REAL_USER mkdir -p $REPO_DIR
sudo -u $REAL_USER git clone https://github.com/qtile/qtile.git "$REPO_DIR"
cd "$REPO_DIR"
sudo -u $REAL_USER pip install .
# Create xsessions desktop file
tee << EOF /usr/share/xsessions/qtile.desktop > /dev/null
[Desktop Entry]
Name=Qtile
Comment=Qtile Session
Type=Application
Keywords=wm;tiling
Exec=/home/$REAL_USER/.local/bin/qtile start
EOF
# Create config for using qtile as xrdp desktop session and loading pulseaudio modules for xrdp
sudo -u $REAL_USER tee -a << EOF /home/$REAL_USER/.profile > /dev/null
## start preferred desktop environment via xrdp
[ -n "\$XRDP_SESSION" ] && export DESKTOP_SESSION=qtile
## load pulseaudio modules for xrdp
/usr/libexec/pulseaudio-module-xrdp/load_pa_modules.sh
EOF