chrome.wallpaper
- Description
Use the
chrome.wallpaper
API to change the ChromeOS wallpaper. - Permissions
wallpaper
Manifest #
You must declare the "wallpaper" permission in the app's manifest to use the wallpaper API. For example:
{
"name": "My extension",
...
"permissions": [
"wallpaper"
],
...
}
Examples #
For example, to set the wallpaper as the image at http://example.com/a_file.png
, you can call chrome.wallpaper.setWallpaper
this way:
chrome.wallpaper.setWallpaper(
{
'url': 'http://example.com/a_file.jpg',
'layout': 'CENTER_CROPPED',
'filename': 'test_wallpaper'
},
function() {}
);
Summary
- Types
- Methods
chrome.wallpaper.setWallpaper(details: object, callback: function)
Types
WallpaperLayout
The supported wallpaper layouts.
Enum
"STRETCH"
, "CENTER"
, or "CENTER_CROPPED"
Methods
setWallpaper
chrome.wallpaper.setWallpaper(details: object, callback: function)
Sets wallpaper to the image at url or wallpaperData with the specified layout
Parameters
- detailsobject
- dataArrayBuffer optional
The jpeg or png encoded wallpaper image as an ArrayBuffer.
- filenamestring
The file name of the saved wallpaper.
- layout
The supported wallpaper layouts.
- thumbnailboolean optional
True if a 128x60 thumbnail should be generated. Layout and ratio are not supported yet.
- urlstring optional
The URL of the wallpaper to be set (can be relative).
- callbackfunction
The callback parameter should be a function that looks like this:
(thumbnail: ArrayBuffer) => {...}
- thumbnailArrayBuffer
The jpeg encoded wallpaper thumbnail. It is generated by resizing the wallpaper to 128x60.