94 lines
2.8 KiB
Bash
Executable File
94 lines
2.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
if [ "$XDG_SESSION_TYPE" != "wayland" ]; then
|
|
printf "\033[1;33mWARNING:\033[0m Windowing system is %s\n" "$XDG_SESSION_TYPE"
|
|
printf "\033[1;33mWARNING:\033[0m Virtual display functionality requires Wayland\n"
|
|
fi
|
|
|
|
USER_HOME=$(realpath ~)
|
|
|
|
if [ -z "$XDG_BIN_HOME" ]; then
|
|
XDG_BIN_HOME="$USER_HOME/.local/bin"
|
|
fi
|
|
|
|
if [ -d "$XDG_BIN_HOME" ]; then
|
|
# check ownership and permissions before doing chown and chmod
|
|
XDG_BIN_USER=$(stat -c %U $XDG_BIN_HOME)
|
|
XDG_BIN_GROUP=$(stat -c %G $XDG_BIN_HOME)
|
|
|
|
USER=$(whoami)
|
|
GROUP=$(id -gn)
|
|
|
|
if [ "$XDG_BIN_USER" != "$USER" ] || [ "$XDG_BIN_GROUP" != "$GROUP" ]; then
|
|
echo "Fixing ownership and permissions of $XDG_BIN_HOME"
|
|
sudo chown -R $USER:$GROUP $XDG_BIN_HOME
|
|
sudo chmod -R 700 $XDG_BIN_HOME
|
|
fi
|
|
fi
|
|
|
|
UA_EVENT_NAME="breezy_kwin_install"
|
|
if [ -e "$XDG_BIN_HOME/breezy_kwin_uninstall" ]; then
|
|
echo "Cleaning up the previous installation"
|
|
|
|
# ` || true` will ensure that this can't cause a failure, even with `set -e`
|
|
$XDG_BIN_HOME/breezy_kwin_uninstall --for-install || true
|
|
|
|
UA_EVENT_NAME="breezy_kwin_update"
|
|
fi
|
|
|
|
UA_CLIENT_ID="BreezyKWin"
|
|
UA_EVENT_VERSION="$1"
|
|
#INJECT_UA_CALL
|
|
|
|
tar -xf $(pwd)/breezyKWinPlugin.tar.gz
|
|
pushd breezy_desktop/usr > /dev/null
|
|
|
|
echo "Copying KWin plugin files to $USER_HOME/.local/{lib,share}"
|
|
|
|
# locate the lib path that ends with qt6/plugins (handles multiarch dirs)
|
|
QT_PLUGIN_DIR_RELATIVE=$(find lib -type d -path '*/qt6/plugins' -print -quit 2>/dev/null || true)
|
|
if [ -z "$QT_PLUGIN_DIR_RELATIVE" ]; then
|
|
QT_PLUGIN_DIR_RELATIVE="lib/qt6/plugins"
|
|
fi
|
|
|
|
# directory structure matches XDG, so just recursive copy
|
|
chmod -R 755 .
|
|
cp -r . "$USER_HOME/.local/"
|
|
|
|
popd > /dev/null
|
|
|
|
cp bin/breezy_kwin_uninstall $XDG_BIN_HOME
|
|
|
|
# Install QT_PLUGIN_PATH snippet into ~/.bash_profile if not present
|
|
BASH_PROFILE="$HOME/.bash_profile"
|
|
QT_PLUGIN_DIR="$HOME/.local/$QT_PLUGIN_DIR_RELATIVE"
|
|
QT_PLUGIN_EXPORT="export QT_PLUGIN_PATH=\"$QT_PLUGIN_DIR\""
|
|
if [[ ! -f "$BASH_PROFILE" ]] || ! grep -Fq "$QT_PLUGIN_EXPORT" "$BASH_PROFILE" 2>/dev/null; then
|
|
echo "Adding QT_PLUGIN_PATH to $BASH_PROFILE"
|
|
mkdir -p "$(dirname "$BASH_PROFILE")"
|
|
cat >> "$BASH_PROFILE" <<EOF
|
|
|
|
# Added by Breezy Desktop installer: QT plugin path setup
|
|
if [ -n "\$QT_PLUGIN_PATH" ]; then
|
|
export QT_PLUGIN_PATH="$QT_PLUGIN_DIR:\$QT_PLUGIN_PATH"
|
|
else
|
|
export QT_PLUGIN_PATH="$QT_PLUGIN_DIR"
|
|
fi
|
|
EOF
|
|
fi
|
|
|
|
# set up the XR driver using the local binary
|
|
echo "Installing xrDriver (requires sudo)"
|
|
echo "BEGIN - xr_driver_setup"
|
|
if [ -z "$1" ]
|
|
then
|
|
sudo bin/xr_driver_setup $(pwd)/xrDriver.tar.gz
|
|
else
|
|
sudo bin/xr_driver_setup -v $1 $(pwd)/xrDriver.tar.gz
|
|
fi
|
|
|
|
echo "END - xr_driver_setup"
|
|
|
|
printf "\n\033[1;33m!!! IMPORTANT !!!\033[0m You must log out and back in, then enable Breezy Desktop from the Desktop Effects in System Settings\n\n" |