Apps API#

Name

Specification

Description

startupApplication

OBJECT_PATH property (read/write)

The default application to display after the user has logged in. Also known as the launcher.

lockscreenApplication

OBJECT_PATH property (read/write)

The lock screen application in use.

applications

ARRAY{STRING OBJECT_PATH}

property (read)

The list of all the applications registered with tarnish.

previousApplications

ARRAY{STRING} property (read)

List of previous applications that have been opened. This list drives the p reviousApplication method.

currentApplication

OBJECT_PATH property (read)

The currently running foreground application.

runningApplications

ARRAY{STRING OBJECT_PATH} property (read)

The list of currently running applications. The includes all the running background, and paused foreground applications.

pausedApplications

ARRAY{STRING OBJECT_PATH} property (read)

The list of paused foreground applications.

applicationRegistered

signal - (out) OBJECT_PATH

Signal sent when a new application is registered with tarnish.

applicationLaunched

signal - (out) OBJECT_PATH

Signal sent when an application has been launched.

applicationUnregistered

signal - (out) OBJECT_PATH

Signal sent when an application has been removed from tarnish.

applicationPaused

signal - (out) OBJECT_PATH

Signal sent when an application has been paused.

applicationResumed

signal - (out) OBJECT_PATH

Signal sent when an application has been resumed.

applicationExited

signal - (out) OBJECT_PATH - (out) INT32

Signal sent when an application has exited. The second output parameter contains the exit code.

openDefaultApplication

method

Launch or resume the application defined by `` startupApplication``

openTaskManager

method

Launch or resume the process manager.

openLockScreen

method

Launch or resume the application defined by loc kscreenApplication

registerApplication

method - (in) properties ARRAY{STRING VARIANT} - (out) OBJECT_PATH

Register a new application with tarnish.

unregisterApplication

method - (in) path OBJECT_PATH

Remove an application from tarnish.

reload

method

Reload applications registered with tarnish from disk.

getApplicationPath

method - (in) name STRING - (out) OBJECT_PATH

Returns the D-Bus path for an application based on it’s name. Will return / if the application does not exist.

previousApplication

method - (out) BOOLEAN

Launch or resume the previous application from pre viousApplications. Will also remove the application from the list.

Example Usage#

#include <liboxide.h>
#include "dbusservice_interface.h"
#include "appsapi_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 apps API...";
    QDBusObjectPath path = api.requestAPI("apps");
    if(path.path() == "/"){
        qDebug() << "Unable to get apps API";
        return EXIT_FAILURE;
    }
    qDebug() << "Got the apps API!";

    Apps appsApi(OXIDE_SERVICE, path.path(), bus);
    qDebug() << "Available applications" << appsApi.applications().keys();
    qDebug() << "Running applications" << appsApi.runningApplications().keys();
    return EXIT_SUCCESS;
}
#!/bin/bash
echo "Available applications"
rot apps get applications | jq 'keys'
echo "Running applications"
rot apps get runningApplications | jq 'keys'

Application Object#

Name

Specification

Description

name

STRING property (read)

Unique name used to reference the application.

processId

INT32 property (read)

Process Id of the application if it’s running. Will return 0 if the application is not running.

permissions

ARRAY STRING property (read/write)

List of permissions that the process has.

displayName

STRING property (read/write)

Name for the application to display to the user.

description

STRING property (read/write)

Description of the application.

bin

STRING property (read)

Path to the binary file used to launch the application.

onPause

STRING property (read/write)

Simple script to run when pausing the application.

onResume

STRING property (read/write)

Simple script to run when resuming the application.

onStop

STRING property (read/write)

Simple script to run when stopping the application.

autoStart

BOOLEAN property (read/write)

If this application should be automatically started when tarnish starts up.

type

INT32 property (read)

Type of application. - 0 Foreground application - 1 Background application - 2 Backgroundable application

state

INT32 property (read)

Current state of the application. - 0 Inactive - 1 Application is in the Foreground - 2 Application is in the Background - 3 Application is paused

systemApp

BOOLEAN property (read)

If this application is a system app or not.

hidden

BOOLEAN property (read)

If this application should be hidden from the user on any UI.

icon

STRING property (read/write)

Path to the icon used to represent this application.

environment

AR RAY{STRING STRING} property (read)

Map of environment variables to set for the process.

workingDirectory

STRING property (read/write)

Directory to set as the current working directory for the application.

chroot

BOOLEAN property (read)

If this application should be run in a chroot or not.

user

STRING property (read)

User the application will be run as.

group

STRING property (read)

Group the application will be run as.

directories

ARRAY STRING property (read/write)

Directories mapped into the chroot as read/write.

launched

signal

Signal sent when the application starts.

paused

signal

Signal sent when the application is paused.

resumed

signal

Signal sent when the application is resumed.

unregistered

signal

Signal sent when the application is removed from tarnish.

exited

signal - (out) INT32

Signal sent when the application exits. First signal parameter is the exit code of the application.

permissionsChanged

signal - (out) ARRAY STRING

Signal sent when the permissions of the application changes.

displayNameChanged

signal - (out) STRING

Signal sent when the displayName of the application changes.

onPauseChanged

signal - (out) STRING

Signal sent when the onPause of the application changes.

onResumeChanged

signal - (out) STRING

Signal sent when the onResume of the application changes.

onStopChanged

signal - (out) STRING

Signal sent when the onStop of the application changes.

autoStartChanged

signal - (out) BOOLEAN

Signal sent when autoStart for the application chagnes.

iconChanged

signal - (out) STRING

Signal sent when the icon of the application changes.

environmentChanged

signal - (out) ARRAY STRING

Signal sent when the environment of the application changes.

wor kingDirectoryChanged

signal - (out) STRING

Signal sent when the working directory of the application changes.

directoriesChanged

signal - (out) ARRAY STRING

Signal sent when the directories of the application changes.

launch

method

Launch or resume the application.

pause

method

Pause the application. If the application is backgroundable it will be moved into the background.

resume

method

Resume an application. If the application is backgroundable and in the background it will be moved into the foreground.

stop

method

Stop the application.

unregister

method

Remove the application from tarnish.

setEnvironment

method - (in) environment ARR AY{STRING VARIANT}

Change the environment of the application. Changes will be applied after the application restarts.

Example Usage#

#include <liboxide.h>
#include "dbusservice_interface.h"
#include "appsapi_interface.h"
#include "application_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 apps API...";
    QDBusObjectPath path = api.requestAPI("apps");
    if(path.path() == "/"){
        qDebug() << "Unable to get apps API";
        return EXIT_FAILURE;
    }
    qDebug() << "Got the apps API!";

    Apps appsApi(OXIDE_SERVICE, path.path(), bus);
    path = appsApi.currentApplication();
    Application app(OXIDE_SERVICE, path.path(), bus);
    qDebug() << "Current application:" << app.displayName();
    QString name("test");
    qDebug() << "Removing application: " << name;
    path = appsApi.getApplicationPath(name);
    if(path.path() == "/"){
         qDebug() << "Failed to find application: " << name;
         return EXIT_FAILURE;
    }
    if(!appsApi.unregisterApplication(path)){
         qDebug() << "Failed to unregister application: " << name;
         return EXIT_FAILURE;
    }
    return EXIT_SUCCESS;
}
#!/bin/bash
echo -n "Current application: "
rot apps get currentApplication \
  | jq -cr | sed 's|/codes/eeems/oxide1/||' \
  | xargs -I {} rot --object Application:{} apps get displayName \
  | jq -cr

name="test"
echo "Removing Application: $name"
rot apps call getApplicationPath "QString:\"$name\"" \
  | jq -cr | sed 's|/codes/eeems/oxide1/||' \
  | xargs -I {} rot --object Application:{} apps call unregister