Allow kdeconnectd auto launch from kdeconnect-indicator on macOS
This commit is contained in:
parent
13230ff580
commit
86b82677a1
2 changed files with 23 additions and 0 deletions
|
@ -17,6 +17,9 @@ ecm_add_app_icon(indicator_SRCS ICONS
|
||||||
add_executable(kdeconnect-indicator ${indicator_SRCS})
|
add_executable(kdeconnect-indicator ${indicator_SRCS})
|
||||||
target_include_directories(kdeconnect-indicator PUBLIC ${CMAKE_BINARY_DIR})
|
target_include_directories(kdeconnect-indicator PUBLIC ${CMAKE_BINARY_DIR})
|
||||||
target_link_libraries(kdeconnect-indicator Qt5::Widgets KF5::CoreAddons KF5::I18n KF5::Notifications KF5::DBusAddons KF5::KCMUtils kdeconnectinterfaces kdeconnectcore)
|
target_link_libraries(kdeconnect-indicator Qt5::Widgets KF5::CoreAddons KF5::I18n KF5::Notifications KF5::DBusAddons KF5::KCMUtils kdeconnectinterfaces kdeconnectcore)
|
||||||
|
if (APPLE)
|
||||||
|
target_link_libraries(kdeconnect-indicator "-framework CoreFoundation")
|
||||||
|
endif()
|
||||||
|
|
||||||
install(TARGETS kdeconnect-indicator ${INSTALL_TARGETS_DEFAULT_ARGS})
|
install(TARGETS kdeconnect-indicator ${INSTALL_TARGETS_DEFAULT_ARGS})
|
||||||
install(PROGRAMS org.kde.kdeconnect.nonplasma.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
|
install(PROGRAMS org.kde.kdeconnect.nonplasma.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
|
||||||
|
|
|
@ -37,6 +37,10 @@
|
||||||
#include "kdeconnect-version.h"
|
#include "kdeconnect-version.h"
|
||||||
#include "deviceindicator.h"
|
#include "deviceindicator.h"
|
||||||
|
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
#include <CoreFoundation/CFBundle.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <dbushelper.h>
|
#include <dbushelper.h>
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
|
@ -54,6 +58,15 @@ int main(int argc, char** argv)
|
||||||
QProcess::startDetached("kdeconnectd.exe");
|
QProcess::startDetached("kdeconnectd.exe");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
// Get bundle path
|
||||||
|
CFURLRef url = (CFURLRef)CFAutorelease((CFURLRef)CFBundleCopyBundleURL(CFBundleGetMainBundle()));
|
||||||
|
QString basePath = QUrl::fromCFURL(url).path();
|
||||||
|
|
||||||
|
QProcess kdeconnectdProcess;
|
||||||
|
kdeconnectdProcess.start(basePath + QStringLiteral("Contents/MacOS/kdeconnectd")); // Start kdeconnectd
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
KDBusService dbusService(KDBusService::Unique);
|
KDBusService dbusService(KDBusService::Unique);
|
||||||
#endif
|
#endif
|
||||||
|
@ -90,6 +103,13 @@ int main(int argc, char** argv)
|
||||||
pairMenu->addAction(i18n("Reject"), dev, &DeviceDbusInterface::rejectPairing);
|
pairMenu->addAction(i18n("Reject"), dev, &DeviceDbusInterface::rejectPairing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
// Add quit menu
|
||||||
|
menu->addAction(i18n("Quit"), [](){
|
||||||
|
QCoreApplication::quit(); // Close this application
|
||||||
|
});
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
QObject::connect(&iface, &DaemonDbusInterface::pairingRequestsChangedProxy, &model, refreshMenu);
|
QObject::connect(&iface, &DaemonDbusInterface::pairingRequestsChangedProxy, &model, refreshMenu);
|
||||||
|
|
Loading…
Reference in a new issue