diff --git a/files/usr/bin/system-flatpak-setup b/files/usr/bin/system-flatpak-setup old mode 100755 new mode 100644 index f5c604d..2a0cb6e --- a/files/usr/bin/system-flatpak-setup +++ b/files/usr/bin/system-flatpak-setup @@ -41,6 +41,9 @@ if [[ ! $REPO_TITLE == "null" ]]; then echo "Setting title $REPO_TITLE for remote $REPO_NAME" fi +# Notifications config +NOTIFICATIONS=$(cat /etc/flatpak/notifications) + # Installed flatpaks FLATPAK_LIST=$(flatpak list --columns=application) @@ -57,7 +60,9 @@ if [[ -f $INSTALL_LIST_FILE ]]; then fi if [[ -n $INSTALL_LIST ]]; then flatpak install --system --noninteractive "$REPO_NAME" ${INSTALL_LIST[@]} - notify-send "Flatpak Installer" "Finished install of system flatpaks" --app-name="Flatpak Installer" -u NORMAL + if [[ $NOTIFICATIONS == "true" ]]; then + notify-send "Flatpak Installer" "Finished install of system flatpaks:\n$INSTALL_LIST" --app-name="Flatpak Installer" -u NORMAL + fi fi fi @@ -66,8 +71,8 @@ if [[ -f $REMOVE_LIST_FILE ]]; then REMOVE_LIST=$(echo "$FLATPAK_LIST" | grep -o -f - "$REMOVE_LIST_FILE") if [[ -n $REMOVE_LIST ]]; then flatpak uninstall --system --noninteractive ${REMOVE_LIST[@]} - notify-send "Flatpak Installer" "Finished uninstall of system flatpaks" --app-name="Flatpak Installer" -u NORMAL + if [[ $NOTIFICATIONS == "true" ]]; then + notify-send "Flatpak Installer" "Finished uninstall of system flatpaks:\n$REMOVE_LIST" --app-name="Flatpak Installer" -u NORMAL + fi fi fi - - diff --git a/files/usr/bin/user-flatpak-setup b/files/usr/bin/user-flatpak-setup old mode 100755 new mode 100644 index afd547d..4d5fa39 --- a/files/usr/bin/user-flatpak-setup +++ b/files/usr/bin/user-flatpak-setup @@ -23,6 +23,9 @@ if [[ ! $REPO_TITLE == "null" ]]; then echo "Setting title $REPO_TITLE for remote $REPO_NAME" fi +# Notifications config +NOTIFICATIONS=$(cat /etc/flatpak/notifications) + # Installed flatpaks FLATPAK_LIST=$(flatpak list --columns=application) @@ -39,7 +42,9 @@ if [[ -f $INSTALL_LIST_FILE ]]; then fi if [[ -n $INSTALL_LIST ]]; then flatpak install --user --noninteractive "$REPO_NAME" ${INSTALL_LIST[@]} - notify-send "Flatpak Installer" "Finished install of user flatpaks" --app-name="Flatpak Installer" -u NORMAL + if [[ $NOTIFICATIONS == "true" ]]; then + notify-send "Flatpak Installer" "Finished install of user flatpaks:\n$INSTALL_LIST" --app-name="Flatpak Installer" -u NORMAL + fi fi fi @@ -48,6 +53,8 @@ if [[ -f $REMOVE_LIST_FILE ]]; then REMOVE_LIST=$(echo "$FLATPAK_LIST" | grep -o -f - "$REMOVE_LIST_FILE") if [[ -n $REMOVE_LIST ]]; then flatpak uninstall --user --noninteractive ${REMOVE_LIST[@]} - notify-send "Flatpak Installer" "Finished uninstall of user flatpaks" --app-name="Flatpak Installer" -u NORMAL + if [[ $NOTIFICATIONS == "true" ]]; then + notify-send "Flatpak Installer" "Finished uninstall of user flatpaks:\n$REMOVE_LIST" --app-name="Flatpak Installer" -u NORMAL + fi fi fi diff --git a/modules/default-flatpaks/README.md b/modules/default-flatpaks/README.md index 572bfc9..117834a 100644 --- a/modules/default-flatpaks/README.md +++ b/modules/default-flatpaks/README.md @@ -18,10 +18,13 @@ The scripts are run on every boot by these services: This module stores the Flatpak remote configuration and Flatpak install/remove lists in `/etc/flatpak/`. There are two subdirectories, `user` and `system` corresponding with the install level of the Flatpaks and repositories. Each directory has text files containing the IDs of flatpaks to `install` and `remove`, plus a `repo-info.yml` containing the details of the Flatpak repository. +This module also supports disabling & enabling notifications. + ## Example configurations ```yaml type: default-flatpaks +notify: true # Send notification after install/uninstall is finished (true/false) system: # If no repo information is specified, Flathub will be used by default repo-url: https://dl.flathub.org/repo/flathub.flatpakrepo diff --git a/modules/default-flatpaks/default-flatpaks.sh b/modules/default-flatpaks/default-flatpaks.sh index fc9a541..3a6da34 100644 --- a/modules/default-flatpaks/default-flatpaks.sh +++ b/modules/default-flatpaks/default-flatpaks.sh @@ -118,3 +118,8 @@ if [[ ! $(echo "$1" | yq -I=0 ".user") == "null" ]]; then configure_flatpak_repo "$1" "user" configure_lists "$1" "user" fi + +echo "Configuring default-flatpaks notifications" +NOTIFICATIONS=$(yq ".notify" "$CONFIG_FILE") +NOTIFICATIONS_CONFIG_FILE="/usr/etc/flatpak/notifications" +echo "$NOTIFICATIONS" > "$NOTIFICATIONS_CONFIG_FILE"