Skip to content

Commit 336695d

Browse files
committed
Config : don't show coresysteme services as they are not closable (get restart as soon as u close them)
1 parent cfe972e commit 336695d

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
app.name=closeAll
22
# list (separated by ,) of CoreServices apps that we want to show
3-
app.relevantCoreServices=Finder
3+
# '*' for all, 'None' for none
4+
app.relevantCoreServices=None

composeApp/src/desktopMain/kotlin/org/close_all/project/service/DesktopAppManager.kt

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,21 @@ import kotlin.time.Duration
1414
class DesktopAppManager : AppManager {
1515

1616
private val APPS_PATH_EXP = "/Applications(/[^/]*)?/[^/]+\\.app/Contents"
17-
private val RELAVANT_CORE_SERVICES_EXP =
18-
"/CoreServices(?:/[^/]*)?/(" + AppData.getRelevantCoreServices()
19-
.joinToString("|") + ")\\.app/Contents"
17+
private val RELAVANT_CORE_SERVICES_EXP = when (AppData.getRelevantCoreServices().size) {
18+
0 -> "^#1ZAZ321D2"
19+
else -> {
20+
var res = "/CoreServices(?:/[^/]*)?/(" + AppData.getRelevantCoreServices()
21+
.joinToString("|") + ")\\.app/Contents"
22+
23+
if (AppData.getRelevantCoreServices().size == 1) {
24+
val l = AppData.getRelevantCoreServices()[0]
25+
if (l == "*") res = "/CoreServices(/[^/]*)?/[^/]+\\.app/Contents"
26+
if (l == "None") res = "^#1ZAZ321D2"
27+
}
28+
res
29+
}
30+
}
31+
2032

2133
override suspend fun getRunningApps(): Result<List<App>> {
2234
try {
@@ -97,7 +109,8 @@ class DesktopAppManager : AppManager {
97109
var destroyed = false
98110
if (insProcessHandleOpt.isPresent) {
99111
val insProcessHandle = insProcessHandleOpt.get()
100-
destroyed = insProcessHandle.destroy()
112+
destroyed = insProcessHandle.destroy() // todo make it configurable
113+
println(destroyed)
101114
}
102115
insProcessHandleOpt to destroyed
103116
}

0 commit comments

Comments
 (0)