6 points

If you uninstall Steam or Firefox, it can absolutely be gigs, just FYI. Very nice tool to have.

permalink
report
reply
5 points

How is this different from

flatpak uninstall --unused

?

permalink
report
reply
5 points

As far as I can tell this seems to be for deleting application data (~/.var/app/*), whereas flatpak uninstall --unused is for uninstalling runtimes that are no longer needed.

permalink
report
parent
reply
4 points
*

This app is more equivalent to flatpak uninstall --delete-data

permalink
report
parent
reply
3 points

But this doesnt work once uninstalled. This really is an isse with flatpaks.

permalink
report
parent
reply
1 point
*

Because there are distros, like fedora for one, that have flat packs installable by the likes of discovery on KDE that doesn’t require CLI useage for install or uninstall of flatpacks

permalink
report
parent
reply
4 points

For fun, a shell script for the same functionality:

#!/bin/sh
br="$(printf "\n")" # Obtain a line-break

# If RM_CMD is unset, use trash-cli
if [ -z ${RM_CMD+y} ]; then RM_CMD="trash"; fi

# List of apps. The leading br is necessary for later pattern matching
apps="$br$(flatpak list --columns=application)" || exit 1

cd ~/.var/app || exit 1

for app in *; do
	case "$apps" in
		*"$br$app$br"*) ;; # Matches if $app is in the list (installed)
		*)
			printf 'Removing app data %s\n' "${app}"
			"$RM_CMD" "./${app}"
			;;
	esac
done

(May eat your files)

permalink
report
reply
3 points

Pretty complicated

#!/bin/bash

# List contents of ~/.var/app/
files=$(ls -1 ~/.var/app/)

# Loop through each element of the folder
for file in $files; do
    # Set the name as a variable
    app_name="${file##*/}"

    # Check if a flatpak app of that name is installed
    if ! flatpak list 2> /dev/null | grep -qw $app_name; then
        # Ask the user to delete the folder
        read -p "The app $app_name is not installed. Do you want to delete its folder? (y/n): " choice
        case "$choice" in
            [Yy]* )
                # Remove the folder recursively
                rm -rf ~/.var/app/$file;;
            [Nn]* )
                echo "Skipping deletion of $app_name folder.";;
            * )
                echo "Invalid input. Skipping deletion of $app_name folder.";;
        esac
    fi
done

echo "All Apps checked."
permalink
report
parent
reply
1 point

The check for if a package is installed can be simplified using flatpak info.

$ flatpak info com.example.Nonexistent &>/dev/null; echo $?
1
$ flatpak info org.mozilla.firefox &>/dev/null; echo $?    
0
permalink
report
parent
reply
3 points

Lol just yesterday wrote a CLI tool for that. (Pssst, saves data)

https://github.com/trytomakeyouprivate/Flatpak-trash-remover

permalink
report
reply
2 points

WOW, 6MB, that is more than 4 Floppy Disks!

permalink
report
reply

Free and Open Source Software

!foss@beehaw.org

Create post

If it’s free and open source and it’s also software, it can be discussed here. Subcommunity of Technology.


This community’s icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.

Community stats

  • 780

    Monthly active users

  • 901

    Posts

  • 13K

    Comments