mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-07 20:10:08 +02:00
👌 Make user-supplied apps available (#73)
This commit is contained in:
10
README.md
10
README.md
@ -246,6 +246,16 @@ The supported apps are: <i>PhpStorm, Visual Studio Code, Sublime Text, Sublime M
|
||||
All of these apps should just be detected correctly, no matter their location on your system. If you can open it using `open -a "appname"`, the app should be detected and work. If you have renamed the app, there might be an issue getting it detected.
|
||||
|
||||
To see which files are checked to determine availability, see [this file](./phpmon/Domain/Helpers/Application.swift).
|
||||
|
||||
You can add your own apps by creating and editing a `~/.phpmon.conf.json` file, with the following entry:
|
||||
|
||||
<code>
|
||||
{
|
||||
"scan_apps": ["Xcode", "Kraken"]
|
||||
}
|
||||
</code>
|
||||
|
||||
You can put as many apps as you'd like in the `scan_apps` array, and PHP Monitor will check for the existence of these apps. You do not need to set the full path, just the name of the app should work. Not all apps support opening a folder, though, so your success might vary.
|
||||
</details>
|
||||
|
||||
<details>
|
||||
|
@ -14,7 +14,7 @@ import Foundation
|
||||
class Application {
|
||||
|
||||
enum AppType {
|
||||
case editor, browser, git_gui, terminal
|
||||
case editor, browser, git_gui, terminal, user_supplied
|
||||
}
|
||||
|
||||
/// Name of the app. Used for display purposes and to determine `name.app` exists.
|
||||
|
@ -51,9 +51,15 @@ extension MainMenu {
|
||||
Log.info("Setting up watchers...")
|
||||
App.shared.handlePhpConfigWatcher()
|
||||
|
||||
// Detect applications (preset + custom)
|
||||
Log.info("Detecting applications...")
|
||||
// Attempt to load list of applications
|
||||
App.shared.detectedApplications = Application.detectPresetApplications()
|
||||
let customApps = Preferences.custom.scanApps.map { appName in
|
||||
return Application(appName, .user_supplied)
|
||||
}.filter { app in
|
||||
return app.isInstalled()
|
||||
}
|
||||
App.shared.detectedApplications.append(contentsOf: customApps)
|
||||
let appNames = App.shared.detectedApplications.map { app in
|
||||
return app.name
|
||||
}
|
||||
|
@ -76,6 +76,10 @@ class Preferences {
|
||||
return Self.shared.cachedPreferences
|
||||
}
|
||||
|
||||
static var custom: CustomPrefs {
|
||||
return Self.shared.customPreferences
|
||||
}
|
||||
|
||||
/**
|
||||
Determine whether a particular preference is enabled.
|
||||
- Important: Requires the preference to have a corresponding boolean value, or a fatal error will be thrown.
|
||||
|
Reference in New Issue
Block a user