Add screenshot interface
Adds methods to shell_global to allow taking screenshots save the result into a specified png image. It exposes three methods via shellDBus applications like gnome-screenshot: *) Screenshot (screenshots the whole screen) *) ScreenshotWindow (screenshots the focused window) *) ScreenshotArea (screenshots a specific area) https://bugzilla.gnome.org/show_bug.cgi?id=652952
This commit is contained in:
@ -23,6 +23,18 @@ const GnomeShellIface = {
|
||||
{ name: 'GetExtensionErrors',
|
||||
inSignature: 's',
|
||||
outSignature: 'as'
|
||||
},
|
||||
{ name: 'ScreenshotArea',
|
||||
inSignature: 'iiiis',
|
||||
outSignature: 'b'
|
||||
},
|
||||
{ name: 'ScreenshotWindow',
|
||||
inSignature: 'bs',
|
||||
outSignature: 'b'
|
||||
},
|
||||
{ name: 'Screenshot',
|
||||
inSignature: 's',
|
||||
outSignature: 'b'
|
||||
}
|
||||
],
|
||||
signals: [],
|
||||
@ -76,6 +88,50 @@ GnomeShell.prototype = {
|
||||
return [success, returnValue];
|
||||
},
|
||||
|
||||
/**
|
||||
* ScreenshotArea:
|
||||
* @x: The X coordinate of the area
|
||||
* @y: The Y coordinate of the area
|
||||
* @width: The width of the area
|
||||
* @height: The height of the area
|
||||
* @filename: The filename for the screenshot
|
||||
*
|
||||
* Takes a screenshot of the passed in area and saves it
|
||||
* in @filename as png image, it returns a boolean
|
||||
* indicating whether the operation was successful or not.
|
||||
*
|
||||
*/
|
||||
ScreenshotAreaAsync : function (x, y, width, height, filename, callback) {
|
||||
global.screenshot_area (x, y, width, height, filename, function (obj, result) { callback(result); });
|
||||
},
|
||||
|
||||
/**
|
||||
* ScreenshotWindow:
|
||||
* @include_frame: Whether to include the frame or not
|
||||
* @filename: The filename for the screenshot
|
||||
*
|
||||
* Takes a screenshot of the focused window (optionally omitting the frame)
|
||||
* and saves it in @filename as png image, it returns a boolean
|
||||
* indicating whether the operation was successful or not.
|
||||
*
|
||||
*/
|
||||
ScreenshotWindow : function (include_frame, filename) {
|
||||
return global.screenshot_window (include_frame, filename);
|
||||
},
|
||||
|
||||
/**
|
||||
* Screenshot:
|
||||
* @filename: The filename for the screenshot
|
||||
*
|
||||
* Takes a screenshot of the whole screen and saves it
|
||||
* in @filename as png image, it returns a boolean
|
||||
* indicating whether the operation was successful or not.
|
||||
*
|
||||
*/
|
||||
ScreenshotAsync : function (filename, callback) {
|
||||
global.screenshot(filename, function (obj, result) { callback(result); });
|
||||
},
|
||||
|
||||
ListExtensions: function() {
|
||||
return ExtensionSystem.extensionMeta;
|
||||
},
|
||||
|
Reference in New Issue
Block a user