Show menu title based on actual profile used on mobile.

This commit is contained in:
FelisCatus 2017-08-09 19:41:17 -04:00
parent 6f0f3e4636
commit 0ec584c93d
3 changed files with 14 additions and 5 deletions

View File

@ -135,12 +135,19 @@ actionForUrl = (url) ->
profileColor = current.color
icon ?= drawIcon(resultColor, profileColor)
shortTitle = 'Omega: ' + currentName # TODO: I18n.
if profile.name != currentName
shortTitle += ' => ' + profile.name # TODO: I18n.
return {
title: chrome.i18n.getMessage('browserAction_titleWithResult', [
currentName
dispName(profile.name)
details
])
shortTitle: shortTitle
icon: icon
resultColor: resultColor
profileColor: profileColor

View File

@ -430,6 +430,9 @@ class ChromeOptions extends OmegaTarget.Options
errorCount = @_requestMonitor?.tabInfo[tabId]?.errorCount
result = if errorCount then {errorCount: errorCount} else null
getBadge = new Promise (resolve, reject) ->
if not chrome.browserAction.getBadgeText?
resolve('')
return
chrome.browserAction.getBadgeText {tabId: tabId}, (result) ->
resolve(result)

View File

@ -45,10 +45,6 @@ class ChromeTabs
try chrome.browserAction.setBadgeText?(text: '', tabId: id)
@_badgeTab = null
if not chrome.browserAction.setPopup?
# TODO: Is there a way to show current proxy for page? Is there even
# enough space?
return
if not tab.url? or tab.url.indexOf("chrome") == 0
if @_defaultAction
chrome.browserAction.setTitle({
@ -59,7 +55,10 @@ class ChromeTabs
return
@actionForUrl(tab.url).then (action) =>
@setIcon(action.icon, tab.id)
chrome.browserAction.setTitle(title: action.title, tabId: tab.id)
if chrome.browserAction.setPopup?
chrome.browserAction.setTitle({title: action.title, tabId: tab.id})
else
chrome.browserAction.setTitle({title: action.shortTitle, tabId: tab.id})
setTabBadge: (tab, badge) ->
@_badgeTab ?= {}