diff --git a/bin/breezy_gnome_setup b/bin/breezy_gnome_setup index 31fe60b..fc0c3a0 100755 --- a/bin/breezy_gnome_setup +++ b/bin/breezy_gnome_setup @@ -18,6 +18,7 @@ check_command() { fi } +check_command "curl" check_command "gnome-shell" ARCH=$(uname -m) diff --git a/bin/package_gnome b/bin/package_gnome index b0e6c29..ce388c3 100755 --- a/bin/package_gnome +++ b/bin/package_gnome @@ -92,11 +92,13 @@ pushd $GNOME_DIR/src GNOME_MANIFEST_LINE=$(find -L . -type f ! -name "*.compiled" -exec sha256sum {} \; | sort | sha256sum | sed 's/ .*//') popd -FLATPAK_BUILD_ARTIFACT=ui/out/com.xronlinux.BreezyDesktop-$ARCH.flatpak -if [ ! -e "$FLATPAK_BUILD_ARTIFACT" ] || [ "$1" == "--rebuild-flatpak" ] || [ "$1" == "--rebuild-all" ]; then - ui/bin/package $ARCH +UI_BUILD_ARTIFACT=ui/out/breezyUI-$ARCH.tar.gz +if [ ! -e "$UI_BUILD_ARTIFACT" ] || [ "$1" == "--rebuild-ui" ] || [ "$1" == "--rebuild-all" ]; then + pushd ui + bin/package $ARCH + popd fi -cp $FLATPAK_BUILD_ARTIFACT $PACKAGE_DIR/com.xronlinux.BreezyDesktop.flatpak +tar -xf $UI_BUILD_ARTIFACT -C $PACKAGE_DIR # create manifest file for verifying installed file checksums against the originally packaged versions # include any file that doesn't get modified during setup (e.g. vkBasalt.json files) diff --git a/gnome/bin/breezy_gnome_uninstall b/gnome/bin/breezy_gnome_uninstall index 199bc03..4545d2d 100755 --- a/gnome/bin/breezy_gnome_uninstall +++ b/gnome/bin/breezy_gnome_uninstall @@ -36,8 +36,12 @@ rm -rf $DATA_DIR [ "$for_install" -eq 0 ] && echo "Uninstalling the breezydesktop@xronlinux.com GNOME extension" gnome-extensions uninstall breezydesktop@xronlinux.com -[ "$for_install" -eq 0 ] && echo "Uninstalling the Breezy Desktop UI Flatpak" -flatpak uninstall --user --noninteractive --force-remove com.xronlinux.BreezyDesktop +[ "$for_install" -eq 0 ] && echo "Uninstalling the Breezy Desktop UI application" +rm -rf $XDG_DATA_HOME/breezydesktop +rm -f $XDG_DATA_HOME/applications/com.xronlinux.BreezyDesktop.desktop +rm -f $XDG_DATA_HOME/icons/hicolor/*/apps/com.xronlinux.BreezyDesktop.png +rm -f $XDG_DATA_HOME/locale/*/LC_MESSAGES/breezydesktop.mo +rm -f $XDG_BIN_HOME/breezydesktop [ "$for_install" -eq 0 ] && echo "Uninstalling XRLinuxDriver" # if for-install diff --git a/gnome/bin/setup b/gnome/bin/setup index 7ee291a..e34efb5 100755 --- a/gnome/bin/setup +++ b/gnome/bin/setup @@ -9,8 +9,10 @@ check_command() { fi } -check_command "flatpak" check_command "gnome-extensions" +check_command "glib-compile-schemas" +check_command "update-desktop-database" +check_command "gtk-update-icon-cache" # This script gets packaged with the release and should do the bulk of the setup work. This allows this setup to be tied # to a specific release of the code, and guarantees it will never run along-side newer or older binaries. @@ -22,12 +24,11 @@ if [ -z "$XDG_DATA_HOME" ]; then fi XR_DRIVER_DATA_DIR="$XDG_DATA_HOME/xr_driver" GNOME_SHELL_DATA_DIR="$XDG_DATA_HOME/gnome-shell" -DATA_DIR="$XDG_DATA_HOME/breezy_gnome" +BREEZY_GNOME_DATA_DIR="$XDG_DATA_HOME/breezy_gnome" if [ -z "$XDG_BIN_HOME" ]; then XDG_BIN_HOME="$USER_HOME/.local/bin" fi -BIN_DIR="$XDG_BIN_HOME" if [ -d "$XDG_BIN_HOME" ]; then # check ownership and permissions before doing chown and chmod @@ -59,31 +60,40 @@ UA_EVENT_VERSION="$1" #INJECT_UA_CALL # escaping sed replace: https://stackoverflow.com/questions/407523/escape-a-string-for-a-sed-replace-pattern -ESCAPED_BIN_DIR=$(printf '%s\n' "$BIN_DIR" | sed -e 's/[\/&]/\\&/g') -ESCAPED_DATA_DIR=$(printf '%s\n' "$DATA_DIR" | sed -e 's/[\/&]/\\&/g') +ESCAPED_XDG_BIN_HOME=$(printf '%s\n' "$XDG_BIN_HOME" | sed -e 's/[\/&]/\\&/g') +ESCAPED_BREEZY_GNOME_DATA_DIR=$(printf '%s\n' "$BREEZY_GNOME_DATA_DIR" | sed -e 's/[\/&]/\\&/g') ESCAPED_XR_DRIVER_DATA_DIR=$(printf '%s\n' "$XR_DRIVER_DATA_DIR" | sed -e 's/[\/&]/\\&/g') ESCAPED_GNOME_SHELL_DATA_DIR=$(printf '%s\n' "$GNOME_SHELL_DATA_DIR" | sed -e 's/[\/&]/\\&/g') echo "Copying the breezy_gnome scripts to ${XDG_BIN_HOME}" mkdir -p $XDG_BIN_HOME cp bin/breezy_gnome_uninstall $XDG_BIN_HOME -sed -i -e "s/{bin_dir}/$ESCAPED_BIN_DIR/g" \ - -e "s/{data_dir}/$ESCAPED_DATA_DIR/g" \ +sed -i -e "s/{bin_dir}/$ESCAPED_XDG_BIN_HOME/g" \ + -e "s/{data_dir}/$ESCAPED_BREEZY_GNOME_DATA_DIR/g" \ -e "s/{xr_driver_data_dir}/$ESCAPED_XR_DRIVER_DATA_DIR/g" \ -e "s/{gnome_shell_data_dir}/$ESCAPED_GNOME_SHELL_DATA_DIR/g" \ bin/breezy_gnome_verify cp bin/breezy_gnome_verify $XDG_BIN_HOME -echo "Copying the manifest file to ${DATA_DIR}" -mkdir -p $DATA_DIR -cp manifest $DATA_DIR +echo "Copying the manifest file to ${BREEZY_GNOME_DATA_DIR}" +mkdir -p $BREEZY_GNOME_DATA_DIR +cp manifest $BREEZY_GNOME_DATA_DIR echo "Installing the breezydesktop@xronlinux.com GNOME extension" gnome-extensions install --force breezydesktop@xronlinux.com.shell-extension.zip -echo "Installing the Breezy Desktop UI Flatpak (this may take a couple minutes the first time)" -flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo -flatpak install --user --noninteractive --reinstall com.xronlinux.BreezyDesktop.flatpak +echo "Installing the Breezy Desktop UI application" +cp -r breezy_ui/data/* $XDG_DATA_HOME +cp -r breezy_ui/bin/* $XDG_BIN_HOME + +# update copied files to use the local XDG paths +ESCAPED_XDG_DATA_HOME=$(printf '%s\n' "$XDG_DATA_HOME" | sed -e 's/[\/&]/\\&/g') +sed -i -e "s/\/usr\/local\/share/$ESCAPED_XDG_DATA_HOME/g" $XDG_BIN_HOME/breezydesktop +sed -i "/Exec/c\Exec=$XDG_BIN_HOME/breezydesktop" $XDG_DATA_HOME/applications/com.xronlinux.BreezyDesktop.desktop + +glib-compile-schemas $XDG_DATA_HOME/glib-2.0/schemas +update-desktop-database $XDG_DATA_HOME/applications +gtk-update-icon-cache # set up the XR driver using the local binary echo "Installing xrDriver" diff --git a/ui/bin/package b/ui/bin/package index 6dd6beb..71c13ab 100755 --- a/ui/bin/package +++ b/ui/bin/package @@ -17,24 +17,41 @@ pushd $UI_BUILD_PATH meson compile popd -PACKAGE_SRC_DIR=$PACKAGE_DIR/src +# mimick the XDG directory structure in our archive file so setup can just copy the directories and not individual files +PACKAGE_DATA_DIR=$PACKAGE_DIR/data PACKAGE_BIN_DIR=$PACKAGE_DIR/bin -PACKAGE_ICONS_DIR=$PACKAGE_DIR/icons -mkdir -p $PACKAGE_SRC_DIR + +# these are all subdirectories of XDG_DATA_HOME +PACKAGE_BREEZY_DIR=$PACKAGE_DATA_DIR/breezydesktop +PACKAGE_BREEZY_SRC_DIR=$PACKAGE_BREEZY_DIR/breezydesktop +PACKAGE_ICONS_DIR=$PACKAGE_DATA_DIR/icons/hicolor +PACKAGE_LOCALE_DIR=$PACKAGE_DATA_DIR/locale +PACKAGE_APPS_DIR=$PACKAGE_DATA_DIR/applications +PACKAGE_SCHEMAS_DIR=$PACKAGE_DATA_DIR/glib-2.0/schemas + mkdir -p $PACKAGE_BIN_DIR +mkdir -p $PACKAGE_BREEZY_SRC_DIR mkdir -p $PACKAGE_ICONS_DIR +mkdir -p $PACKAGE_LOCALE_DIR +mkdir -p $PACKAGE_APPS_DIR +mkdir -p $PACKAGE_SCHEMAS_DIR -cp src/*.py $PACKAGE_SRC_DIR -cp -r po $BUILD_PATH -cp modules/PyXRLinuxDriverIPC/xrdriveripc.py $PACKAGE_SRC_DIR +cp src/*.py $PACKAGE_BREEZY_SRC_DIR +cp -L modules/PyXRLinuxDriverIPC/xrdriveripc.py $PACKAGE_BREEZY_SRC_DIR +cp $UI_BUILD_PATH/src/breezydesktop.gresource $PACKAGE_BREEZY_DIR +cp -r po/mo/* $PACKAGE_LOCALE_DIR +cp data/com.xronlinux.BreezyDesktop.gschema.xml $PACKAGE_SCHEMAS_DIR cp $UI_BUILD_PATH/src/breezydesktop $PACKAGE_BIN_DIR -cp $UI_BUILD_PATH/src/breezydesktop.gresource $PACKAGE_DIR -cp $UI_BUILD_PATH/data/com.xronlinux.BreezyDesktop.desktop $PACKAGE_DIR +cp $UI_BUILD_PATH/data/com.xronlinux.BreezyDesktop.desktop $PACKAGE_APPS_DIR -rsvg-convert data/icons/hicolor/scalable/apps/com.xronlinux.BreezyDesktop.svg -w 64 -h 64 -o $PACKAGE_ICONS_DIR/com.xronlinux.BreezyDesktop_64.png -rsvg-convert data/icons/hicolor/scalable/apps/com.xronlinux.BreezyDesktop.svg -w 128 -h 128 -o $PACKAGE_ICONS_DIR/com.xronlinux.BreezyDesktop_128.png -rsvg-convert data/icons/hicolor/scalable/apps/com.xronlinux.BreezyDesktop.svg -w 256 -h 256 -o $PACKAGE_ICONS_DIR/com.xronlinux.BreezyDesktop_256.png -rsvg-convert data/icons/hicolor/scalable/apps/com.xronlinux.BreezyDesktop.svg -w 1024 -h 1024 -o $PACKAGE_ICONS_DIR/com.xronlinux.BreezyDesktop_1024.png +mkdir -p $PACKAGE_ICONS_DIR/64x64/apps +mkdir -p $PACKAGE_ICONS_DIR/128x128/apps +mkdir -p $PACKAGE_ICONS_DIR/256x256/apps +mkdir -p $PACKAGE_ICONS_DIR/1024x1024/apps +rsvg-convert data/icons/hicolor/scalable/apps/com.xronlinux.BreezyDesktop.svg -w 64 -h 64 -o $PACKAGE_ICONS_DIR/64x64/apps/com.xronlinux.BreezyDesktop.png +rsvg-convert data/icons/hicolor/scalable/apps/com.xronlinux.BreezyDesktop.svg -w 128 -h 128 -o $PACKAGE_ICONS_DIR/128x128/apps/com.xronlinux.BreezyDesktop.png +rsvg-convert data/icons/hicolor/scalable/apps/com.xronlinux.BreezyDesktop.svg -w 256 -h 256 -o $PACKAGE_ICONS_DIR/256x256/apps/com.xronlinux.BreezyDesktop.png +rsvg-convert data/icons/hicolor/scalable/apps/com.xronlinux.BreezyDesktop.svg -w 1024 -h 1024 -o $PACKAGE_ICONS_DIR/1024x1024/apps/com.xronlinux.BreezyDesktop.png pushd $BUILD_PATH diff --git a/ui/bin/update_pot_files b/ui/bin/update_pot_files index 68ec03e..a667bbd 100755 --- a/ui/bin/update_pot_files +++ b/ui/bin/update_pot_files @@ -13,7 +13,7 @@ for file in po/*.po; do msgmerge --update "po/$lang.po" po/breezydesktop.pot - outdir="po/$lang/LC_MESSAGES" + outdir="po/mo/$lang/LC_MESSAGES" mkdir -p "$outdir" msgfmt -o "$outdir/breezydesktop.mo" "$file" done diff --git a/ui/data/com.xronlinux.BreezyDesktop.desktop.in b/ui/data/com.xronlinux.BreezyDesktop.desktop.in index 1264eef..0cee462 100644 --- a/ui/data/com.xronlinux.BreezyDesktop.desktop.in +++ b/ui/data/com.xronlinux.BreezyDesktop.desktop.in @@ -1,6 +1,6 @@ [Desktop Entry] Name=Breezy Desktop -Exec=env LOCALE_DIR=/usr/local/share/breezydesktop/breezydesktop/po breezydesktop +Exec=breezydesktop Icon=com.xronlinux.BreezyDesktop Terminal=false Type=Application diff --git a/ui/po/breezydesktop.pot b/ui/po/breezydesktop.pot index 1bfe949..e12cbf3 100644 --- a/ui/po/breezydesktop.pot +++ b/ui/po/breezydesktop.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-01 13:24-0700\n" +"POT-Creation-Date: 2024-10-02 09:15-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/ui/po/de/LC_MESSAGES/breezydesktop.mo b/ui/po/mo/de/LC_MESSAGES/breezydesktop.mo similarity index 100% rename from ui/po/de/LC_MESSAGES/breezydesktop.mo rename to ui/po/mo/de/LC_MESSAGES/breezydesktop.mo diff --git a/ui/po/es/LC_MESSAGES/breezydesktop.mo b/ui/po/mo/es/LC_MESSAGES/breezydesktop.mo similarity index 100% rename from ui/po/es/LC_MESSAGES/breezydesktop.mo rename to ui/po/mo/es/LC_MESSAGES/breezydesktop.mo diff --git a/ui/po/fr/LC_MESSAGES/breezydesktop.mo b/ui/po/mo/fr/LC_MESSAGES/breezydesktop.mo similarity index 100% rename from ui/po/fr/LC_MESSAGES/breezydesktop.mo rename to ui/po/mo/fr/LC_MESSAGES/breezydesktop.mo diff --git a/ui/po/it/LC_MESSAGES/breezydesktop.mo b/ui/po/mo/it/LC_MESSAGES/breezydesktop.mo similarity index 100% rename from ui/po/it/LC_MESSAGES/breezydesktop.mo rename to ui/po/mo/it/LC_MESSAGES/breezydesktop.mo diff --git a/ui/po/ja/LC_MESSAGES/breezydesktop.mo b/ui/po/mo/ja/LC_MESSAGES/breezydesktop.mo similarity index 100% rename from ui/po/ja/LC_MESSAGES/breezydesktop.mo rename to ui/po/mo/ja/LC_MESSAGES/breezydesktop.mo diff --git a/ui/po/pl/LC_MESSAGES/breezydesktop.mo b/ui/po/mo/pl/LC_MESSAGES/breezydesktop.mo similarity index 100% rename from ui/po/pl/LC_MESSAGES/breezydesktop.mo rename to ui/po/mo/pl/LC_MESSAGES/breezydesktop.mo diff --git a/ui/po/pt_BR/LC_MESSAGES/breezydesktop.mo b/ui/po/mo/pt_BR/LC_MESSAGES/breezydesktop.mo similarity index 100% rename from ui/po/pt_BR/LC_MESSAGES/breezydesktop.mo rename to ui/po/mo/pt_BR/LC_MESSAGES/breezydesktop.mo diff --git a/ui/po/ru/LC_MESSAGES/breezydesktop.mo b/ui/po/mo/ru/LC_MESSAGES/breezydesktop.mo similarity index 100% rename from ui/po/ru/LC_MESSAGES/breezydesktop.mo rename to ui/po/mo/ru/LC_MESSAGES/breezydesktop.mo diff --git a/ui/po/sv/LC_MESSAGES/breezydesktop.mo b/ui/po/mo/sv/LC_MESSAGES/breezydesktop.mo similarity index 100% rename from ui/po/sv/LC_MESSAGES/breezydesktop.mo rename to ui/po/mo/sv/LC_MESSAGES/breezydesktop.mo diff --git a/ui/po/uk_UA/LC_MESSAGES/breezydesktop.mo b/ui/po/mo/uk_UA/LC_MESSAGES/breezydesktop.mo similarity index 100% rename from ui/po/uk_UA/LC_MESSAGES/breezydesktop.mo rename to ui/po/mo/uk_UA/LC_MESSAGES/breezydesktop.mo diff --git a/ui/po/zh_CN/LC_MESSAGES/breezydesktop.mo b/ui/po/mo/zh_CN/LC_MESSAGES/breezydesktop.mo similarity index 100% rename from ui/po/zh_CN/LC_MESSAGES/breezydesktop.mo rename to ui/po/mo/zh_CN/LC_MESSAGES/breezydesktop.mo diff --git a/ui/src/main.py b/ui/src/main.py index 4f4a1c1..710d3ce 100644 --- a/ui/src/main.py +++ b/ui/src/main.py @@ -32,15 +32,16 @@ gi.require_version('Adw', '1') gi.require_version('Gio', '2.0') gi.require_version('GLib', '2.0') -script_dir = os.path.dirname(os.path.abspath(__file__)) -po_dir = os.path.join(script_dir, 'po') -locale_dir = os.environ.get('LOCALE_DIR', '/app/share/locale') +user_home = os.path.expanduser('~') +xdg_data_home = os.environ.get('XDG_DATA_HOME') or os.path.join(user_home, '.local', 'share') +locale_dir = os.environ.get('LOCALE_DIR', os.path.join(xdg_data_home, 'locale')) locale.setlocale(locale.LC_ALL, locale.getdefaultlocale()) locale.bindtextdomain('breezydesktop', locale_dir) gettext.bindtextdomain('breezydesktop', locale_dir) gettext.textdomain('breezydesktop') + from gi.repository import Adw, Gtk, Gio from .licensedialog import LicenseDialog from .statemanager import StateManager