63
submitted 11 months ago by d3Xt3r@beehaw.org to c/foss@beehaw.org
top 15 comments
sorted by: hot top controversial new old
[-] pkulak@beehaw.org 6 points 10 months ago

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

[-] djsaskdja@endlesstalk.org 5 points 11 months ago

How is this different from

flatpak uninstall --unused

?

[-] brie@beehaw.org 5 points 11 months ago

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.

[-] aka_oscar@beehaw.org 4 points 11 months ago* (last edited 11 months ago)

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

[-] Pantherina@feddit.de 3 points 10 months ago

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

[-] Efwis@lemmy.zip 1 points 11 months ago* (last edited 11 months ago)

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

[-] brie@beehaw.org 4 points 11 months ago

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)

[-] Pantherina@feddit.de 3 points 10 months ago

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."
[-] brie@beehaw.org 1 points 10 months ago

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
[-] Pantherina@feddit.de 3 points 10 months ago

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

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

[-] neutronst4r@beehaw.org 2 points 10 months ago

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

[-] kkaosninja@beehaw.org 1 points 10 months ago

Wait. So flatpak uninstall --unused does not do this?

[-] d3Xt3r@beehaw.org 3 points 10 months ago

No, that only deletes the leftover dependencies, it doesn't delete any app data/config left over.

[-] rah@feddit.uk 1 points 10 months ago

I just read this as: "Separate program needed to make up for shortcomings of flatpak!" This is to be lamented, not celebrated.

[-] brie@beehaw.org 2 points 10 months ago

This is kind of a shortcoming of all package management in general; should deleting the package delete your user data? There's an argument to be made that data should be removed with the application, but deleting data irrecoverably as the default isn't necessarily the easiest approach.

There's also another problem, which is that the behaviour of deleting data may make sense for per-user applications, but for system-wide apps, should uninstalling an application start nuking data in people's homedirs?

this post was submitted on 05 Aug 2023
63 points (100.0% liked)

Free and Open Source Software

17480 readers
111 users here now

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.

founded 2 years ago
MODERATORS