boolean () { if (FORCE_PHYSICAL_ESC) { return true; } if (ourIsPhysicalEsc != null) { return ourIsPhysicalEsc; } if (ourIsPhysicalEscFuture != null) { if (!ourIsPhysicalEscFuture.isDone()) { return false; } ourIsPhysicalEscFuture = null; return ourIsPhysicalEsc; } // system_profiler SPHardwareDataType // // output example: // //Hardware: // //Hardware Overview: // //Model Name: MacBook Pro //Model Identifier: MacBookPro14,3 //Processor Name: Quad-Core Intel Core i7 //Processor Speed: 2,9 GHz //Number of Processors: 1 //Total Number of Cores: 4 //L2 Cache (per Core): 256 KB //L3 Cache: 8 MB //Hyper-Threading Technology: //Enabled //Memory: 16 GB //Boot ROM Version: 204.0.0.0.0 //SMC Version (system): 2.45f1 //Serial Number (system): C02VW52PHTD6 //Hardware UUID: 263EC2DC-9078-549E-9856-EF94D704E3A6 // can reimplement with use of: // system_profiler SPHardwareDataType | awk '/Model Identifier/ {print $3}' ourIsPhysicalEsc = false; final @NotNull Application app = ApplicationManager.getApplication(); ourIsPhysicalEscFuture = app.executeOnPooledThread(() -> { final GeneralCommandLine cmdLine = new GeneralCommandLine("system_profiler", TB_SERVER_PROCESS); cmdLine.addParameter("SPHardwareDataType"); try { final ProcessOutput out = ExecUtil.execAndGetOutput(cmdLine.withParentEnvironmentType(GeneralCommandLine.ParentEnvironmentType.SYSTEM)); LOG.debug("SPHardwareDataType output:"); for (String line : out.getStdoutLines(true)) { LOG.debug("\t" + line); String tline = line.trim(); if (tline.startsWith(MODEL_ID_PREFIX)) { // FIXME: need to get output for 16-inch macbook and ensure correctness String model = tline.substring(MODEL_ID_PREFIX.length()).trim(); ourIsPhysicalEsc = model.contains("16") || model.equals("MacBookPro17,1"); } } LOG.debug("\tourIsPhysicalEsc=" + ourIsPhysicalEsc); } catch (ExecutionException e) { LOG.debug(e); } return ourIsPhysicalEsc; }); return false; }