Screen API#

Name

Specification

Description

screenshots

` ARRAY OBJECT_PATH` property (read)

Get the list of screenshots on the device.

screenshotAdded

signal - (out) OBJECT_PATH

Signal sent when a screenshot is added.

screenshotRemoved

signal - (out) OBJECT_PATH

Signal sent when a screenshot is removed.

screenshotModified

signal - (out) OBJECT_PATH

Signal sent when a screenshot is modified.

addScreenshot

method - (in) blob ARRAY BYTE - (out) OBJECT_PATH

Add a screenshot taken by an application.

drawFullScreenImage

method - (in) path STRING - (out) BOOLEAN

Draw an image to the screen.

screenshot

method - (out) OBJECT_PATH

Take a screenshot.

Example Usage#

#include <liboxide.h>
#include "dbusservice_interface.h"
#include "screenapi_interface.h"

using namespace codes::eeems::oxide1;

int main(int argc, char* argv[]){
    Q_UNUSED(argc);
    Q_UNUSED(argv);

    auto bus = QDBusConnection::systemBus();
    General api(OXIDE_SERVICE, OXIDE_SERVICE_PATH, bus);
    qDebug() << "Requesting screen API...";
    QDBusObjectPath path = api.requestAPI("screen");
    if(path.path() == "/"){
        qDebug() << "Unable to get screen API";
        return EXIT_FAILURE;
    }
    qDebug() << "Got the screen API!";

    Screen screen(OXIDE_SERVICE, path.path(), bus);
    path = screen.screenshot();
    if(path.path() == "/"){
        qDebug() << "Screenshot failed";
    }else{
        qDebug() << "Screenshot taken";
    }
    return EXIT_SUCCESS;
}
#!/bin/bash
echo -n "Screenshot "
if [ $(rot screen call screenshot | jq -cr) = "/" ]; then
     echo "failed"
else
     echo "taken"
fi

Screenshot#

Name

Specification

Description

blob

ARRAY BYTE property (read/write)

The blob data of the screenshot.

path

STRING property (read)

The path to the screenshot on disk.

modified

signal

Signal sent when the screenshot is modified.

removed

signal

Signal sent when the screenshot is removed.

remove

method

Remove the screenshot from the device.

Example Usage#

#include <liboxide.h>
#include "dbusservice_interface.h"
#include "screenapi_interface.h"
#include "screenshot_interface.h"

using namespace codes::eeems::oxide1;

int main(int argc, char* argv[]){
    Q_UNUSED(argc);
    Q_UNUSED(argv);

    auto bus = QDBusConnection::systemBus();
    General api(OXIDE_SERVICE, OXIDE_SERVICE_PATH, bus);
    qDebug() << "Requesting screen API...";
    QDBusObjectPath path = api.requestAPI("screen");
    if(path.path() == "/"){
        qDebug() << "Unable to get screen API";
        return EXIT_FAILURE;
    }
    qDebug() << "Got the screen API!";

    Screen screen(OXIDE_SERVICE, path.path(), bus);
    for(auto path : screen.screenshots()){
        Screenshot(OXIDE_SERVICE, path.path(), bus).remove().waitForFinished();
    }
    qDebug() << "Screenshots removed";
    return EXIT_SUCCESS;
}
#!/bin/bash
rot screen get screenshots \
     | jq -cr 'values | join("\n")' \
     | sed 's|/codes/eeems/oxide1/||' \
     | xargs -rI {} rot --object Screenshot:{} screen call remove
echo "Screenshots removed"