Skip to content

Commit

Permalink
Merge branch 'master' into compositor
Browse files Browse the repository at this point in the history
  • Loading branch information
Eeems committed Oct 4, 2024
2 parents 8778b9e + 67cd2ce commit 9688b4a
Show file tree
Hide file tree
Showing 196 changed files with 5,374 additions and 1,226 deletions.
22 changes: 12 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.12'
- name: Install toltecmk
run: pip install toltecmk requests==2.26.0
- name: Build packages
Expand Down Expand Up @@ -133,20 +133,22 @@ jobs:
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_URL: https://sentry.eeems.codes
- name: Setup Sentry CLI
uses: mathieu-bour/setup-sentry-cli@v2
with:
version: latest
url: https://sentry.eeems.codes
token: ${{ secrets.SENTRY_AUTH_TOKEN }}
organization: ${{ secrets.SENTRY_ORG }}
project: ${{ secrets.SENTRY_PROJECT }}
- name: Upload debug artifacts (debug)
run: curl -sL https://sentry.io/get-cli/ | bash
- name: Upload debug artifacts
if: ${{ !runner.debug }}
run: sentry-cli debug-files upload --include-sources .
env:
SENTRY_LOG_LEVEL: info
- name: Upload debug artifacts
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_URL: https://sentry.eeems.codes
- name: Upload debug artifacts (debug)
if: ${{ runner.debug }}
run: sentry-cli debug-files upload --include-sources .
env:
SENTRY_LOG_LEVEL: debug
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_URL: https://sentry.eeems.codes
2 changes: 1 addition & 1 deletion applications/settings-manager/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ int main(int argc, char *argv[]){
if(args.length() == 3 && args.at(2) == "crash"){
trigger_crash();
}else if(args.length() == 3 && args.at(2) == "transaction"){
sentry_transaction("settings", "transaction", [](Transaction* t){
sentry_transaction("Dummy rot transaction", "transaction", [](Transaction* t){
sentry_span(t, "span", "Transaction span", []{
qDebug() << "Triggered transaction";
});
Expand Down
12 changes: 6 additions & 6 deletions applications/system-service/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void Application::launchNoSecurityCheck(){
#endif
startSpan("starting", "Application is starting");
}
Oxide::Sentry::sentry_transaction("application", "launch", [this](Oxide::Sentry::Transaction* t){
Oxide::Sentry::sentry_transaction("Launch Application", "launch", [this](Oxide::Sentry::Transaction* t){
#ifdef SENTRY
if(t != nullptr){
sentry_transaction_set_tag(t->inner, "application", name().toStdString().c_str());
Expand Down Expand Up @@ -131,7 +131,7 @@ void Application::pauseNoSecurityCheck(bool startIfNone){
return;
}
O_INFO("Pausing " << path());
Oxide::Sentry::sentry_transaction("application", "pause", [this, startIfNone](Oxide::Sentry::Transaction* t){
Oxide::Sentry::sentry_transaction("Pause Application", "pause", [this, startIfNone](Oxide::Sentry::Transaction* t){
#ifdef SENTRY
if(t != nullptr){
sentry_transaction_set_tag(t->inner, "application", name().toStdString().c_str());
Expand All @@ -156,7 +156,7 @@ void Application::interruptApplication(){
){
return;
}
Oxide::Sentry::sentry_transaction("application", "interrupt", [this](Oxide::Sentry::Transaction* t){
Oxide::Sentry::sentry_transaction("Interrupt Application", "interrupt", [this](Oxide::Sentry::Transaction* t){
#ifdef SENTRY
if(t != nullptr){
sentry_transaction_set_tag(t->inner, "application", name().toStdString().c_str());
Expand Down Expand Up @@ -249,7 +249,7 @@ void Application::resumeNoSecurityCheck(){
O_DEBUG("Can't Resume" << path() << "Already running!");
return;
}
Oxide::Sentry::sentry_transaction("application", "resume", [this](Oxide::Sentry::Transaction* t){
Oxide::Sentry::sentry_transaction("Resume Application", "resume", [this](Oxide::Sentry::Transaction* t){
#ifdef SENTRY
if(t != nullptr){
sentry_transaction_set_tag(t->inner, "application", name().toStdString().c_str());
Expand All @@ -275,7 +275,7 @@ void Application::uninterruptApplication(){
){
return;
}
Oxide::Sentry::sentry_transaction("application", "uninterrupt", [this](Oxide::Sentry::Transaction* t){
Oxide::Sentry::sentry_transaction("Uninterrupt Application", "uninterrupt", [this](Oxide::Sentry::Transaction* t){
if(flags().contains("exclusive")){
auto compositor = getCompositorDBus();
compositor->enterExclusiveMode().waitForFinished();
Expand Down Expand Up @@ -346,7 +346,7 @@ void Application::stopNoSecurityCheck(){
if(state == Inactive){
return;
}
Oxide::Sentry::sentry_transaction("application", "stop", [this, state](Oxide::Sentry::Transaction* t){
Oxide::Sentry::sentry_transaction("Stop Application", "stop", [this, state](Oxide::Sentry::Transaction* t){
#ifdef SENTRY
if(t != nullptr){
sentry_transaction_set_tag(t->inner, "application", name().toStdString().c_str());
Expand Down
10 changes: 5 additions & 5 deletions applications/system-service/appsapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ AppsAPI::AppsAPI(QObject* parent)
m_processManagerApplication("/"),
m_taskSwitcherApplication("/"),
m_sleeping(false) {
Oxide::Sentry::sentry_transaction("apps", "init", [this](Oxide::Sentry::Transaction* t){
Oxide::Sentry::sentry_transaction("Init Apps API", "init", [this](Oxide::Sentry::Transaction* t){
Oxide::Sentry::sentry_span(t, "start", "Launching initial application", [this](Oxide::Sentry::Span* s){
Oxide::Sentry::sentry_span(s, "singleton", "Setup singleton", [this]{
singleton(this);
Expand Down Expand Up @@ -107,7 +107,7 @@ AppsAPI::AppsAPI(QObject* parent)
}

void AppsAPI::startup(){
Oxide::Sentry::sentry_transaction("apps", "startup", [this](Oxide::Sentry::Transaction* t){
Oxide::Sentry::sentry_transaction("Apps API Startup", "startup", [this](Oxide::Sentry::Transaction* t){
if(applications.isEmpty()){
O_INFO("No applications found");
notificationAPI->errorNotification(_noApplicationsMessage);
Expand Down Expand Up @@ -192,7 +192,7 @@ QDBusObjectPath AppsAPI::registerApplicationNoSecurityCheck(QVariantMap properti
return applications[name]->qPath();
}
QDBusObjectPath path;
Oxide::Sentry::sentry_transaction("apps", "registerApplication", [this, &path, name, properties](Oxide::Sentry::Transaction* t){
Oxide::Sentry::sentry_transaction("Register Application", "registerApplication", [this, &path, name, properties](Oxide::Sentry::Transaction* t){
Q_UNUSED(t);
path = QDBusObjectPath(getPath(name));
auto app = new Application(path, reinterpret_cast<QObject*>(this));
Expand Down Expand Up @@ -224,7 +224,7 @@ void AppsAPI::reload(){
if(!hasPermission("apps")){
return;
}
Oxide::Sentry::sentry_transaction("apps", "reload", [this](Oxide::Sentry::Transaction* t){
Oxide::Sentry::sentry_transaction("Reload Apps", "reload", [this](Oxide::Sentry::Transaction* t){
Q_UNUSED(t);
writeApplications();
readApplications();
Expand Down Expand Up @@ -359,7 +359,7 @@ QVariantMap AppsAPI::pausedApplications(){
}

void AppsAPI::unregisterApplication(Application* app){
Oxide::Sentry::sentry_transaction("apps", "unregisterApplication", [this, app](Oxide::Sentry::Transaction* t){
Oxide::Sentry::sentry_transaction("Unregister Application", "unregisterApplication", [this, app](Oxide::Sentry::Transaction* t){
Q_UNUSED(t);
auto name = app->name();
if(applications.contains(name)){
Expand Down
2 changes: 1 addition & 1 deletion applications/system-service/dbusservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ DBusService::DBusService(QObject* parent)
#ifdef SENTRY
sentry_breadcrumb("dbusservice", "Initializing APIs", "info");
#endif
Oxide::Sentry::sentry_transaction("dbus", "init", [this](Oxide::Sentry::Transaction* t){
Oxide::Sentry::sentry_transaction("DBus Service Init", "init", [this](Oxide::Sentry::Transaction* t){
Oxide::Sentry::sentry_span(t, "apis", "Initialize APIs", [this](Oxide::Sentry::Span* s){
Oxide::Sentry::sentry_span(s, "wifi", "Initialize wifi API", [this]{
apis.insert("wifi", APIEntry{
Expand Down
2 changes: 1 addition & 1 deletion applications/system-service/notificationapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ NotificationAPI::NotificationAPI(QObject* parent)
m_notifications(),
m_lock()
{
Oxide::Sentry::sentry_transaction("apps", "init", [this](Oxide::Sentry::Transaction* t){
Oxide::Sentry::sentry_transaction("Notification API init", "init", [this](Oxide::Sentry::Transaction* t){
Oxide::Sentry::sentry_span(t, "singleton", "Setup singleton", [this]{
singleton(this);
});
Expand Down
48 changes: 35 additions & 13 deletions applications/system-service/powerapi.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "powerapi.h"

#include <liboxide/udev.h>

PowerAPI* PowerAPI::singleton(PowerAPI* self){
static PowerAPI* instance;
if(self != nullptr){
Expand All @@ -9,8 +11,8 @@ PowerAPI* PowerAPI::singleton(PowerAPI* self){
}

PowerAPI::PowerAPI(QObject* parent)
: APIBase(parent), m_chargerState(ChargerUnknown){
Oxide::Sentry::sentry_transaction("power", "init", [this](Oxide::Sentry::Transaction* t){
: APIBase(parent), m_chargerState(ChargerUnknown){
Oxide::Sentry::sentry_transaction("Power API Init", "init", [this](Oxide::Sentry::Transaction* t){
Oxide::Sentry::sentry_span(t, "singleton", "Setup singleton", [this]{
singleton(this);
});
Expand All @@ -21,24 +23,44 @@ PowerAPI::PowerAPI(QObject* parent)
Oxide::Sentry::sentry_span(t, "update", "Update current state", [this]{
update();
});
Oxide::Sentry::sentry_span(t, "timer", "Setup timer", [this]{
timer = new QTimer(this);
timer->setSingleShot(false);
timer->setInterval(3 * 1000); // 3 seconds
timer->moveToThread(qApp->thread());
connect(timer, &QTimer::timeout, this, QOverload<>::of(&PowerAPI::update));
timer->start();
Oxide::Sentry::sentry_span(t, "monitor", "Setup monitor", [this]{
if(deviceSettings.getDeviceType() == Oxide::DeviceSettings::RM1){
Oxide::UDev::singleton()->addMonitor("platform", NULL);
Oxide::UDev::singleton()->subsystem("power_supply", [this]{
QMetaObject::invokeMethod(this, "update", Qt::QueuedConnection);
});
}else{
timer = new QTimer(this);
timer->setSingleShot(false);
timer->setInterval(3 * 1000); // 3 seconds
timer->moveToThread(qApp->thread());
connect(timer, &QTimer::timeout, this, QOverload<>::of(&PowerAPI::update));
timer->start();
}
});
});
}

void PowerAPI::shutdown(){
O_DEBUG("Killing timer");
timer->stop();
delete timer;
if(timer != nullptr){
qDebug() << "Killing timer";
timer->stop();
delete timer;
}else{
qDebug() << "Killing UDev monitor";
Oxide::UDev::singleton()->stop();
}
}

void PowerAPI::setEnabled(bool enabled) {
void PowerAPI::setEnabled(bool enabled){
if(deviceSettings.getDeviceType() == Oxide::DeviceSettings::RM1){
if(enabled){
Oxide::UDev::singleton()->start();
}else{
Oxide::UDev::singleton()->stop();
}
return;
}
if(enabled){
timer->start();
}else{
Expand Down
2 changes: 1 addition & 1 deletion applications/system-service/powerapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class PowerAPI : public APIBase {
void chargerWarning();

private:
QTimer* timer;
QTimer* timer = nullptr;
int m_state = Normal;
int m_batteryState = BatteryUnknown;
int m_batteryLevel = 0;
Expand Down
4 changes: 2 additions & 2 deletions applications/system-service/screenapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ QDBusObjectPath ScreenAPI::addScreenshot(QByteArray blob){

Screenshot* ScreenAPI::addScreenshot(QString filePath){
Screenshot* instance;
Oxide::Sentry::sentry_transaction("screen", "addScreenshot", [this, filePath, &instance](Oxide::Sentry::Transaction* t){
Oxide::Sentry::sentry_transaction("Add Screenshot", "addScreenshot", [this, filePath, &instance](Oxide::Sentry::Transaction* t){
Oxide::Sentry::sentry_span(t, "screenshot", "Create screenshot", [this, filePath, &instance]{
auto path = QString(OXIDE_SERVICE_PATH "/screenshots/") + QFileInfo(filePath).completeBaseName().remove('-').remove('.');
instance = new Screenshot(path, filePath, this);
Expand Down Expand Up @@ -129,7 +129,7 @@ ScreenAPI* ScreenAPI::singleton(ScreenAPI* self){
}

ScreenAPI::ScreenAPI(QObject* parent) : APIBase(parent), m_screenshots(), m_enabled(false) {
Oxide::Sentry::sentry_transaction("screen", "init", [this](Oxide::Sentry::Transaction* t){
Oxide::Sentry::sentry_transaction("Screen API Init", "init", [this](Oxide::Sentry::Transaction* t){
qDBusRegisterMetaType<QList<double>>();
Oxide::Sentry::sentry_span(t, "mkdirs", "Create screenshots directory", [this]{
mkdirs("/home/root/screenshots/");
Expand Down
6 changes: 3 additions & 3 deletions applications/system-service/systemapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ QDebug operator<<(QDebug debug, Touch* touch){
void SystemAPI::PrepareForSleep(bool suspending){
if(suspending){
Controller::singleton()->enabled = false;
Oxide::Sentry::sentry_transaction("system", "suspend", [this](Oxide::Sentry::Transaction* t){
Oxide::Sentry::sentry_transaction("Suspend System", "suspend", [this](Oxide::Sentry::Transaction* t){
if(autoLock()){
lockTimestamp = QDateTime::currentMSecsSinceEpoch() + lockTimer.remainingTime();
O_DEBUG("Auto Lock timestamp:" << lockTimestamp);
Expand Down Expand Up @@ -104,7 +104,7 @@ void SystemAPI::PrepareForSleep(bool suspending){
O_INFO("Suspending...");
});
}else{
Oxide::Sentry::sentry_transaction("system", "resume", [this](Oxide::Sentry::Transaction* t){
Oxide::Sentry::sentry_transaction("Resume System", "resume", [this](Oxide::Sentry::Transaction* t){
qDebug() << "Resuming...";
Oxide::Sentry::sentry_span(t, "inhibit", "Inhibit sleep", [this]{
inhibitSleep();
Expand Down Expand Up @@ -184,7 +184,7 @@ SystemAPI::SystemAPI(QObject* parent)
swipeStates(),
swipeLengths()
{
Oxide::Sentry::sentry_transaction("system", "init", [this](Oxide::Sentry::Transaction* t){
Oxide::Sentry::sentry_transaction("System API Init", "init", [this](Oxide::Sentry::Transaction* t){
Oxide::Sentry::sentry_span(t, "settings", "Sync settings", [this](Oxide::Sentry::Span* s){
Oxide::Sentry::sentry_span(s, "swipes", "Default swipe values", [this]{
for(short i = Right; i <= Down; i++){
Expand Down
2 changes: 1 addition & 1 deletion applications/system-service/wifiapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ WifiAPI::WifiAPI(QObject* parent)
m_link(0),
m_scanning(false)
{
Oxide::Sentry::sentry_transaction("wifi", "init", [this](Oxide::Sentry::Transaction* t){
Oxide::Sentry::sentry_transaction("Wifi API Init", "init", [this](Oxide::Sentry::Transaction* t){
Oxide::Sentry::sentry_span(t, "singleton", "Setup singleton", [this]{
singleton(this);
});
Expand Down
2 changes: 1 addition & 1 deletion package
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pkgnames=(
)
_oxidever=$(grep 'VERSION =' qmake/common.pri | awk '{print $3}')
pkgver="$_oxidever~VERSION~"
_sentryver=0.7.6
_sentryver=0.7.9
timestamp="$(date -u +%Y-%m-%dT%H:%MZ)"
maintainer="Eeems <[email protected]>"
url=https://oxide.eeems.codes
Expand Down
4 changes: 3 additions & 1 deletion shared/liboxide/liboxide.pro
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ SOURCES += \
sysobject.cpp \
signalhandler.cpp \
threading.cpp \
udev.cpp \
xochitlsettings.cpp

HEADERS += \
Expand All @@ -59,6 +60,7 @@ HEADERS += \
sysobject.h \
signalhandler.h \
threading.h \
udev.h \
xochitlsettings.h

PRECOMPILED_HEADER = \
Expand All @@ -79,7 +81,7 @@ DBUS_INTERFACES += \
../../interfaces/notification.xml \
../../interfaces/blight.xml

LIBS += -lsystemd
LIBS += -lsystemd -ludev

include(../../qmake/common.pri)
RELATIVE_PWD = $$system(realpath --canonicalize-missing --relative-to $$OUT_PWD $$PWD)
Expand Down
Loading

0 comments on commit 9688b4a

Please sign in to comment.