Skip to content

Commit

Permalink
Add catalina daemon restart warning
Browse files Browse the repository at this point in the history
  • Loading branch information
tatokis committed Oct 8, 2019
1 parent 63f9773 commit ea54480
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion scripts/mac_build/build_mac_legacy.sh
Expand Up @@ -6,5 +6,5 @@ fi

mkdir build
cd build
Qt5_DIR=~/Qt5.6.3/5.6/clang_64/ cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.10 -DCMAKE_BUILD_TYPE=Release -DSAFE_INSTALL=ON -DSAFE_UNINSTALL=ON -DMAC_LEGACY=1 .. -DUSE_BREW_QUAZIP=0 -DUSE_BREW_QT5=0 -DUSE_PORTAUDIO=1 -DWITH_MVIZ=1
Qt5_DIR=~/Qt5.6.3/5.6.3/clang_64/ cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.10 -DCMAKE_BUILD_TYPE=Release -DSAFE_INSTALL=ON -DSAFE_UNINSTALL=ON -DMAC_LEGACY=1 .. -DUSE_BREW_QUAZIP=0 -DUSE_BREW_QT5=0 -DUSE_PORTAUDIO=1 -DWITH_MVIZ=1
make -j4 macos-package
18 changes: 12 additions & 6 deletions src/gui/mainwindow.cpp
Expand Up @@ -74,6 +74,15 @@ extern "C" {
#endif

#if defined(Q_OS_MACOS) && !defined(OS_MAC_LEGACY)
bool is_catalina_or_higher(){
// Get macOS version. If Catalina or higher, start the daemon agent as the current user to request for HID permission.
QString macOSver = QSysInfo::productVersion();
// Split major/minor
QVector<QStringRef> verVector = macOSver.splitRef('.');
// Check if Catalina or greater
return (verVector.count() == 2 && verVector.at(0) == QString("10") && verVector.at(1).toInt() >= 15);
}

void MainWindow::appleRequestHidTimer(){
// Destroy the timer immediately if we have devices connected
if(KbManager::devices().count()){
Expand Down Expand Up @@ -280,12 +289,7 @@ MainWindow::MainWindow(QWidget *parent) :
#endif

#if defined(Q_OS_MACOS) && !defined(OS_MAC_LEGACY)
// Get macOS version. If Catalina or higher, start the daemon agent as the current user to request for HID permission.
QString macOSver = QSysInfo::productVersion();
// Split major/minor
QVector<QStringRef> verVector = macOSver.splitRef('.');
// Check if Catalina or greater
if(verVector.count() == 2 && verVector.at(0) == QString("10") && verVector.at(1).toInt() >= 15){
if(is_catalina_or_higher()){
// Load the agent as it'll be unloaded on first installation
{
QProcess launchctl;
Expand Down Expand Up @@ -381,6 +385,8 @@ void MainWindow::updateVersion(){
QString kextstatOut(kextstat.readAll());
if(kextstatOut.isEmpty())
daemonWarning.append(tr("<br /><b>Warning:</b> System Extension by \"Fumihiko Takayama\" is not allowed in Security & Privacy. Please allow it and then unplug and replug your devices."));
if(is_catalina_or_higher())
daemonWarning.append(tr("<br /><b>Warning:</b> Make sure ckb-next-daemon is allowed in Security & Privacy -> Input monitoring.<br />Please allow for up to 10 seconds for the daemon restart prompt to show up after allowing input monitoring."));
#elif defined(Q_OS_LINUX)
if(!(QFileInfo("/dev/uinput").exists() || QFileInfo("/dev/input/uinput").exists())){
QProcess modprobe;
Expand Down

0 comments on commit ea54480

Please sign in to comment.