Repository navigation
feat(rules): toggle rules with keyboard shortcuts - #571
Merged
Merged
Conversation
Declares 10 toggle-rule-N commands without default keys (assigned in chrome://extensions/shortcuts). A rule can be assigned to a shortcut; pressing it toggles all rules of that shortcut as one group, shows ON/OFF on the toolbar icon, and re-applies rules in open tabs (restoring the page title when no rule applies anymore) and in the options page.
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
📦 Extension Build Ready!Version: 📥 Download Extension (tabee.zip)Installation
Status
🤖 Auto-generated by GitHub Actions |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #557.
Use case
Some rules are "session" rules (e.g.
News - {title}on any site, read by ActivityWatch). Turning them on and off meant going to the options page each time.Feature
toggle-rule-1…toggle-rule-10inmanifest.json, without default keys: Chrome only allows 4 suggested keys, and this avoids clashing with users' shortcuts. Users assign keys inchrome://extensions/shortcuts.NoneorShortcut 1…Shortcut 10, each showing the key already assigned (or "no key set"), plus a Set keys link that openschrome://extensions/shortcuts.ON/OFFbadge on the toolbar icon for 2 s (–when no rule uses that shortcut).reapplyRulesmessage). When no rule applies anymore, the page's own title is restored and the title observer is stopped (the favicon comes back on the next load). An open options page reloads its list.⌨ Nbadge next to rules that have a shortcut.Implementation
RuleShortcutService(background): command → slot, toggle, badge, propagation.RuleApplicationService.reset()(content): disconnect observers, restore the original title.Rule.shortcut?: number | null(optional, existing rules unaffected);RULE_SHORTCUT_SLOTSintypes.ts.Tests
manifest.jsondeclares exactly slots 1–10), group toggle (any enabled → all off, else all on, missingis_enabled, unused slot), badge, propagation (tabs without content script, no options page open),reset()(title restored, disabled rule not reapplied on the next title change, switching rules starts from the original title).⌨ 1, rule applied on load, disabled → original title restored without reload, re-enabled → applied again.vue-tscand build pass.