Fix #822: add button to toggle Tridactyl

This commit is contained in:
Oliver Blanthorn 2022-04-28 13:08:16 +02:00
parent ab5e069fae
commit 31398ec903
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3
6 changed files with 136 additions and 1 deletions

View file

@ -84,6 +84,31 @@ browser.tabs.onActivated.addListener(ev => {
}) })
}) })
/**
* Let users disable Tridactyl by clicking the browserAction button
*/
browser.browserAction.onClicked.addListener(() => {
const toIgnore = config.get("superignore") == "true" ? "false" : "true"
const iconDetails = toIgnore == "true" ?
{ path : {
"64": "static/logo/Tridactyl_red_64px.png",
"100": "static/logo/Tridactyl_red_100px.png",
"150": "static/logo/Tridactyl_red_150px.png",
}} :
{ path: {
"64": "static/logo/Tridactyl_64px.png",
"100": "static/logo/Tridactyl_100px.png",
"150": "static/logo/Tridactyl_150px.png",
}}
if (toIgnore == "true") {
excmds_background.fillcmdline("Tridactyl disabled, refresh pages to take effect")
} else {
// TODO: work out how to send a notification even while Tridactyl is disabled
}
browser.browserAction.setIcon(iconDetails)
config.set("superignore", toIgnore)
})
/** /**
* Declare Tab Event Listeners * Declare Tab Event Listeners
*/ */

View file

@ -122,5 +122,13 @@
}, },
"omnibox": { "omnibox": {
"keyword": "tri" "keyword": "tri"
},
"browser_action": {
"browser_style": true,
"default_icon": {
"64": "static/logo/Tridactyl_64px.png",
"100": "static/logo/Tridactyl_100px.png",
"150": "static/logo/Tridactyl_150px.png"
}
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 110 KiB