vivaldi.utilities Modders API Reference
Vivaldi general support api.
Types
#Color
Object defining an RGB color.
Properties:
- red
integer
Red color.
- green
integer
Green color.
- blue
integer
Blue color.
#GetEnvVarsResponse
- GetEnvVarsResponse
object
Object containing valid environment variable values.
Object Properties:
- type
string
#WindowState
ENUM
The state of this browser window.
- normal: Normal window state (i.e. not minimized, maximized, or fullscreen).
- minimized: Minimized window state.
- maximized: Maximized window state.
- fullscreen: Fullscreen window state.
#WindowType
ENUM
Type of window. normal is a browser-window.
- normal
- popup
- settings
#WindowRestoreState
ENUM
State of window after going out of fullscreen.
- normal
- minimized
- maximized
#WindowRestoreStateFromFullscreen
ENUM
State of window after going out of html-fullscreen.
- normal
- minimized
- maximized
- fullscreen
#StatusbarMode
ENUM
Statusbar view setting. 'on' | 'off' | 'overlay' (StatusBarDisplayValues from gen/prefs/prefNames.js)
- on
- off
- overlay
#WindowProperties
Type WindowState in ./stores/WindowStore.js
Properties:
- type
WindowType
⚠ NO DESCRIPTION PROVIDED
- state
- (optional)
WindowState
⚠ NO DESCRIPTION PROVIDED
- restoreStateFullscreen
WindowRestoreState
⚠ NO DESCRIPTION PROVIDED
- restoreStateHtml5Fullscreen
WindowRestoreStateFromFullscreen
⚠ NO DESCRIPTION PROVIDED
- nativeDecorations
boolean
Window is uses native window-controls.
- incognito
boolean
Window is incognito.
- guest
boolean
Window is guest.
- html5FullScreen
boolean
Window is fullscreened through htmlelement.requestFullScreen.
- active
boolean
Window is active.
- minimalUI
- (optional)
boolean
Window is incognito.
- visibleUI
object
⚠ NO DESCRIPTION PROVIDED
Object Properties:
- bookmarksBar
boolean
Showing bookmarksbar.
- addressBar
boolean
Showing addressbar.
- panelToggle
boolean
Showing panel-toggle.
- tabs
boolean
Showing tabs.
- statusBar
StatusbarMode
⚠ NO DESCRIPTION PROVIDED
#BroadcastAction
Identifies broadcast type. Only one property should be used.
Properties:
- startDragging
- (optional)
boolean
⚠ NO DESCRIPTION PROVIDED
- endDragging
- (optional)
boolean
⚠ NO DESCRIPTION PROVIDED
- translate
- (optional)
object
⚠ NO DESCRIPTION PROVIDED
Object Properties:
- winId
number
The window where translation takes place.
- lang
string
Language of text to be translated.
- text
string
Text to be translated.
#DialogName
ENUM
Name of the dialog to set position for.
- chromecast: The Chromecast dialog with source and destination. Centered over the active webview.
- password: The password dialog opening to save a password.
- permission: The permission dialog allowing or blocking one or more permissions.
#CookieMode
ENUM
CookieMode enumeration, corresponds to CookieControlsMode in chromium/components/content_settings/core/browser/cookie_settings.h
- off: All cookies allowed.
- BlockThirdParty: Block third party cookies.
- BlockThirdPartyIncognitoOnly: Block third party cookies in incognito mode only.
#FlowDirection
ENUM
The direction a dialog would be opened from the given rect.
- down: Dialog should position itself below the given rect.
- up: Dialog should position itself above the given rect.
#UrlValidResults
Object that describes the validitity of a given url.
Properties:
- urlValid
boolean
The url is a correctly formatted url. This might be true even if the protocol is not valid.
- isBrowserUrl
boolean
The url can be shown directly by the browser.
- schemeParsed
string
The parsed and authorative protocol scheme as parsed by Chromium.
- normalizedUrl
string
Returns the raw spec, i.e., the full text of the URL, in canonical UTF-8, if the URL is valid.
#WhatsNewResults
Object that describes how a What's new page can be used.
Properties:
- show
boolean
true if the What's new page can be shown, otherwise false.
- firstrun
boolean
true if this the first time the Whats new page is shown. Do not use if 'show' is false.
#UrlFragments
Object with url fragments, including top level domain which is eTLD aware.
Properties:
- scheme
- (optional)
string
If URL cannot be parsed at all, this will be absent
- username
- (optional)
string
⚠ NO DESCRIPTION PROVIDED
- password
- (optional)
string
⚠ NO DESCRIPTION PROVIDED
- host
- (optional)
string
⚠ NO DESCRIPTION PROVIDED
- port
- (optional)
string
⚠ NO DESCRIPTION PROVIDED
- path
- (optional)
string
⚠ NO DESCRIPTION PROVIDED
- query
- (optional)
string
⚠ NO DESCRIPTION PROVIDED
- ref
- (optional)
string
⚠ NO DESCRIPTION PROVIDED
- tld
- (optional)
string
⚠ NO DESCRIPTION PROVIDED
- urlForSecurityDisplay
- (optional)
string
URL formatted for security display, meaning formatted in unicode in a way to avoid IDN homograph attack.
- tldForSecurityDisplay
- (optional)
string
TLD for security display
- hostForSecurityDisplay
- (optional)
string
Host for security display
- pathForSecurityDisplay
- (optional)
string
Path for security display
- queryForSecurityDisplay
- (optional)
string
Query for security display
- refForSecurityDisplay
- (optional)
string
ref for security display
#FileExtension
A single extension item used for filtering
Properties:
- ext
string
Extension ending, eg. 'jpg'
#SelectFileDialogType
ENUM
The type of selectfile dialog to show.
- file: This is a file select dialog.
- save_file: This is a file select dialog, allowing to choose a nonexistent file for saving.
- folder: This is a folder select dialog.
#SelectFileOptions
Option object for selectFile.
Properties:
- windowId
integer
Id of the window to show the file selection dialog against.
- title
string
Title of the file select dialog.
- type
SelectFileDialogType
Type of file select dialog, defaults to 'file'.
- accepts
- (optional)
Extensions to filter file names on.
Array
of:- FileExtension
- defaultPath
- (optional)
string
The file's default path and name.
#SelectLocalImageParams
Option object for selectLocalImage.
Properties:
- windowId
integer
Id of the window to show the file selection dialog against.
- title
string
Title for the file selection dialog.
- profileImage
- (optional)
boolean
Store the image path as the path for a custom profile avatar.
- themeId
- (optional)
string
The id of theme to store the background image in.
- thumbnailBookmarkId
- (optional)
string
The bookmark id where to store the selected local path.
#StoreImageOptions
Option object for storeImage.
Properties:
- url
- (optional)
string
The URL to read the data from. Currently only the file URL is supported.
- data
- (optional)
binary
The image data.
- mimeType
- (optional)
string
The type of the image.
- themeId
- (optional)
string
The id of theme to store the image as theme background.
#SharedDataValue
Data key+value pair.
Properties:
- key
string
The data key.
- value
any
The data value.
#DateFormats
An object containing various system date/time formats
Properties:
- shortDateFormat
string
Short date format.
- longDateFormat
string
Long date format.
- timeFormat
string
12/24 hour time format string
- firstDayOfWeek
number
The first day of the week. 0-6 (Sunday to Saturday)
#CaptureQRDestination
ENUM
Where to store the generated QR code
- dataurl: Store as a returned data url.
- file: Store in the download location.
- clipboard: Store in the clipboard
#GetVersionResults
⚠ NO DESCRIPTION PROVIDED
Properties:
- vivaldiVersion
string
The Vivaldi version as a string.
- chromiumVersion
string
The Chromium version as a string.
#TranslateError
ENUM
The error messages translate can return.
- no_error
- network
- unknown_language
- unsupported_language
- timeout
- error
#TranslateTextResponse
⚠ NO DESCRIPTION PROVIDED
Properties:
- error
TranslateError
⚠ NO DESCRIPTION PROVIDED
- detectedSourceLanguage
string
Language code of the detected language code of the provided source text, if any.
- sourceText
The original source strings.
Array
of:- string
- translatedText
The translated text corresponding to the given sourceText.
Array
of:- string
#ReadImageData
An object that defines the data read from the image file.
Properties:
- data
Read image as raw bytes.
Array
of:- integer
- type
string
Mime type of the read image.
#DirectMatchItem
A Direct match item
Properties:
- name
string
⚠ NO DESCRIPTION PROVIDED
- title
string
⚠ NO DESCRIPTION PROVIDED
- click_url
string
⚠ NO DESCRIPTION PROVIDED
- target_url
string
⚠ NO DESCRIPTION PROVIDED
- image_url
string
⚠ NO DESCRIPTION PROVIDED
- image_path
string
⚠ NO DESCRIPTION PROVIDED
Listeners
How to use listeners
Each listener type has the same functions, used for each listener API in the same way:
.addListener(function
callback)
Adds a function to a listener for an event
.removeListener(function
callback)
Removes a function to a listener for an event
.hasListener(function
callback)
Returns a boolean if a function is attached to a listener for an event
.hasListeners()
Returns a boolean if a listener has any attached functions
.dispatch()
Returns array of promises dispatched to the listener
#onScroll
Fires for Mac when scroll device changes.
Parameters:
- scrollType
integer
Device that triggers scrolling. 1: Mouse, 2: Trackpad 3: Inertial
#onSharedDataUpdated
Fires when a shared data value has changed or been added.
Parameters:
- key
string
Name of the key for the value.
- value
any
The new value for the key.
#onSuspend
Fired when the computer is about to suspend.
#onResume
Fired when the computer has resumed from suspension.
#onPasswordIconStatusChanged
Fires for password icon status change.
Parameters:
- windowId
integer
Window id to show/hide icon for
- show
boolean
Whether to show or hide icon
#onDownloadManagerReady
Fired when the download manager has loaded all its data.
#onRazerChromaReady
Fired when the Razer Chroma API has been initialized.
#onTopSitesChanged
Fired when topsites list has changed.
#onBroadcastMessage
Test.
Parameters:
- message
BroadcastAction
The message to receive.
#onShowQRCode
Fired when Chromium wants us to show a QR code for the given url.
Parameters:
- url
string
The url to show the QR code for.
Methods
Open print preview dialog.
Parameters:
- windowId
integer
WindowId of browser printing active tab.
#clearAllRecentlyClosedSessions
Clears the list of recently closed tabs and/or windows.
#clearRecentlyClosedTabs
Clears one or more recently closed tabs.
Parameters:
- ids
⚠ NO DESCRIPTION PROVIDED
Array
of:- string
#isTabInLastSession
Checks whether a given tab is part of the last loaded session
Parameters:
- tabId
integer
The tab id to check if part of the session
#isUrlValid
Validates given URL. Returns UrlValidResults with the results.
Parameters:
- url
string
The URL to validate
#canOpenUrlExternally
Check if the browser can potentially open the URL using an external application or an extension. This should only be called if it is already known that the URL is a valid one and is not handled by the browser directly to get a valid result.
Parameters:
- url
string
The URL to check
#getUrlFragments
Splits given URL. Returns UrlFragments including top level domain which is eTLD aware.
Parameters:
- url
string
The URL to process.
#urlToThumbnailText
Gets the text for a fallback speeddial thumbnail
Parameters:
- url
string
The URL to get the text from.
#getSelectedText
Returns selected text in page with given id
Parameters:
- tabId
integer
The page to examine
#selectFile
Select a single file and returns the file name.
Parameters:
- options
SelectFileOptions
⚠ NO DESCRIPTION PROVIDED
#selectLocalImage
Ask the user to select an image file and store its path as a data mapping URL in a bookmark or a preference.
Parameters:
- params
SelectLocalImageParams
⚠ NO DESCRIPTION PROVIDED
#cleanUnusedImages
Cleans unused images (thumbnails)
Parameters:
- createdBefore
integer
Run only if createdBefore <= the number of the images created sinct the last cleanup.
#storeImage
Save image from the memory blob to the image store and return related chrome:// URL.
Parameters:
- options
StoreImageOptions
⚠ NO DESCRIPTION PROVIDED
#getVersion
Gets the Vivaldi version and Chromium versions.
#getEnvVars
Gathers values of environment variables specified in the first argument, returns a list of pairs containing keys and values (or none in case the variable does not exist)
Parameters:
- keys
list of names of environment variables
Array
of:- string
#getMediaAvailableState
Windows: Returns whether this version of the OS has media codecs installed. Might return false on N versions of Windows.
#setSharedData
Sets the given data to be kept in-memory for the duration of the Vivaldi setting (until Vivaldi exits).
Parameters:
- keyValuePair
SharedDataValue
The Key-value.
#getSharedData
Gets the given data from the in-memory storage.
Parameters:
- keyValuePair
SharedDataValue
The Key-value, the value is the default value returned if the key does not exist.
#takeMutex
Uses the in-memory storage to synchronize access to a resource accross several vivaldi extension processes (until Vivaldi exits).
Parameters:
- name
string
A name uniquely identifying the mutex.
- wait
- (optional)
boolean
Whether to wait for the mutex to be available or to to throw an error if it isn't. Defaults to true.
#releaseMutex
Relinquish use of a mutex obtained in takeSharedMutex.
Parameters:
- handle
any
The handle to the mutex, returned from takeSharedMutex.
#getSystemDateFormat
Returns various date/time system formats
#getSystemCountry
Return the system settings for the country if available.
#setLanguage
Sets the Vivaldi language code.
Parameters:
- locale
string
⚠ NO DESCRIPTION PROVIDED
#getLanguage
Gets the active Vivaldi language code.
#setVivaldiAsDefaultBrowser
Set Vivaldi as the default browser.
#isVivaldiDefaultBrowser
Is Vivaldi the default browser.
#launchNetworkSettings
Launch network settings.
Parameters:
- windowId
integer
⚠ NO DESCRIPTION PROVIDED
#savePage
Saves web page.
Parameters:
- tabId
integer
Id to of page being saved.
#openPage
Open web page.
Parameters:
- windowId
integer
WindowId of browser opening a local file.
#broadcastMessage
Broadcast a message to all windows. Works from regular to private windows as well.
Parameters:
- message
BroadcastAction
The message to send.
#setDefaultContentSettings
Set Vivaldi default content settings.
Parameters:
- contentSetting
string
⚠ NO DESCRIPTION PROVIDED
- value
string
⚠ NO DESCRIPTION PROVIDED
#getDefaultContentSettings
Set Vivaldi default content settings.
Parameters:
- contentSetting
string
⚠ NO DESCRIPTION PROVIDED
#setBlockThirdPartyCookies
Set Vivaldi default content settings.
Parameters:
- cookieMode
CookieMode
Cookie control for third party cookies.
#getBlockThirdPartyCookies
Set Vivaldi default content settings.
#openTaskManager
Opens Vivaldi task manager dialog.
Parameters:
- windowId
integer
⚠ NO DESCRIPTION PROVIDED
#createQRCode
Opens the QR Code bubble window for the given page.
Parameters:
- id
integer
The id of the page.
#getStartupAction
Returns the startup action.
#setStartupAction
Returns the startup action.
Parameters:
- startup
string
⚠ NO DESCRIPTION PROVIDED
- urls
⚠ NO DESCRIPTION PROVIDED
Array
of:- string
#canShowWhatsNewPage
Checks whether showing the What's new page is allowed.
#showPasswordDialog
Shows password manage dialog.
Parameters:
- windowId
integer
The window id the dialog belongs to.
#setDialogPosition
Sets the opening position for the given Chromium-triggered dialog.
Parameters:
- dialogName
DialogName
The window to set the position for.
- windowId
integer
The window id the dialog belongs to.
- position
object
⚠ NO DESCRIPTION PROVIDED
Object Properties:
- left
integer
Anchor left position in client coordinates.
- top
integer
Anchor top position in client coordinates.
- width
integer
Anchor width.
- height
integer
Anchor height.
- flowDirection
FlowDirection
The direction the dialog should be positioned based on the rect.
#isRazerChromaAvailable
Is the Razer Chroma API available.
#isRazerChromaReady
Is the Razer Chroma API initialized and ready to accept commands.
#setRazerChromaColor
Set the color(s) for the configured Razer Chroma lights.
Parameters:
- colors
⚠ NO DESCRIPTION PROVIDED
Array
of:- Color
- Array of colors to be set for the configured lights. If multiple colors are set, it will cycle quickly between them from the first to the last.
#isDownloadManagerReady
Checks whether the download manager has initialized. If not, register for the onDownloadManagerReady event to be notified when it's ready.
#setContentSettings
Set a contentsetting for a pattern .
Parameters:
- details
object
⚠ NO DESCRIPTION PROVIDED
Object Properties:
- primaryPattern
string
The pattern for the primary URL. For details on the format of a pattern, see Content Setting Patterns.
- secondaryPattern
- (optional)
string
The pattern for the secondary URL. Defaults to matching all URLs. For details on the format of a pattern, see Content Setting Patterns.
- type
string
The resource identifier for the content type.
- value
string
The setting applied by this rule. See the description of the individual ContentSetting objects for the possible values.
- incognito
- (optional)
boolean
Where to set the setting (default: regular).
#isDialogOpen
Checks whether the given native dialog is open.
Parameters:
- dialogName
DialogName
Dialog name to check for visibility.
#focusDialog
Focus the named dialog so keyboard navigation within it is available.
Parameters:
- dialogName
DialogName
Dialog name to check for visibility.
#startChromecast
Shows the Chromecast dialog.
Parameters:
- windowId
integer
Window id where casting should start.
#isFirstRun
chrome::IsChromeFirstRun()
#generateQRCode
Generate a QR image based on the given data.
Parameters:
- data
string
Data to encode in the QR code. The maximum length of the data is 288 bytes.
- destination
- (optional)
CaptureQRDestination
Destination of the QR capture, defaults to 'dataurl'.
#getGAPIKey
Returns G API key.
#getVivaldiNetOAuthClientSecret
Returns Vivaldi.net OAuth client secret.
#getVivaldiNetOAuthClientId
Returns Vivaldi.net OAuth client id.
#getGOAuthClientId
Returns G OAuth API client id.
#getGOAuthClientSecret
Returns G OAuth API client secret.
#getMOAuthClientId
Returns MS OAuth API client id.
#getYOAuthClientId
Returns Yahoo OAuth client id.
#getYOAuthClientSecret
Returns Yahoo OAuth client secret.
#getFOAuthClientId
Returns Fastmail OAuth client id.
#getAOLOAuthClientId
Returns AOL OAuth client id.
#getAOLOAuthClientSecret
Returns AOL OAuth client secret.
#getCommandLineValue
Gets the command line value for the given named argument.
Parameters:
- value
string
Name of the command line switch without initial dashes eg. translate-server-url.
#hasCommandLineSwitch
Check if the command line has switch present for the given argument.
Parameters:
- value
string
Name of the command line switch without initial dashes eg. translate-server-url.
#osCrypt
⚠ NO DESCRIPTION PROVIDED
Parameters:
- plain
string
The content to encrypt
#osDecrypt
⚠ NO DESCRIPTION PROVIDED
Parameters:
- encrypted
string
The content to decrypt
#translateText
⚠ NO DESCRIPTION PROVIDED
Parameters:
- sourceLanguageCode
string
The language code of the source text, or empty if you want the server to try to detect the language.
- destinationLanguageCode
string
The destination language code.
- sourceText
The strings to translate.
Array
of:- string
#showManageSSLCertificates
Show the OS manage certificates dialog.
Parameters:
- windowId
integer
The window to use as parent window for the dialog
#setProtocolHandling
Turn on/off protocol handling for web pages.
Parameters:
- enabled
boolean
Turn on/off protocol handling for web pages.
#browserWindowReady
Signals that JS has fully set up browser window and its event listeners.
Parameters:
- windowId
number
⚠ NO DESCRIPTION PROVIDED
#readImage
Reads an image file from the file system from the specified URL to the object.
Parameters:
- url
string
⚠ NO DESCRIPTION PROVIDED
#detectNewCrashes
Checks to see if there are any new crash reports since the last function call.
#isRTL
Checks if current locale Right-To-Left locale.
#getDirectMatch
Get DirectMatch item that best matches the query
Parameters:
- query
string
The query to search in items
#emulateUserInput
Notifies render there has been user driven input. To be used when normal input is not detected in render because of blocking event loop handling (eg when menus are open).
Parameters:
- windowId
number
⚠ NO DESCRIPTION PROVIDED
#isVivaldiPinnedToLaunchBar
Check is Vivaldi pinned to the launch bar. If pinning is not available, throws an Error.
#pinVivaldiToLaunchBar
Pin Vivaldi icon to the launch bar.
#downloadsDrag
Start a native drag for the downloads items.
Parameters:
- windowId
integer
⚠ NO DESCRIPTION PROVIDED
- downloadIds
Array of IDs of the download items to initiate the drag.
Array
of:- integer