WIP
This commit is contained in:
parent
d725a54bd8
commit
fc2335f138
83
src/main.cpp
83
src/main.cpp
@ -30,47 +30,48 @@ std::vector<std::string> split(std::string s, char delimiter)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// dmenu::DEVec apps = dmenu::get_dmenu_app_data();
|
||||
// for (auto &app : *apps.get())
|
||||
// {
|
||||
// std::cout << std::format("---\nName: {}\nID: {}\nIcon: {}\nExec: {}\nDisp: {}\n---\n", app.id, app.name, app.iconPath(), app.exec, app.display ? "yes" : "no");
|
||||
// }
|
||||
|
||||
QGuiApplication app(argc, argv);
|
||||
QCoreApplication::setApplicationName("waycast");
|
||||
|
||||
// Enable system theme support
|
||||
app.setDesktopSettingsAware(true);
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
|
||||
// Register the AppListModel type with QML
|
||||
qmlRegisterType<AppListModel>("WayCast", 1, 0, "AppListModel");
|
||||
|
||||
// Set up layer shell before creating any windows
|
||||
QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed, &app, []()
|
||||
{ QCoreApplication::exit(-1); });
|
||||
|
||||
engine.loadFromModule("WayCast", "Main");
|
||||
|
||||
// Get the root objects and configure layer shell
|
||||
auto rootObjects = engine.rootObjects();
|
||||
if (!rootObjects.isEmpty())
|
||||
dmenu::DEVec apps = dmenu::get_dmenu_app_data();
|
||||
for (auto &app : *apps.get())
|
||||
{
|
||||
QWindow *window = qobject_cast<QWindow *>(rootObjects.first());
|
||||
if (window)
|
||||
{
|
||||
LayerShellQt::Window *layerWindow = LayerShellQt::Window::get(window);
|
||||
if (layerWindow)
|
||||
{
|
||||
layerWindow->setLayer(LayerShellQt::Window::LayerTop);
|
||||
layerWindow->setAnchors({});
|
||||
layerWindow->setKeyboardInteractivity(LayerShellQt::Window::KeyboardInteractivityOnDemand);
|
||||
|
||||
// Now show the window after layer shell is configured
|
||||
window->show();
|
||||
}
|
||||
}
|
||||
std::cout << app.iconPath() << std::endl;
|
||||
// std::cout << std::format("---\nName: {}\nID: {}\nIcon: {}\nExec: {}\nDisp: {}\n---\n", app.id, app.name, app.iconPath(), app.exec, app.display ? "yes" : "no");
|
||||
}
|
||||
return app.exec();
|
||||
|
||||
// QGuiApplication app(argc, argv);
|
||||
// QCoreApplication::setApplicationName("waycast");
|
||||
|
||||
// // Enable system theme support
|
||||
// app.setDesktopSettingsAware(true);
|
||||
|
||||
// QQmlApplicationEngine engine;
|
||||
|
||||
// // Register the AppListModel type with QML
|
||||
// qmlRegisterType<AppListModel>("WayCast", 1, 0, "AppListModel");
|
||||
|
||||
// // Set up layer shell before creating any windows
|
||||
// QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed, &app, []()
|
||||
// { QCoreApplication::exit(-1); });
|
||||
|
||||
// engine.loadFromModule("WayCast", "Main");
|
||||
|
||||
// // Get the root objects and configure layer shell
|
||||
// auto rootObjects = engine.rootObjects();
|
||||
// if (!rootObjects.isEmpty())
|
||||
// {
|
||||
// QWindow *window = qobject_cast<QWindow *>(rootObjects.first());
|
||||
// if (window)
|
||||
// {
|
||||
// LayerShellQt::Window *layerWindow = LayerShellQt::Window::get(window);
|
||||
// if (layerWindow)
|
||||
// {
|
||||
// layerWindow->setLayer(LayerShellQt::Window::LayerTop);
|
||||
// layerWindow->setAnchors({});
|
||||
// layerWindow->setKeyboardInteractivity(LayerShellQt::Window::KeyboardInteractivityOnDemand);
|
||||
|
||||
// // Now show the window after layer shell is configured
|
||||
// window->show();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return app.exec();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user