On Thursday, 22 September 2016 at 02:21:16 UTC, Konstantin Kutsevalov wrote:
On Wednesday, 21 September 2016 at 16:36:32 UTC, Adam D. Ruppe wrote:
On Wednesday, 21 September 2016 at 16:33:58 UTC, Konstantin Kutsevalov wrote:
do anybody know how to get screenshot (for now in Linux only)? May be some library , examples?

simplest might be to just call out to `shellExec("import -window root filename.png");` and it will write the file.

Hmm, that's good idea as fast solution. Thank you Adam.

Hi Konstantin,

I've got a simple example in Vala language but it's very easy to rewrite it in D thank's to GtkD (and also thanks to Mike Wey for his work in GtkD!):

//  compile: valac --pkg gtk+-3.0 --pkg gdk-3.0  screenshot.vala

int main (string[] args) {
    Gtk.init (ref args);

    int  width, height;

    Gdk.Window win = Gdk.get_default_root_window();

    width = win.get_width();
    height = win.get_height();

Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, height);

    return 0;

Reply via email to