注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件管理在低版本可能会与本文不兼容。
启动新会话:
tmux [new -s 会话名 -n 窗口名]
恢复会话:
| public static List<String> getIpAddressString() { | |
| List<String> result = new ArrayList<>(); | |
| try { | |
| for (Enumeration<NetworkInterface> enNetI = NetworkInterface | |
| .getNetworkInterfaces(); enNetI.hasMoreElements(); ) { | |
| NetworkInterface netI = enNetI.nextElement(); | |
| if (netI.getDisplayName().matches("wlan(.*)") || netI.getDisplayName().matches("eth(.*)")) { | |
| for (Enumeration<InetAddress> enumIpAddr = netI | |
| .getInetAddresses(); enumIpAddr.hasMoreElements(); ) { | |
| InetAddress inetAddress = enumIpAddr.nextElement(); |
| /** | |
| * Is the Android service running? | |
| * @param context The current context. | |
| * @param serviceClass The service to get running state. | |
| * @return true: if service is running. | |
| */ | |
| static boolean isServiceRunning(Context context, Class<?> serviceClass) { | |
| ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); | |
| if (manager == null) return false; | |
| for (ActivityManager.RunningServiceInfo serviceInfo : manager.getRunningServices(Integer.MAX_VALUE)) { |
| import android.support.annotation.NonNull; | |
| /** | |
| * Measuring code runtime. | |
| * For example: | |
| * long timeSpent = TimeMeasure.doTimeMeasureUs(() -> { | |
| * if (!nativeSendFrame(receiverName, videoBufferByte)) { | |
| * if (++mErrorCount >= ERROR_MAX_COUNT) { | |
| * throw new Exception("Send frame error."); | |
| * } |