rah,

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

brie,

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?

kkaosninja,
@kkaosninja@beehaw.org avatar

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

d3Xt3r,

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

neutronst4r,

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

pkulak,

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

Pantherina,
@Pantherina@feddit.de avatar

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

github.com/…/Flatpak-trash-remover

brie,

For fun, a shell script for the same functionality:


<span style="color:#323232;">#!/bin/sh
</span><span style="color:#323232;">br="$(printf "n")" # Obtain a line-break
</span><span style="color:#323232;">
</span><span style="color:#323232;"># If RM_CMD is unset, use trash-cli
</span><span style="color:#323232;">if [ -z ${RM_CMD+y} ]; then RM_CMD="trash"; fi
</span><span style="color:#323232;">
</span><span style="color:#323232;"># List of apps. The leading br is necessary for later pattern matching
</span><span style="color:#323232;">apps="$br$(flatpak list --columns=application)" || exit 1
</span><span style="color:#323232;">
</span><span style="color:#323232;">cd ~/.var/app || exit 1
</span><span style="color:#323232;">
</span><span style="color:#323232;">for app in *; do
</span><span style="color:#323232;">	case "$apps" in
</span><span style="color:#323232;">		*"$br$app$br"*) ;; # Matches if $app is in the list (installed)
</span><span style="color:#323232;">		*)
</span><span style="color:#323232;">			printf 'Removing app data %sn' "${app}"
</span><span style="color:#323232;">			"$RM_CMD" "./${app}"
</span><span style="color:#323232;">			;;
</span><span style="color:#323232;">	esac
</span><span style="color:#323232;">done
</span>

(May eat your files)

Pantherina,
@Pantherina@feddit.de avatar

Pretty complicated


<span style="color:#323232;">#!/bin/bash
</span><span style="color:#323232;">
</span><span style="color:#323232;"># List contents of ~/.var/app/
</span><span style="color:#323232;">files=$(ls -1 ~/.var/app/)
</span><span style="color:#323232;">
</span><span style="color:#323232;"># Loop through each element of the folder
</span><span style="color:#323232;">for file in $files; do
</span><span style="color:#323232;">    # Set the name as a variable
</span><span style="color:#323232;">    app_name="${file##*/}"
</span><span style="color:#323232;">
</span><span style="color:#323232;">    # Check if a flatpak app of that name is installed
</span><span style="color:#323232;">    if ! flatpak list 2> /dev/null | grep -qw $app_name; then
</span><span style="color:#323232;">        # Ask the user to delete the folder
</span><span style="color:#323232;">        read -p "The app $app_name is not installed. Do you want to delete its folder? (y/n): " choice
</span><span style="color:#323232;">        case "$choice" in
</span><span style="color:#323232;">            [Yy]* )
</span><span style="color:#323232;">                # Remove the folder recursively
</span><span style="color:#323232;">                rm -rf ~/.var/app/$file;;
</span><span style="color:#323232;">            [Nn]* )
</span><span style="color:#323232;">                echo "Skipping deletion of $app_name folder.";;
</span><span style="color:#323232;">            * )
</span><span style="color:#323232;">                echo "Invalid input. Skipping deletion of $app_name folder.";;
</span><span style="color:#323232;">        esac
</span><span style="color:#323232;">    fi
</span><span style="color:#323232;">done
</span><span style="color:#323232;">
</span><span style="color:#323232;">echo "All Apps checked."
</span>
brie,

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


<span style="color:#323232;">$ flatpak info com.example.Nonexistent &>/dev/null; echo $?
</span><span style="color:#323232;">1
</span><span style="color:#323232;">$ flatpak info org.mozilla.firefox &>/dev/null; echo $?    
</span><span style="color:#323232;">0
</span>
djsaskdja,

How is this different from

flatpak uninstall --unused

?

Efwis,

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,

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,

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

Pantherina,
@Pantherina@feddit.de avatar

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

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • uselessserver093
  • Food
  • aaaaaaacccccccce
  • [email protected]
  • test
  • CafeMeta
  • testmag
  • MUD
  • RhythmGameZone
  • RSS
  • dabs
  • Socialism
  • KbinCafe
  • TheResearchGuardian
  • Ask_kbincafe
  • oklahoma
  • feritale
  • SuperSentai
  • KamenRider
  • All magazines