Compare commits

...
3 Commits
Author SHA1 Message Date
Felitendo 4004023297 Make the second menu entry an action instead of a report
"Apply now" had nothing to do in the normal case. Enabling applies, the
watcher handles everything installed afterwards, and the settings and
applications screens apply on their way out - so pressing it answered
"already applied to 14 applications" and that was the whole interaction.

It is now "Re-apply everything": the state is taken back and written again
from scratch. That is the answer to the question the status block can raise
but nothing could act on - Steam showing as not patched after a client
update, an application that drifted, a flag file edited by hand.

Uninstalling an application used to leave the entry shadowing it behind, in
the user home where the package manager cannot see it, offering to start a
program that is gone. A plain apply only looks at what exists now, so the
watcher never noticed either. Those are removed on every apply now, not just
when rebuilding.
2026-08-16 20:44:19 +02:00
Felitendo 9896260636 Describe what this does, not which applications it happens to cover
A list of names reads like a compatibility list, invites the question of
whether the one you care about is on it, and is out of date the moment
something new turns up. The point is that there is no list: every launcher
is examined and the Chromium-based ones are identified by what they ship.
2026-08-16 20:20:44 +02:00
Felitendo 5b1fc84710 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.
2026-08-16 19:56:19 +02:00
12 changed files with 158 additions and 81 deletions

No files matched your search

+1 -1
View File
@@ -8,7 +8,7 @@
# Overridable so a packager can pass the version it is actually building
# (`make VERSION=$pkgver`). The literal below is the fallback for builds
# straight from a checkout, and is what a release tag has to carry.
VERSION ?= 1.0.0
VERSION ?= 1.0.3
PREFIX ?= /usr
DESTDIR ?=
+9 -4
View File
@@ -1,9 +1,13 @@
# middleclick-autoscroll
Middle-click autoscroll — hold the middle mouse button, move the pointer, the
page scrolls — for every Chromium-based application on the system. Discord,
Vesktop, Equibop, VS Code, Obsidian, Signal, Spotify, Steam, Chromium-based
browsers, and whatever gets installed next week.
page scrolls — in every application on the system that can do it, and in
anything installed later.
There is no list of supported applications to check against and none to keep up
to date. Every launcher on the system is examined, the ones running on Chromium
underneath are identified by what they ship rather than by their name, and each
of them is handled.
```bash
paru -S middleclick-autoscroll
@@ -55,7 +59,7 @@ all of them, in a way that survives the next package upgrade, is not:
Applications pick this up the next time they are started.
[1] Turn autoscroll on or off
[2] Apply now
[2] Re-apply everything
[3] Applications
[4] Settings
[q] Quit
@@ -166,6 +170,7 @@ Run this before uninstalling the package.
| `… enable` | turn it on, apply, start watching |
| `… disable` | turn it off and put everything back |
| `… apply` | apply to anything new (this is what the watcher calls) |
| `… apply --rebuild` | take everything back and apply it again, to repair a mess |
| `… status` | what is covered |
| `… list` | every application that was found and how it is handled |
+15 -5
View File
@@ -2,7 +2,7 @@ middleclick-autoscroll(1)
# NAME
middleclick-autoscroll - middle-click autoscroll for Chromium-based applications
middleclick-autoscroll - middle-click autoscroll in every application that supports it
# SYNOPSIS
@@ -36,10 +36,17 @@ is refused.
*disable*
Turn it off and put every file that was changed back the way it was.
*apply*
*apply* [*--rebuild*]
Apply to anything that has appeared since the last run. This is what the
watcher calls; running it by hand is only needed when the watcher is off.
Entries left behind by an application that has since been uninstalled are
removed here too - the entry shadowing it lives in the user's home, where
the package manager that removed the application cannot see it.
With *--rebuild* everything is taken back first and written again from
scratch. That is the repair: it does not care what looks correct already.
*status*
How many applications are covered, whether Steam is patched, and when the
last run was.
@@ -72,9 +79,12 @@ Two ways, chosen per application.
Flatpaks, a copy of the desktop entry with the argument appended is written
to _~/.local/share/applications_, where it shadows the system one. Entries
that already live there - AppImages, web app shortcuts - are edited in
place, with the original kept. Every generated entry is marked with
*X-MCA-Generated*; an entry that is not marked is somebody else's and is
left alone.
place, with the original kept.
A generated entry is marked *X-MCA-Generated* and an entry edited in place
*X-MCA-Patched*. The two are never confused: the first is deleted when
undoing, the second is restored from its backup. An entry with neither
marker belongs to somebody else and is left alone.
Programs that start themselves at login write their own entry into
_~/.config/autostart_ pointing straight at their binary, bypassing the menu
+9 -3
View File
@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: middleclick-autoscroll 1.0.0\n"
"Project-Id-Version: middleclick-autoscroll 1.0.3\n"
"Report-Msgid-Bugs-To: https://github.com/Felitendo/middleclick-autoscroll/issues\n"
"POT-Creation-Date: 2026-08-16 00:00+0200\n"
"PO-Revision-Date: 2026-08-16 00:00+0200\n"
@@ -77,8 +77,8 @@ msgstr "Anwendungen übernehmen das beim nächsten Start."
msgid "Turn autoscroll on or off"
msgstr "Autoscroll ein- oder ausschalten"
msgid "Apply now"
msgstr "Jetzt anwenden"
msgid "Re-apply everything"
msgstr "Alles neu anwenden"
msgid "Applications"
msgstr "Anwendungen"
@@ -164,6 +164,9 @@ msgstr "Autoscroll ist aus, alle Änderungen wurden zurückgenommen."
msgid "Autoscroll is off. Turn it on first."
msgstr "Autoscroll ist aus. Erst einschalten."
msgid "Applied again to %d applications."
msgstr "Erneut auf %d Anwendungen angewendet."
msgid "Applied to %d applications."
msgstr "Auf %d Anwendungen angewendet."
@@ -190,6 +193,9 @@ msgstr "Ausschalten und alles zurücknehmen"
msgid "Apply to anything installed since the last run"
msgstr "Auf alles anwenden, was seit dem letzten Lauf dazugekommen ist"
msgid "Take everything back and apply it again"
msgstr "Alles zurücknehmen und neu anwenden"
msgid "Show what is covered"
msgstr "Anzeigen, was abgedeckt ist"
+8 -2
View File
@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: middleclick-autoscroll 1.0.0\n"
"Project-Id-Version: middleclick-autoscroll 1.0.3\n"
"Report-Msgid-Bugs-To: https://github.com/Felitendo/middleclick-autoscroll/issues\n"
"POT-Creation-Date: 2026-08-16 00:00+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
@@ -77,7 +77,7 @@ msgstr ""
msgid "Turn autoscroll on or off"
msgstr ""
msgid "Apply now"
msgid "Re-apply everything"
msgstr ""
msgid "Applications"
@@ -164,6 +164,9 @@ msgstr ""
msgid "Autoscroll is off. Turn it on first."
msgstr ""
msgid "Applied again to %d applications."
msgstr ""
msgid "Applied to %d applications."
msgstr ""
@@ -190,6 +193,9 @@ msgstr ""
msgid "Apply to anything installed since the last run"
msgstr ""
msgid "Take everything back and apply it again"
msgstr ""
msgid "Show what is covered"
msgstr ""
+2 -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
@@ -112,12 +110,13 @@ mca_apply() {
[[ $CFG_AUTOSTART == yes ]] && mca_autostart_apply
[[ $CFG_SPOTIFY == yes ]] && mca_spotify_apply
mca_prune_orphans
if (( MCA_CHANGES )) && mca_have update-desktop-database; then
update-desktop-database "$MCA_APPDIR" 2>/dev/null || true
fi
mca_state_write last_apply "$(date +%s)"
mca_state_write covered "${#MCA_TOUCHED[@]}"
return 0
}
@@ -131,7 +130,6 @@ mca_revert() {
update-desktop-database "$MCA_APPDIR" 2>/dev/null || true
fi
mca_state_write covered 0
return 0
}
-17
View File
@@ -158,7 +158,6 @@ mca_head() { printf '\n%s%s%s\n\n' "$MCA_C_BOLD$MCA_C_BLUE" "$*" "$MCA_C_RESET";
mca_ok() { [[ -n $MCA_QUIET ]] || printf '%s✔%s %s\n' "$MCA_C_GREEN" "$MCA_C_RESET" "$*"; }
mca_bad() { MCA_UI_NEEDS_ACK=1; printf '%s✘%s %s\n' "$MCA_C_RED" "$MCA_C_RESET" "$*" >&2; }
mca_note() { MCA_UI_NEEDS_ACK=1; [[ -n $MCA_QUIET ]] || printf '%s•%s %s\n' "$MCA_C_DIM" "$MCA_C_RESET" "$*"; }
mca_debug() { [[ -n ${MCA_DEBUG:-} ]] && printf 'debug: %s\n' "$*" >&2; return 0; }
mca_have() { command -v "$1" > /dev/null 2>&1; }
@@ -239,22 +238,6 @@ mca_ledger_forget() {
return 0
}
# mca_ledger_has <path>
mca_ledger_has() {
[[ -f $MCA_LEDGER ]] || return 1
awk -F'\t' -v p="$1" '$2 == p { found = 1 } END { exit !found }' "$MCA_LEDGER"
}
# mca_ledger_detail <path>
mca_ledger_detail() {
[[ -f $MCA_LEDGER ]] || return 1
awk -F'\t' -v p="$1" '$2 == p { print $3; exit }' "$MCA_LEDGER"
}
mca_ledger_count() {
[[ -f $MCA_LEDGER ]] || { printf '0\n'; return; }
grep -c . "$MCA_LEDGER" 2>/dev/null || printf '0\n'
}
# mca_backup <file>
# Copies a file aside before it is edited in place, and prints the name the
+5 -4
View File
@@ -97,6 +97,9 @@ _mca_desktop_read() {
Hidden=*) DE_HIDDEN="${line#Hidden=}" ;;
Categories=*) DE_CATEGORIES="${line#Categories=}" ;;
MimeType=*) DE_MIME="${line#MimeType=}" ;;
# Only a generated shadow. An entry we edited in place carries
# X-MCA-Patched and is still the application's real entry, so it
# has to stay in the scan.
X-MCA-Generated=*) DE_OURS=1 ;;
esac
done < "$file"
@@ -399,8 +402,8 @@ MCA_PROGS=() # resolved program, or a flatpak app id
MCA_KINDS=() # app | browser | flatpak | steam | unknown | no
# A scan reads every desktop entry on the system, so the menu does it once and
# then redraws from what it found. Anything that changes the answer - applying,
# reverting - invalidates it explicitly.
# then redraws from what it found. Applying rescans on its own, so nothing else
# has to remember to invalidate this.
MCA_SCANNED=0
mca_scan_once() {
@@ -408,8 +411,6 @@ mca_scan_once() {
mca_scan
}
mca_scan_invalidate() { MCA_SCANNED=0; }
mca_scan() {
local dir file id name exec_line prog kind i
local -A seen=()
+37 -11
View File
@@ -371,12 +371,32 @@ mca_ui_apps() {
locale="$(mca_ui_locale)"
local title hint legend
local title hint legend warn
mca_msg_into "$locale" "Applications"; title="$MCA_MSG_RESULT"
mca_msg_into "$locale" "Up/Down select - Space turns one on or off - q goes back"
hint="$MCA_MSG_RESULT"
mca_msg_into "$locale" "Anything not identified is left alone until it is turned on here."
legend="$MCA_MSG_RESULT"
mca_msg_into "$locale" "Autoscroll is off - this is what would be covered."
warn="$MCA_MSG_RESULT"
# The per-row labels are resolved once, here. Looking them up inside the
# drawing loop is a fork per row per keypress, and that is enough to make
# the arrow keys feel like the screen is reloading.
local l_off l_cannot l_on l_steam l_flagfile l_launcher
mca_msg_into "$locale" "off"; l_off="$MCA_MSG_RESULT"
mca_msg_into "$locale" "cannot tell"; l_cannot="$MCA_MSG_RESULT"
mca_msg_into "$locale" "on"; l_on="$MCA_MSG_RESULT"
mca_msg_into "$locale" "Steam"; l_steam="$MCA_MSG_RESULT"
mca_msg_into "$locale" "flag file"; l_flagfile="$MCA_MSG_RESULT"
mca_msg_into "$locale" "launcher"; l_launcher="$MCA_MSG_RESULT"
local s_off="${MCA_C_DIM}${l_off}${MCA_C_RESET}"
local s_cannot="${MCA_C_DIM}${l_cannot}${MCA_C_RESET}"
local s_on="${MCA_C_GREEN}${l_on}${MCA_C_RESET}"
local s_steam="${s_on} ${MCA_C_DIM}(${l_steam})${MCA_C_RESET}"
local s_flags="${s_on} ${MCA_C_DIM}(${l_flagfile})${MCA_C_RESET}"
local s_desktop="${s_on} ${MCA_C_DIM}(${l_launcher})${MCA_C_RESET}"
local clearseq
clearseq="$(clear 2>/dev/null)" || clearseq=$'\033[H\033[2J'
@@ -409,11 +429,11 @@ mca_ui_apps() {
local marker selected="${MCA_C_BLUE}▸${MCA_C_RESET} " shown
for i in "${!labels[@]}"; do
case "${states[i]}" in
off) shown="${MCA_C_DIM}$(mca_msg "off")${MCA_C_RESET}" ;;
unknown) shown="${MCA_C_DIM}$(mca_msg "cannot tell")${MCA_C_RESET}" ;;
steam) shown="${MCA_C_GREEN}$(mca_msg "on")${MCA_C_RESET} ${MCA_C_DIM}($(mca_msg "Steam"))${MCA_C_RESET}" ;;
flags) shown="${MCA_C_GREEN}$(mca_msg "on")${MCA_C_RESET} ${MCA_C_DIM}($(mca_msg "flag file"))${MCA_C_RESET}" ;;
*) shown="${MCA_C_GREEN}$(mca_msg "on")${MCA_C_RESET} ${MCA_C_DIM}($(mca_msg "launcher"))${MCA_C_RESET}" ;;
off) shown="$s_off" ;;
unknown) shown="$s_cannot" ;;
steam) shown="$s_steam" ;;
flags) shown="$s_flags" ;;
*) shown="$s_desktop" ;;
esac
pad=$(( 34 - ${#labels[i]} ))
(( pad < 0 )) && pad=0
@@ -426,7 +446,7 @@ mca_ui_apps() {
# Without this the list reads as a list of what is switched on, which
# it is not while the whole thing is off.
if [[ $CFG_ENABLED != yes ]]; then
frame+=" ${MCA_C_YELLOW}$(mca_msg "Autoscroll is off - this is what would be covered.")${MCA_C_RESET}"$'\n'
frame+=" ${MCA_C_YELLOW}${warn}${MCA_C_RESET}"$'\n'
fi
frame+=" ${MCA_C_DIM}${legend}${MCA_C_RESET}"$'\n'
frame+=" ${MCA_C_DIM}${hint}${MCA_C_RESET}"$'\n'
@@ -475,7 +495,7 @@ mca_ui_menu() {
mca_ui_status
printf '\n'
printf ' [1] %s\n' "$(mca_msg "Turn autoscroll on or off")"
printf ' [2] %s\n' "$(mca_msg "Apply now")"
printf ' [2] %s\n' "$(mca_msg "Re-apply everything")"
printf ' [3] %s\n' "$(mca_msg "Applications")"
printf ' [4] %s\n' "$(mca_msg "Settings")"
printf ' [q] %s\n' "$(mca_msg "Quit")"
@@ -499,18 +519,24 @@ mca_ui_menu() {
fi
[[ -n $MCA_UI_NEEDS_ACK ]] && mca_pause
;;
# Not a plain apply: with the watcher running there is never
# anything left for one to do, and a menu entry that answers
# "already done" every time is not an action. This is the repair -
# everything is taken back and written again from scratch, which is
# what fixes an application that drifted, a flag file somebody
# edited, or Steam after it restored its own script.
2)
mca_ui_cooked mca_do_apply
mca_ui_cooked mca_do_apply --rebuild
mca_pause
;;
3)
if mca_ui_apps; then
[[ $CFG_ENABLED == yes ]] && mca_ui_cooked mca_do_apply --changed
[[ $CFG_ENABLED == yes ]] && mca_ui_cooked mca_do_apply --rebuild
fi
;;
4)
if mca_ui_settings; then
[[ $CFG_ENABLED == yes ]] && mca_ui_cooked mca_do_apply --changed
[[ $CFG_ENABLED == yes ]] && mca_ui_cooked mca_do_apply --rebuild
fi
;;
q|Q) mca_ui_term_restore; trap - EXIT INT TERM; return 0 ;;
+55 -19
View File
@@ -195,9 +195,6 @@ _mca_flags_write() {
mca_ledger_add flags "$file" block
fi
# Every application whose flag file was touched counts as covered, so the
# status line can say how many there are.
MCA_TOUCHED+=("$file")
return 0
}
@@ -255,12 +252,20 @@ mca_flags_revert() {
# Desktop entries
# ---------------------------------------------------------------------------
# _mca_desktop_transform <file> [flags] [position]
# A generated entry and an entry that was edited in place look similar and must
# never be confused: the first one is ours to delete, the second one is the
# user's file with one line changed and has to be restored from its backup. They
# carry different markers so that the scan, the "already done" checks and the
# undo can all tell them apart.
MCA_MARK_SHADOW='X-MCA-Generated'
MCA_MARK_INPLACE='X-MCA-Patched'
# _mca_desktop_transform <file> <marker> [flags] [position]
# The whole file with every Exec line rewritten - the main one and the one in
# each Desktop Action, because those are the right-click menu entries and a
# user who starts Steam from "Library" expects the same behaviour there.
_mca_desktop_transform() {
local file="$1" flags="${2:-}" where="${3:-before-fields}"
local file="$1" marker="$2" flags="${3:-}" where="${4:-before-fields}"
local line rest new marked=0
while IFS= read -r line || [[ -n $line ]]; do
@@ -283,7 +288,7 @@ _mca_desktop_transform() {
printf '%s\n' "$line"
if (( ! marked )) && [[ $line =~ ^[[:space:]]*\[Desktop\ Entry\][[:space:]]*$ ]]; then
printf 'X-MCA-Generated=%s\n' "$MCA_VERSION"
printf '%s=%s\n' "$marker" "$MCA_VERSION"
marked=1
fi
done < "$file"
@@ -300,9 +305,9 @@ mca_desktop_apply() {
# The user's own entry - an AppImage, a web app shortcut, something
# installed by hand. There is nowhere to shadow it from, so it is
# edited directly and the original is kept.
grep -q '^X-MCA-Generated=' "$src" 2>/dev/null && return 0
grep -q "^$MCA_MARK_INPLACE=" "$src" 2>/dev/null && return 0
content="$(_mca_desktop_transform "$src" "$flags" "$where")"
content="$(_mca_desktop_transform "$src" "$MCA_MARK_INPLACE" "$flags" "$where")"
[[ -n $content ]] || return 1
[[ "$content" == "$(< "$src")" ]] && return 0
@@ -311,18 +316,18 @@ mca_desktop_apply() {
MCA_CHANGES=$(( MCA_CHANGES + 1 ))
fi
mca_ledger_add inplace "$src" "$backup"
MCA_TOUCHED+=("$src")
return 0
fi
content="$(_mca_desktop_transform "$src" "$flags" "$where")"
content="$(_mca_desktop_transform "$src" "$MCA_MARK_SHADOW" "$flags" "$where")"
[[ -n $content ]] || return 1
mkdir -p "$MCA_APPDIR" 2>/dev/null || return 1
# Something is already shadowing this entry. If it is not ours it is the
# user's own override and is left exactly as it is.
if [[ -e $target ]] && ! grep -q '^X-MCA-Generated=' "$target" 2>/dev/null; then
# Something is already shadowing this entry. Unless it is a shadow of ours,
# it is the user's own file - possibly one we edited in place earlier - and
# overwriting it here would lose it.
if [[ -e $target ]] && ! grep -q "^$MCA_MARK_SHADOW=" "$target" 2>/dev/null; then
return 1
fi
@@ -330,7 +335,6 @@ mca_desktop_apply() {
MCA_CHANGES=$(( MCA_CHANGES + 1 ))
fi
mca_ledger_add shadow "$target" "$src"
MCA_TOUCHED+=("$target")
return 0
}
@@ -349,7 +353,7 @@ mca_autostart_apply() {
for file in "$dir"/*.desktop; do
[[ -f $file ]] || continue
grep -q '^X-MCA-Generated=' "$file" 2>/dev/null && continue
grep -q "^$MCA_MARK_INPLACE=" "$file" 2>/dev/null && continue
exec_line="$(mca_desktop_get "$file" Exec)"
[[ -n $exec_line ]] || continue
@@ -358,7 +362,7 @@ mca_autostart_apply() {
prog="$MCA_PROG"
mca_is_chromium "$prog" || continue
content="$(_mca_desktop_transform "$file")"
content="$(_mca_desktop_transform "$file" "$MCA_MARK_INPLACE")"
[[ -n $content ]] || continue
[[ "$content" == "$(< "$file")" ]] && continue
@@ -367,7 +371,6 @@ mca_autostart_apply() {
MCA_CHANGES=$(( MCA_CHANGES + 1 ))
fi
mca_ledger_add inplace "$file" "$backup"
MCA_TOUCHED+=("$file")
done
}
@@ -412,7 +415,40 @@ mca_spotify_apply() {
MCA_CHANGES=$(( MCA_CHANGES + 1 ))
fi
mca_ledger_add inplace "$file" "${backup:-}"
MCA_TOUCHED+=("$file")
return 0
}
# ---------------------------------------------------------------------------
# Leftovers
# ---------------------------------------------------------------------------
# mca_prune_orphans
# Removes generated entries whose application is gone.
#
# Uninstalling something deletes its entry from /usr/share/applications, but the
# copy shadowing it is in the user's home and pacman knows nothing about it. It
# would sit in the menu forever, offering to start a program that is no longer
# installed - and the watcher would not notice, because a plain apply only ever
# looks at what is there now.
mca_prune_orphans() {
local kind path source line
local -a lines=()
[[ -f $MCA_LEDGER ]] || return 0
mapfile -t lines < "$MCA_LEDGER"
for line in "${lines[@]}"; do
IFS=$'\t' read -r kind path source <<< "$line"
[[ $kind == shadow && -n $source ]] || continue
[[ -e $source ]] && continue
# Only ever remove something still recognisably ours.
if [[ -f $path ]] && grep -q "^$MCA_MARK_SHADOW=" "$path" 2>/dev/null; then
rm -f -- "$path"
MCA_CHANGES=$(( MCA_CHANGES + 1 ))
fi
mca_ledger_forget "$path"
done
return 0
}
@@ -431,7 +467,7 @@ mca_revert_all() {
case "$kind" in
shadow)
# Only remove what is still recognisably ours.
if [[ -f $path ]] && grep -q '^X-MCA-Generated=' "$path" 2>/dev/null; then
if [[ -f $path ]] && grep -q "^$MCA_MARK_SHADOW=" "$path" 2>/dev/null; then
rm -f -- "$path"
MCA_CHANGES=$(( MCA_CHANGES + 1 ))
fi
+1 -3
View File
@@ -18,7 +18,6 @@
# The file comes back on every client update, and the watcher re-applies the
# patch when that happens.
MCA_STEAM_EXEC='exec ./steamwebhelper "$@"'
MCA_STEAM_LAUNCH_FLAG='-noverifyfiles'
# Every place a Steam installation is known to live, resolved and de-duplicated
@@ -106,7 +105,7 @@ mca_steam_apply() {
script="$(mca_steam_script "$root")" || continue
found=1
mca_steam_script_patched "$script" && { MCA_TOUCHED+=("$script"); continue; }
mca_steam_script_patched "$script" && continue
lineno="$(_mca_steam_exec_line "$script")"
if [[ -z $lineno ]]; then
@@ -125,7 +124,6 @@ mca_steam_apply() {
fi
chmod +x -- "$script" 2>/dev/null || true
mca_ledger_add steam "$script" "$backup"
MCA_TOUCHED+=("$script")
done < <(mca_steam_roots)
(( found ))
+16 -8
View File
@@ -76,11 +76,11 @@ mca_do_disable() {
}
mca_do_apply() {
local changed=0 arg
local rebuild=0 arg
for arg in "$@"; do
case "$arg" in
--changed) changed=1 ;;
--rebuild) rebuild=1 ;;
--quiet) MCA_QUIET=1 ;;
esac
done
@@ -95,17 +95,24 @@ mca_do_apply() {
return 1
fi
# A settings change can take an application out of scope as well as bring
# one in, and only a full undo can tell the difference, so that path starts
# from a clean slate. The watcher never does this: rewriting files that are
# already correct would make it trigger itself.
if (( changed )); then
# Start from a clean slate. Needed after a settings change, which can take
# an application out of scope as well as bring one in and where only a full
# undo can tell the difference, and it is what makes the repair a repair:
# whatever drifted is written again rather than left because it is "already
# applied".
#
# The watcher never does this. Rewriting files that are already correct
# would change their timestamps, and it is watching those directories.
if (( rebuild )); then
mca_revert
fi
mca_apply
if (( MCA_CHANGES )); then
if (( rebuild )); then
mca_ok "$(mca_msg "Applied again to %d applications." "$MCA_N_ON")"
mca_say " $(mca_msg "Applications that are already running pick this up when they are restarted.")"
elif (( MCA_CHANGES )); then
mca_ok "$(mca_msg "Applied to %d applications." "$MCA_N_ON")"
mca_say " $(mca_msg "Applications that are already running pick this up when they are restarted.")"
else
@@ -160,6 +167,7 @@ mca_do_help() {
enable $(mca_msg "Turn autoscroll on")
disable $(mca_msg "Turn it off and put everything back")
apply $(mca_msg "Apply to anything installed since the last run")
apply --rebuild $(mca_msg "Take everything back and apply it again")
status $(mca_msg "Show what is covered")
list $(mca_msg "List every application that was found")
-h, --help $(mca_msg "Show this help")