swaymux/main.cpp

46 lines
1.1 KiB
C++
Raw Normal View History

2024-03-02 22:33:27 +01:00
#include "mainwindow.h"
2024-03-04 00:27:05 +01:00
#include "sway_bindings/Sway.h"
#include "tree/swaytree.h"
2024-03-02 22:33:27 +01:00
#include <QApplication>
#include <QLocale>
#include <QTranslator>
#include <QFile>
#include <QStringList>
#include <QScreen>
#include <QTreeView>
2024-03-04 00:27:05 +01:00
#include<iostream>
#include <sys/socket.h>
#include <sys/un.h>
2024-03-02 22:33:27 +01:00
using namespace Qt::StringLiterals;
2024-03-04 00:27:05 +01:00
#include <nlohmann/json.hpp>
using json = nlohmann::json;
2024-03-02 22:33:27 +01:00
int main(int argc, char *argv[])
{
2024-03-04 00:27:05 +01:00
auto sway = Sway();
auto resp = sway.sendIPC(SWAY_GET_TREE);
json rep = json::parse(resp.msg);
auto rootRecord = SwayRecord(rep);
2024-03-02 22:33:27 +01:00
QApplication a(argc, argv);
QCoreApplication::setOrganizationName("Grimmauld");
QCoreApplication::setApplicationName("SwayMux");
QTranslator translator;
const QStringList uiLanguages = QLocale::system().uiLanguages();
for (const QString &locale : uiLanguages) {
const QString baseName = "swaymux_" + QLocale(locale).name();
if (translator.load(":/i18n/" + baseName)) {
a.installTranslator(&translator);
break;
}
}
MainWindow w;
w.showMaximized();
return a.exec();
}