From fd057cc368b068aa474eea4e5f9dff52dc952c9d Mon Sep 17 00:00:00 2001 From: Dennis Buchhorn Date: Thu, 13 Jul 2023 19:37:17 +0200 Subject: [PATCH] feat[scripts]: add 'install_qtile' script --- scripts/install_qtile | 66 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 scripts/install_qtile diff --git a/scripts/install_qtile b/scripts/install_qtile new file mode 100755 index 0000000..2163f82 --- /dev/null +++ b/scripts/install_qtile @@ -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