diff --git a/phpmon/Domain/Menu/MainMenu.swift b/phpmon/Domain/Menu/MainMenu.swift index ae12f5f..69f4c51 100644 --- a/phpmon/Domain/Menu/MainMenu.swift +++ b/phpmon/Domain/Menu/MainMenu.swift @@ -68,7 +68,9 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate { */ func setStatusBarImage(version: String) { setStatusBar( - image: MenuBarImageGenerator.textToImageWithIcon(text: version) + image: Preferences.isEnabled(.shouldDisplayPhpHintInIcon) + ? MenuBarImageGenerator.textToImageWithIcon(text: version) + : MenuBarImageGenerator.textToImage(text: version) ) } diff --git a/phpmon/Domain/Preferences/Preferences.swift b/phpmon/Domain/Preferences/Preferences.swift index 67abc71..ec3df1e 100644 --- a/phpmon/Domain/Preferences/Preferences.swift +++ b/phpmon/Domain/Preferences/Preferences.swift @@ -11,6 +11,7 @@ import Foundation enum PreferenceName: String { case wasLaunchedBefore = "launched_before" case shouldDisplayDynamicIcon = "use_dynamic_icon" + case shouldDisplayPhpHintInIcon = "add_php_to_icon" case fullPhpVersionDynamicIcon = "full_php_in_menu_bar" case autoServiceRestartAfterExtensionToggle = "auto_restart_after_extension_toggle" case autoComposerGlobalUpdateAfterSwitch = "auto_composer_global_update_after_switch" @@ -50,6 +51,7 @@ class Preferences { static func handleFirstTimeLaunch() { UserDefaults.standard.register(defaults: [ PreferenceName.shouldDisplayDynamicIcon.rawValue: true, + PreferenceName.shouldDisplayPhpHintInIcon.rawValue: true, PreferenceName.fullPhpVersionDynamicIcon.rawValue: false, PreferenceName.autoServiceRestartAfterExtensionToggle.rawValue: true, PreferenceName.autoComposerGlobalUpdateAfterSwitch.rawValue: false, @@ -92,6 +94,7 @@ class Preferences { return [ // Part 1: Always Booleans .shouldDisplayDynamicIcon: UserDefaults.standard.bool(forKey: PreferenceName.shouldDisplayDynamicIcon.rawValue) as Any, + .shouldDisplayPhpHintInIcon: UserDefaults.standard.bool(forKey: PreferenceName.shouldDisplayPhpHintInIcon.rawValue) as Any, .fullPhpVersionDynamicIcon: UserDefaults.standard.bool(forKey: PreferenceName.fullPhpVersionDynamicIcon.rawValue) as Any, .autoServiceRestartAfterExtensionToggle: UserDefaults.standard.bool(forKey: PreferenceName.autoServiceRestartAfterExtensionToggle.rawValue) as Any, .autoComposerGlobalUpdateAfterSwitch: UserDefaults.standard.bool(forKey: PreferenceName.autoComposerGlobalUpdateAfterSwitch.rawValue) as Any, diff --git a/phpmon/Domain/Preferences/PrefsVC.swift b/phpmon/Domain/Preferences/PrefsVC.swift index b2555ef..a4208e4 100644 --- a/phpmon/Domain/Preferences/PrefsVC.swift +++ b/phpmon/Domain/Preferences/PrefsVC.swift @@ -59,6 +59,15 @@ class PrefsVC: NSViewController { ), CheckboxPreferenceView.make( sectionText: "", + descriptionText: "prefs.icon_hint_desc".localized, + checkboxText: "prefs.icon_hint_title".localized, + preference: .shouldDisplayPhpHintInIcon, + action: { + MainMenu.shared.refreshIcon() + } + ), + CheckboxPreferenceView.make( + sectionText: "prefs.info_density".localized, descriptionText: "prefs.display_full_php_version_desc".localized, checkboxText: "prefs.display_full_php_version".localized, preference: .fullPhpVersionDynamicIcon, diff --git a/phpmon/Localizable.strings b/phpmon/Localizable.strings index adf3cad..7d31ab9 100644 --- a/phpmon/Localizable.strings +++ b/phpmon/Localizable.strings @@ -97,7 +97,8 @@ "prefs.close" = "Close"; "prefs.global_shortcut" = "Global shortcut:"; -"prefs.dynamic_icon" = "Dynamic icon:"; +"prefs.dynamic_icon" = "Icon customization:"; +"prefs.info_density" = "Info density:"; "prefs.services" = "Services:"; "prefs.switcher" = "Switcher:"; @@ -107,6 +108,9 @@ "prefs.dynamic_icon_title" = "Display dynamic icon in menu bar"; "prefs.dynamic_icon_desc" = "If you uncheck this box, the truck icon will always be visible. If checked, it will display the major version number of the currently linked PHP version."; +"prefs.icon_hint_title" = "Display PHP hint next to version number"; +"prefs.icon_hint_desc" = "If you uncheck this box, the icon in the menu bar will only show the version number and not the PHP hint. This preference does not do anything if the dynamic icon has been disabled."; + "prefs.display_full_php_version" = "Display full PHP version everywhere"; "prefs.display_full_php_version_desc" = "Display the full version instead of the major version displayed in the menu bar and the dropdown menu. (This may be undesirable on smaller displays, so this is disabled by default.)";