mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 12:56:06 +00:00
feat: storage page to see and free DroidDeck's storage (#913)
This commit is contained in:
1 parent
9ce5a24459
commit
ccafdf99c3
14 files changed
+1915
-7
No files matched your search
@@ -181,6 +181,27 @@ def uninstall(app_id):
|
||||
return rc
|
||||
|
||||
|
||||
def prune():
|
||||
inst = installation()
|
||||
try:
|
||||
unused = inst.list_unused_refs(None, None)
|
||||
except GLib.Error as err:
|
||||
emit(e="error", message=err.message)
|
||||
return 1
|
||||
if unused:
|
||||
t, state = transaction(inst)
|
||||
for r in unused:
|
||||
t.add_uninstall(r.format_ref())
|
||||
if run(t, state, report_done=False):
|
||||
return 1
|
||||
try:
|
||||
inst.prune_local_repo(None)
|
||||
except GLib.Error as err:
|
||||
emit(e="warning", message=err.message)
|
||||
emit(e="done", removed=len(unused))
|
||||
return 0
|
||||
|
||||
|
||||
def updatable(inst):
|
||||
try:
|
||||
return inst.list_installed_refs_for_update(None)
|
||||
@@ -216,7 +237,7 @@ def updates():
|
||||
|
||||
def main():
|
||||
if len(sys.argv) < 2:
|
||||
sys.stderr.write(__doc__ or "usage: droiddeck-flatpak install|install-bundle|uninstall|update|updates [app-id|file]\n")
|
||||
sys.stderr.write(__doc__ or "usage: droiddeck-flatpak install|install-bundle|uninstall|update|updates|prune [app-id|file]\n")
|
||||
return 2
|
||||
cmd, args = sys.argv[1], sys.argv[2:]
|
||||
if cmd in ("install", "install-bundle", "update"):
|
||||
@@ -231,7 +252,9 @@ def main():
|
||||
return update(args[0] if args else None)
|
||||
if cmd == "updates":
|
||||
return updates()
|
||||
sys.stderr.write("usage: droiddeck-flatpak install|install-bundle|uninstall|update|updates [app-id|file]\n")
|
||||
if cmd == "prune":
|
||||
return prune()
|
||||
sys.stderr.write("usage: droiddeck-flatpak install|install-bundle|uninstall|update|updates|prune [app-id|file]\n")
|
||||
return 2
|
||||
|
||||
|
||||
|
||||
@@ -516,13 +516,27 @@ case $mode in
|
||||
) &
|
||||
if [ -n "${BL_LAUNCH_DIR:-}" ] && [ -z "${BL_DESKTOP:-}" ]; then
|
||||
_bl_held=
|
||||
_bl_uninstall=
|
||||
_bl_rest=()
|
||||
for _bl_arg in "$@"; do
|
||||
case $_bl_arg in
|
||||
steam://rungameid/*) _bl_held=${_bl_arg#steam://rungameid/} ;;
|
||||
steam://uninstall/*) _bl_uninstall=${_bl_arg#steam://uninstall/} ;;
|
||||
*) _bl_rest+=("$_bl_arg") ;;
|
||||
esac
|
||||
done
|
||||
if [ -n "$_bl_uninstall" ]; then
|
||||
set -- "${_bl_rest[@]}"
|
||||
(
|
||||
_bl_end=$((SECONDS + 120))
|
||||
until [ "$(xprop -root GAMESCOPE_FOCUSED_APP 2>/dev/null | sed -n 's/.*= *//p')" = 769 ] || [ "$SECONDS" -ge "$_bl_end" ]; do
|
||||
sleep 1
|
||||
done
|
||||
sleep 4
|
||||
echo "== steam: interface up; asking to uninstall $_bl_uninstall"
|
||||
printf '%s\n' "$_bl_uninstall" > "$BL_LAUNCH_DIR/steam-uninstall.tmp" && mv -f "$BL_LAUNCH_DIR/steam-uninstall.tmp" "$BL_LAUNCH_DIR/steam-uninstall"
|
||||
) &
|
||||
fi
|
||||
if [ -n "$_bl_held" ]; then
|
||||
set -- "${_bl_rest[@]}"
|
||||
(
|
||||
@@ -773,6 +787,17 @@ BUSCONF
|
||||
"$steam_root/steamrtarm64/steam" -shutdown >/dev/null 2>&1 || true
|
||||
exit 0
|
||||
fi
|
||||
if [ -f "$BL_LAUNCH_DIR/steam-uninstall" ]; then
|
||||
uninstall_id=$(cat "$BL_LAUNCH_DIR/steam-uninstall" 2>/dev/null)
|
||||
rm -f "$BL_LAUNCH_DIR/steam-uninstall"
|
||||
case $uninstall_id in
|
||||
''|0*|*[!0-9]*|???????????*) echo "== steam: ignored invalid uninstall request" ;;
|
||||
*)
|
||||
echo "== steam: opening the uninstall dialog for $uninstall_id"
|
||||
"$steam_root/steamrtarm64/steam" "steam://uninstall/$uninstall_id" >/dev/null 2>&1 &
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ -f "$BL_LAUNCH_DIR/steam-game" ]; then
|
||||
game_id=$(cat "$BL_LAUNCH_DIR/steam-game" 2>/dev/null)
|
||||
rm -f "$BL_LAUNCH_DIR/steam-game"
|
||||
|
||||
Reference in new issue
Block a user