mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-11-06 12:50:06 +01:00
✨ Allow hiding of global version switcher
This commit is contained in:
@@ -32,9 +32,15 @@ extension StatusMenu {
|
|||||||
if PhpEnv.shared.availablePhpVersions.isEmpty { return }
|
if PhpEnv.shared.availablePhpVersions.isEmpty { return }
|
||||||
|
|
||||||
addSwitchToPhpMenuItems()
|
addSwitchToPhpMenuItems()
|
||||||
|
self.addItem(NSMenuItem.separator())
|
||||||
|
}
|
||||||
|
|
||||||
|
func addValetServicesMenuItems() {
|
||||||
|
if PhpEnv.shared.isBusy {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
addItems([
|
addItems([
|
||||||
NSMenuItem.separator(),
|
|
||||||
ServicesView.asMenuItem(),
|
ServicesView.asMenuItem(),
|
||||||
NSMenuItem.separator()
|
NSMenuItem.separator()
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -12,7 +12,12 @@ class StatusMenu: NSMenu {
|
|||||||
addPhpVersionMenuItems()
|
addPhpVersionMenuItems()
|
||||||
addItem(NSMenuItem.separator())
|
addItem(NSMenuItem.separator())
|
||||||
|
|
||||||
addPhpActionMenuItems()
|
if Preferences.isEnabled(.displayGlobalVersionSwitcher) {
|
||||||
|
addPhpActionMenuItems()
|
||||||
|
addItem(NSMenuItem.separator())
|
||||||
|
}
|
||||||
|
|
||||||
|
addValetServicesMenuItems()
|
||||||
addItem(NSMenuItem.separator())
|
addItem(NSMenuItem.separator())
|
||||||
|
|
||||||
addValetMenuItems()
|
addValetMenuItems()
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ enum PreferenceName: String {
|
|||||||
case notifyAboutGlobalComposerStatus = "notify_about_composer_status"
|
case notifyAboutGlobalComposerStatus = "notify_about_composer_status"
|
||||||
|
|
||||||
// MENU CUSTOMIZATION
|
// MENU CUSTOMIZATION
|
||||||
case displayVersionSwitcher = "display_version_switcher"
|
case displayGlobalVersionSwitcher = "display_global_version_switcher"
|
||||||
case displayServicesManager = "display_services_manager"
|
case displayServicesManager = "display_services_manager"
|
||||||
case displayValetConfigFinder = "display_valet_config_finder"
|
case displayValetConfigFinder = "display_valet_config_finder"
|
||||||
case displayPhpConfigFinder = "display_php_config_finder"
|
case displayPhpConfigFinder = "display_php_config_finder"
|
||||||
@@ -66,7 +66,7 @@ enum PreferenceName: String {
|
|||||||
.notifyAboutGlobalComposerStatus,
|
.notifyAboutGlobalComposerStatus,
|
||||||
|
|
||||||
// UI Preferences
|
// UI Preferences
|
||||||
.displayVersionSwitcher,
|
.displayGlobalVersionSwitcher,
|
||||||
.displayServicesManager,
|
.displayServicesManager,
|
||||||
.displayValetConfigFinder,
|
.displayValetConfigFinder,
|
||||||
.displayPhpConfigFinder,
|
.displayPhpConfigFinder,
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class Preferences {
|
|||||||
PreferenceName.notifyAboutGlobalComposerStatus.rawValue: true,
|
PreferenceName.notifyAboutGlobalComposerStatus.rawValue: true,
|
||||||
|
|
||||||
/// Preferences: UI Preferences
|
/// Preferences: UI Preferences
|
||||||
PreferenceName.displayVersionSwitcher.rawValue: true,
|
PreferenceName.displayGlobalVersionSwitcher.rawValue: true,
|
||||||
PreferenceName.displayServicesManager.rawValue: true,
|
PreferenceName.displayServicesManager.rawValue: true,
|
||||||
PreferenceName.displayValetConfigFinder.rawValue: true,
|
PreferenceName.displayValetConfigFinder.rawValue: true,
|
||||||
PreferenceName.displayPhpConfigFinder.rawValue: true,
|
PreferenceName.displayPhpConfigFinder.rawValue: true,
|
||||||
|
|||||||
@@ -188,6 +188,23 @@ class GenericPreferenceVC: NSViewController {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getDisplayMenuSectionPV(
|
||||||
|
_ localizationKey: String,
|
||||||
|
_ preference: PreferenceName,
|
||||||
|
_ first: Bool = false
|
||||||
|
) -> NSView {
|
||||||
|
return CheckboxPreferenceView.make(
|
||||||
|
sectionText: first ? "prefs.menu_contents".localized : "",
|
||||||
|
descriptionText: "\(localizationKey)_desc".localized,
|
||||||
|
checkboxText: localizationKey.localized,
|
||||||
|
preference: preference,
|
||||||
|
action: {
|
||||||
|
MainMenu.shared.refreshIcon()
|
||||||
|
MainMenu.shared.rebuild()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - Listening for hotkey delegate
|
// MARK: - Listening for hotkey delegate
|
||||||
|
|
||||||
var listeningForHotkeyView: HotkeyPreferenceView?
|
var listeningForHotkeyView: HotkeyPreferenceView?
|
||||||
@@ -251,7 +268,8 @@ class AppearancePreferencesVC: GenericPreferenceVC {
|
|||||||
vc.views = [
|
vc.views = [
|
||||||
vc.getDynamicIconPV(),
|
vc.getDynamicIconPV(),
|
||||||
vc.getIconOptionsPV(),
|
vc.getIconOptionsPV(),
|
||||||
vc.getIconDensityPV()
|
vc.getIconDensityPV(),
|
||||||
|
vc.getDisplayMenuSectionPV("prefs.display_global_version_switcher", .displayGlobalVersionSwitcher, true)
|
||||||
]
|
]
|
||||||
|
|
||||||
return vc
|
return vc
|
||||||
|
|||||||
@@ -227,6 +227,7 @@
|
|||||||
"prefs.integrations" = "Integrations:";
|
"prefs.integrations" = "Integrations:";
|
||||||
"prefs.updates" = "Updates:";
|
"prefs.updates" = "Updates:";
|
||||||
"prefs.notifications" = "Notifications:";
|
"prefs.notifications" = "Notifications:";
|
||||||
|
"prefs.menu_contents" = "Display In Menu:";
|
||||||
|
|
||||||
"prefs.icon_options.php" = "Display PHP Icon";
|
"prefs.icon_options.php" = "Display PHP Icon";
|
||||||
"prefs.icon_options.elephant" = "Display Elephant Icon";
|
"prefs.icon_options.elephant" = "Display Elephant Icon";
|
||||||
@@ -278,6 +279,9 @@
|
|||||||
"prefs.notify_about_composer_success_desc" = "Displays a notification when the global Composer configuration was successfully updated.";
|
"prefs.notify_about_composer_success_desc" = "Displays a notification when the global Composer configuration was successfully updated.";
|
||||||
"prefs.notify_about_composer_success" = "Notify about global composer update";
|
"prefs.notify_about_composer_success" = "Notify about global composer update";
|
||||||
|
|
||||||
|
"prefs.display_global_version_switcher_desc" = "Display the global PHP version switcher. If disabled, the global switcher will not be accessible via the main menu.";
|
||||||
|
"prefs.display_global_version_switcher" = "Show Global PHP Switcher";
|
||||||
|
|
||||||
// NOTIFICATIONS
|
// NOTIFICATIONS
|
||||||
|
|
||||||
"notification.version_changed_title" = "PHP %@ now active";
|
"notification.version_changed_title" = "PHP %@ now active";
|
||||||
|
|||||||
Reference in New Issue
Block a user