Never mistake an entry edited in place for one we generated

A desktop entry that already lives in ~/.local/share/applications is the
user's own file, patched in place with the original kept aside. It used to
get the same X-MCA-Generated marker as a shadow copy, which made the next
scan skip it, fall back to the system entry, and overwrite the user's file
with a shadow - and then delete it on revert instead of restoring it.

The two cases now carry different markers. Only a shadow is skipped by the
scan and deleted when undoing; an entry patched in place stays in the scan
and is restored from its backup.

Also: resolve the applications screen's labels once instead of per row per
keypress, and drop code nothing calls.
This commit is contained in:
Felitendo committed 2026-08-16 19:56:19 +02:00
1 parent d3c82fdff8
commit 5b1fc84710
10 files changed
+63 -60

No files matched your search

-4
View File
@@ -8,7 +8,6 @@
# of the behaviour, it is the behaviour.
MCA_CHANGES=0
MCA_TOUCHED=()
MCA_ROUTES=()
# mca_route <kind> <id> <program>
@@ -63,7 +62,6 @@ mca_apply() {
local i id file prog kind route steam_done=0
MCA_CHANGES=0
MCA_TOUCHED=()
MCA_ROUTES=()
MCA_N_ON=0; MCA_N_OFF=0; MCA_N_UNKNOWN=0
@@ -117,7 +115,6 @@ mca_apply() {
fi
mca_state_write last_apply "$(date +%s)"
mca_state_write covered "${#MCA_TOUCHED[@]}"
return 0
}
@@ -131,7 +128,6 @@ mca_revert() {
update-desktop-database "$MCA_APPDIR" 2>/dev/null || true
fi
mca_state_write covered 0
return 0
}