The main function of this project is to provide a graphical interface to view the current system port occupancy. It currently supports Windows, Macos, Debian Linux Desktop, and Centos Linux Desktop platforms. You can get the latest version for experience through Github Release, mainly for learning compose-multiplatform was developed for the purpose, but we also strive to do it well.
-
✓ View and search for programs currently occupying ports
-
✓ Close specified program
-
✓ View listening IP address and PID
-
✓ Open the directory where the program is located
-
✓ Copy program run command
-
✓ Night mode support, Chinese and English support
-
✓ Profile support
-
✓ Run log
-
✓ Windows privilege escalation operations
-
❏ Add digital signature to installation file
-
❏ Complete unit test cases
-
❏ Automatically update apps
The tool mainly uses the technology stack compose-multiplatform, based on which the distribution of multiple desktops is completed. Therefore, the writing method is slightly different from Jetpack compose, and some unique components that belong to Desktop (Desktop, Tray, Scrollbar, Notification, etc.) are added. It contains some customized components, such as a window that can hide the title and persist on the top.
Obtaining the core code of the process is initially completed by calling the system api through JNA. However, because different platforms mainly call the underlying api, I found this to be difficult when debugging on mac, and I don’t want to obtain it through command parsing. data. Finally, I chose to use oshi to obtain system process and network information. The problem is that the acquisition speed is much slower than the underlying API, but the data integrity and cross-platform Sex is indeed the best support. Native Windows api gets process information at commit cd3c7f77 for refactoring.
System |
Configuration file path |
Macos |
/Users/{username}/Library/Preferences/PortView/zyue |
Windows |
C:\Users\{username}\AppData\Local\zyue\PortView |
Linux |
/home/{username}/.config/PortView |
It is worth noting that currently compose-multiplatform
is copied to the app/resources
directory of the corresponding platform through the configuration of gradle
, refer to Official Document The configuration is as follows
appResourcesRootDir.set(project.layout.projectDirectory.dir("resources"))
Currently, only privilege escalation files valid for windows
are stored.
compose-multiplatform
uses ProGuard to reduce and obfuscate the code. The obfuscation is currently turned off, but the use of some third-party libraries will cause similar problems such as being unable to be found. Class exceptions, so you need to define some packages or classes that will not be processed in the compose-desktop.pro
file.
Use Gradle
for construction, Graalvm-ce-17 JDK
and Kotlin
for development, mainly providing the following commands to run and package
Command |
Use |
Others |
|
Run the program |
- |
|
Run the post-release program |
No rebuild will occur |
|
Run the post-release program |
Needs to be rebuilt |
|
Packaging according to the current operating system |
Supports |
The built files are stored in the composeApp/build
directory, and the packaged files are stored in the composeApp/build/packages
directory.
Use Github Action for packaging and distribution. When a tag starting with the letter v
is detected, it will be automatically published to Github Release. It is worth noting that the CHANGELOG.adoc
file requires manual maintenance, so every time a function is added or repaired, the documentation needs to be supplemented, which is also a recommended practice.
There are signature issues on both Mac
and Windows
. When the software is installed, it will prompt that it is from an untrusted developer. Refer to Open Mac App from Unidentified Developer with Add exclusion to Windows Security Center. You can rest assured that the application will not make any network requests or maliciously modify system files. If you mind, you can also download the source code to compile and run.
Currently, functional tests have been passed on the following platforms
-
Windows 11 23H2 (22631)
-
Macos Sonoma 14.2.1
-
Ubuntu 22.04.3 Gnome Desktop
On the one hand, the unit test is not fully supported by compose-multiplatform
, and on the other hand, the requirements have not been fully determined due to changes, so it has not been written yet. To be improved…