Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: New tweak: preventChangingSearchEnginesByScrolling #23

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,16 @@ The script will only process the filtered set of Firefox paths.

### Available options

| Option flag | Default | Description |
|---------------------------------------------|:-------:|-------------|
| `--option autoCompleteCopiesToClipboard` | Off | This option requires `autoSelectCopiesToClipboard` to be set and is ignored without it. This option additionally enables copying selection in the URL bar triggered by typing a URL which is known by the browser (e.g. typing `gi` may autocomplete `github.com`, and the part `thub.com` is selected; the option enables automatically copying this selection to the clipboard). |
| `--option autoSelectCopiesToClipboard` | Off | <p>Certain actions trigger an automatic selection of text in the URL bar or the search bar which aren’t considered user-initiated and as such are not added to the selection clipboard (e.g. selected text which can be inserted with middle-click on Linux) — see <a href="https://github.com/SebastianSimon/firefox-omni-tweaks/wiki/Selection-clipboard-behavior">the wiki entry</a>.</p><p>This option enables clipboard selection for most cases: <kbd>Ctrl</kbd>+<kbd>L</kbd> or <kbd>F6</kbd> for URL bar selection; <kbd>Ctrl</kbd>+<kbd>K</kbd> for search bar selection; <kbd>Esc</kbd> to restore the original URL; <kbd>Tab</kbd> to focus either URL bar or search bar; or single-click or double-click selecting the entire text — if enabled.</p><p>However, additional options must be passed if selection triggered by a tab switch should also be copied (<code>tabSwitchCopiesToClipboard</code>), and if selection triggered by URL auto-complete should be copied (<code>autoCompleteCopiesToClipboard</code>).</p> |
| `--option clearSearchBarOnSubmit` | Off | Submitting a search from the separate search bar clears it. There’s discussion about this feature on <a href="https://superuser.com/q/319449/751213" title="Is it possible to automatically empty the Firefox search bar?">Super User</a> and on <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=253331" title="Search bar’s text should be cleared after a search is performed">Bugzilla</a>. |
| `--option doubleClickSelectsAll` | Off | Double-clicking the URL bar or the search bar selects the entire input field. |
| `--option preventClickSelectsAll` | On | Clicking the URL bar or the search bar no longer selects the entire input field. |
| `--option secondsSeekedByKeyboard=`_number_ | | Pressing <kbd>←</kbd> or <kbd>→</kbd> in the built-in video player (including Picture-in-Picture mode) seeks by _number_ seconds. [Bugzilla Bug 1668692](https://bugzilla.mozilla.org/show_bug.cgi?id=1668692) already changed this from 15 seconds to 5 seconds, but still didn’t offer an easily accessible option to change this duration. |
| `--option tabSwitchCopiesToClipboard` | Off | This option requires `autoSelectCopiesToClipboard` to be set and is ignored without it. This option additionally enables copying selection in URL bar triggered by switching to a tab with a focused URL bar (with either clicking or with <kbd>Ctrl</kbd>+(<kbd>Shift</kbd>)+<kbd>Tab</kbd>, <kbd>Ctrl</kbd>+<kbd>Page Up</kbd>, <kbd>Ctrl</kbd>+<kbd>Page Down</kbd>, <kbd>Alt</kbd>+<kbd>1</kbd>..<kbd>9</kbd>, and possibly other ways). |
| Option flag | Default | Description |
|----------------------------------------------------|:-------:|-------------|
| `--option autoCompleteCopiesToClipboard` | Off | This option requires `autoSelectCopiesToClipboard` to be set and is ignored without it. This option additionally enables copying selection in the URL bar triggered by typing a URL which is known by the browser (e.g. typing `gi` may autocomplete `github.com`, and the part `thub.com` is selected; the option enables automatically copying this selection to the clipboard). |
| `--option autoSelectCopiesToClipboard` | Off | <p>Certain actions trigger an automatic selection of text in the URL bar or the search bar which aren’t considered user-initiated and as such are not added to the selection clipboard (e.g. selected text which can be inserted with middle-click on Linux) — see <a href="https://github.com/SebastianSimon/firefox-omni-tweaks/wiki/Selection-clipboard-behavior">the wiki entry</a>.</p><p>This option enables clipboard selection for most cases: <kbd>Ctrl</kbd>+<kbd>L</kbd> or <kbd>F6</kbd> for URL bar selection; <kbd>Ctrl</kbd>+<kbd>K</kbd> for search bar selection; <kbd>Esc</kbd> to restore the original URL; <kbd>Tab</kbd> to focus either URL bar or search bar; or single-click or double-click selecting the entire text — if enabled.</p><p>However, additional options must be passed if selection triggered by a tab switch should also be copied (<code>tabSwitchCopiesToClipboard</code>), and if selection triggered by URL auto-complete should be copied (<code>autoCompleteCopiesToClipboard</code>).</p> |
| `--option clearSearchBarOnSubmit` | Off | Submitting a search from the separate search bar clears it. There’s discussion about this feature on <a href="https://superuser.com/q/319449/751213" title="Is it possible to automatically empty the Firefox search bar?">Super User</a> and on <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=253331" title="Search bar’s text should be cleared after a search is performed">Bugzilla</a>. |
| `--option doubleClickSelectsAll` | Off | Double-clicking the URL bar or the search bar selects the entire input field. |
| `--option preventClickSelectsAll` | On | Clicking the URL bar or the search bar no longer selects the entire input field. |
| `--option secondsSeekedByKeyboard=`_number_ | | Pressing <kbd>←</kbd> or <kbd>→</kbd> in the built-in video player (including Picture-in-Picture mode) seeks by _number_ seconds. [Bugzilla Bug 1668692](https://bugzilla.mozilla.org/show_bug.cgi?id=1668692) already changed this from 15 seconds to 5 seconds, but still didn’t offer an easily accessible option to change this duration. |
| `--option tabSwitchCopiesToClipboard` | Off | This option requires `autoSelectCopiesToClipboard` to be set and is ignored without it. This option additionally enables copying selection in URL bar triggered by switching to a tab with a focused URL bar (with either clicking or with <kbd>Ctrl</kbd>+(<kbd>Shift</kbd>)+<kbd>Tab</kbd>, <kbd>Ctrl</kbd>+<kbd>Page Up</kbd>, <kbd>Ctrl</kbd>+<kbd>Page Down</kbd>, <kbd>Alt</kbd>+<kbd>1</kbd>..<kbd>9</kbd>, and possibly other ways). |
| `--option preventChangingSearchEnginesByScrolling` | Off | Scrolling with Control held or zooming on the search bar no longer changes the current search engine. |

### Examples

Expand Down
12 changes: 11 additions & 1 deletion fixfx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ declare -A settings=(
[options|preventClickSelectsAll]='on'
[options|secondsSeekedByKeyboard]=''
[options|tabSwitchCopiesToClipboard]=''
[options|preventChangingSearchEnginesByScrolling]=''
[quiet]=''
# End presets.
)
Expand Down Expand Up @@ -143,7 +144,7 @@ fix_option_default_value(){
local -r fix_key="${1}"

case "${fix_key}" in
'autoCompleteCopiesToClipboard' | 'autoSelectCopiesToClipboard' | 'clearSearchBarOnSubmit' | 'doubleClickSelectsAll' | 'preventClickSelectsAll' | 'tabSwitchCopiesToClipboard')
'autoCompleteCopiesToClipboard' | 'autoSelectCopiesToClipboard' | 'clearSearchBarOnSubmit' | 'doubleClickSelectsAll' | 'preventClickSelectsAll' | 'tabSwitchCopiesToClipboard' | 'preventChaningSearchEnginesByScrolling')
echo 'on'
;;
*)
Expand Down Expand Up @@ -223,6 +224,11 @@ FIX_OPTION_KEYs:
Requires autoSelectCopiesToClipboard. Also copies
selection to clipboard when switching tabs;
${settings[options|autoCompleteCopiesToClipboard]:-off} by default.

preventChangingSearchEnginesByScrolling
Scrolling with Control held or zooming on the
search bar no longer changes search engines;
${settings[options|preventChangingSearchEnginesByScrolling]:-off} by default.

Examples:
# Fix all Firefox installations that are automatically found, then
Expand Down Expand Up @@ -735,6 +741,10 @@ edit_and_lock_based_on_options(){
edit_file 'secondsSeekedByKeyboard' 'omni' 'chrome/toolkit/content/global/elements/videocontrols.js' "s/(newval = oldval [+-] |static SEEK_TIME_SECS = )[0-9]+;/\1${settings[options|secondsSeekedByKeyboard]-};/"
edit_file 'secondsSeekedByKeyboard' 'omni' 'actors/PictureInPictureChild.jsm' "s/(newval = oldval [+-] |const SEEK_TIME_SECS = )[0-9]+;/\1${settings[options|secondsSeekedByKeyboard]-};/"
fi

if [[ "${settings[options|preventChangingSearchEnginesByScrolling]-}" ]]; then
edit_file 'preventChangingSearchEnginesByScrolling' 'browser_omni' 'chrome/browser/content/browser/search/searchbar.js' '/this\.addEventListener\(/,/"DOMMouseScroll"/ s/this\.addEventListener//'
fi
}

prepare_backup_instructions(){
Expand Down