Skip to content

Let gestures do something else in one app - #427

Open
budyn1211 wants to merge 1 commit into
trypsynth:masterfrom
budyn1211:per-app-gestures
Open

budyn1211 wants to merge 1 commit into
trypsynth:masterfrom
budyn1211:per-app-gestures

Conversation

@budyn1211

Copy link
Copy Markdown
Contributor

Every gesture does the same thing in every app, and the only way to make one behave differently in a single app is a script. As proposed in #411, this lets users give any gesture another action in one app, while the gestures they don't change keep their usual action.

What changes. A new gesture action, Set gestures for this app, opens the gesture list for the app with the item you're on. The same screen is reachable from a new Backtalk menu item, Set gestures for followed by the app's name, at the end of the menu. The menu item is off by default (Customize menus > Backtalk menu), and the action isn't assigned to any gesture. Each gesture on the app's list says Same as in other apps and its usual action until you choose another, and Same as in other apps is the first choice in its action list. Use the same gestures as in other apps sets all of the app's gestures back at once. Gesture settings > Gestures for apps lists the apps with gestures of their own. While you're on the keyboard, the app's gestures don't apply, since the keyboard is its own app. Backtalk's own screens always use the usual gestures, so settings can always be reached. Fingerprint gestures and gesture sets aren't per app, and it's hidden on watches. Nothing changes until a user sets a gesture for an app. differences.md describes it.

How. Each app's choice is stored next to the gesture's own preference, under the gesture's key followed by @app: and the package. GestureShortcutMapping.getActionKeyFromGestureId checks it first, so swipe and hold gestures and gesture hints follow the app too. It's one shared-preferences lookup per gesture, and the app comes from the last accessibility focus event, so nothing is read from the screen. The logic is in Backtalk's own files: AppGestures, AppGesturesFragment and AppGestureSettingsFragment. Changes to Google's files, as described in the issue:

  • GestureShortcutMapping: the lookup, a gesture id to preference key map, and the new action.
  • TalkBackService: one line passing accessibility events to AppGestures.
  • GestureController, TalkbackMenuProcessor, GestureListPreference: the new action and menu item.
  • GesturePreferenceFragmentCompat (phone): choosing Same as in other apps removes the app's preference.

Two small additions the issue didn't spell out: GesturePreferenceFragmentCompat (phone and wear) gets an overload of createBundleForFragmentArguments that takes the key, title, value and actions instead of a GestureListPreference, so the app's gesture list can open the same action list; and TalkBackPreferenceFilter gets entries that hide the feature on watches.

Testing. AppGesturesTest covers a gesture set for an app working only in that app, the app's other gestures keeping their action, an unassigned gesture, listing and removing apps with gestures, and Backtalk itself never getting gestures of its own. ./gradlew testPhoneDebugUnitTest :lintPhoneDebug :lintWearDebug passes on the branch rebased on the current master. I tested it on a Samsung Galaxy S24 with Android 16 and Speech Services by Google, as Backtalk Test, before rebasing on #396 and #408: gestures set for one app worked as described in #411. The rebase only had an import conflict in TalkBackService.

Fixes #411.

🤖 Generated with Claude Code

A new gesture action and Backtalk menu item, Set gestures for this app,
opens the gesture list for the app with the item you're on. Each gesture
there says Same as in other apps until you choose another action, and
Gesture settings > Gestures for apps lists the apps with gestures of
their own. Each app's choice is stored under the gesture's key followed
by the app's package, and GestureShortcutMapping checks it first. The
menu item is off by default, the action isn't assigned, and nothing
changes until a gesture is set for an app. Backtalk's own screens always
use the usual gestures, and it's hidden on watches.

Fixes trypsynth#411.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@trypsynth

Copy link
Copy Markdown
Owner

Thanks for this. I'm not going to take it, sorry. As the description says, scripts can already give a gesture another action in one app. I'd rather make that easier than add a second way to do the same thing that needs its own settings screen, menu item and changes to GestureController and GestureShortcutMapping. If something stops a script from doing what you want here, I'd welcome an issue or PR that adds it to the scripting API.

@trypsynth trypsynth closed this Nov 14, 2026
@trypsynth trypsynth reopened this Nov 14, 2026
@trypsynth

Copy link
Copy Markdown
Owner

Sorry, I closed this by mistake. I'd already said yes in #411, and you opened it as we agreed. I'm reopening it, and I'll review it properly. I'll mostly be checking that it stays as small as you described there, especially the changes to GestureController, GestureShortcutMapping and TalkbackMenuProcessor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: gestures that do something else in one app

2 participants