mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-08 04:20:07 +02:00
✨ Updated preferences (added option to disable PHP hint next to icon)
- Only works with dynamic icon enabled - Preference defaults to true on new or existing installs (because we want to display PHP next to the version number by default) For those who love a minimal menu bar setup but still want to see what PHP version is currently enabled, this is perfect.
This commit is contained in:
@ -68,7 +68,9 @@ class MainMenu: NSObject, NSWindowDelegate, NSMenuDelegate {
|
|||||||
*/
|
*/
|
||||||
func setStatusBarImage(version: String) {
|
func setStatusBarImage(version: String) {
|
||||||
setStatusBar(
|
setStatusBar(
|
||||||
image: MenuBarImageGenerator.textToImageWithIcon(text: version)
|
image: Preferences.isEnabled(.shouldDisplayPhpHintInIcon)
|
||||||
|
? MenuBarImageGenerator.textToImageWithIcon(text: version)
|
||||||
|
: MenuBarImageGenerator.textToImage(text: version)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import Foundation
|
|||||||
enum PreferenceName: String {
|
enum PreferenceName: String {
|
||||||
case wasLaunchedBefore = "launched_before"
|
case wasLaunchedBefore = "launched_before"
|
||||||
case shouldDisplayDynamicIcon = "use_dynamic_icon"
|
case shouldDisplayDynamicIcon = "use_dynamic_icon"
|
||||||
|
case shouldDisplayPhpHintInIcon = "add_php_to_icon"
|
||||||
case fullPhpVersionDynamicIcon = "full_php_in_menu_bar"
|
case fullPhpVersionDynamicIcon = "full_php_in_menu_bar"
|
||||||
case autoServiceRestartAfterExtensionToggle = "auto_restart_after_extension_toggle"
|
case autoServiceRestartAfterExtensionToggle = "auto_restart_after_extension_toggle"
|
||||||
case autoComposerGlobalUpdateAfterSwitch = "auto_composer_global_update_after_switch"
|
case autoComposerGlobalUpdateAfterSwitch = "auto_composer_global_update_after_switch"
|
||||||
@ -50,6 +51,7 @@ class Preferences {
|
|||||||
static func handleFirstTimeLaunch() {
|
static func handleFirstTimeLaunch() {
|
||||||
UserDefaults.standard.register(defaults: [
|
UserDefaults.standard.register(defaults: [
|
||||||
PreferenceName.shouldDisplayDynamicIcon.rawValue: true,
|
PreferenceName.shouldDisplayDynamicIcon.rawValue: true,
|
||||||
|
PreferenceName.shouldDisplayPhpHintInIcon.rawValue: true,
|
||||||
PreferenceName.fullPhpVersionDynamicIcon.rawValue: false,
|
PreferenceName.fullPhpVersionDynamicIcon.rawValue: false,
|
||||||
PreferenceName.autoServiceRestartAfterExtensionToggle.rawValue: true,
|
PreferenceName.autoServiceRestartAfterExtensionToggle.rawValue: true,
|
||||||
PreferenceName.autoComposerGlobalUpdateAfterSwitch.rawValue: false,
|
PreferenceName.autoComposerGlobalUpdateAfterSwitch.rawValue: false,
|
||||||
@ -92,6 +94,7 @@ class Preferences {
|
|||||||
return [
|
return [
|
||||||
// Part 1: Always Booleans
|
// Part 1: Always Booleans
|
||||||
.shouldDisplayDynamicIcon: UserDefaults.standard.bool(forKey: PreferenceName.shouldDisplayDynamicIcon.rawValue) as Any,
|
.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,
|
.fullPhpVersionDynamicIcon: UserDefaults.standard.bool(forKey: PreferenceName.fullPhpVersionDynamicIcon.rawValue) as Any,
|
||||||
.autoServiceRestartAfterExtensionToggle: UserDefaults.standard.bool(forKey: PreferenceName.autoServiceRestartAfterExtensionToggle.rawValue) as Any,
|
.autoServiceRestartAfterExtensionToggle: UserDefaults.standard.bool(forKey: PreferenceName.autoServiceRestartAfterExtensionToggle.rawValue) as Any,
|
||||||
.autoComposerGlobalUpdateAfterSwitch: UserDefaults.standard.bool(forKey: PreferenceName.autoComposerGlobalUpdateAfterSwitch.rawValue) as Any,
|
.autoComposerGlobalUpdateAfterSwitch: UserDefaults.standard.bool(forKey: PreferenceName.autoComposerGlobalUpdateAfterSwitch.rawValue) as Any,
|
||||||
|
@ -59,6 +59,15 @@ class PrefsVC: NSViewController {
|
|||||||
),
|
),
|
||||||
CheckboxPreferenceView.make(
|
CheckboxPreferenceView.make(
|
||||||
sectionText: "",
|
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,
|
descriptionText: "prefs.display_full_php_version_desc".localized,
|
||||||
checkboxText: "prefs.display_full_php_version".localized,
|
checkboxText: "prefs.display_full_php_version".localized,
|
||||||
preference: .fullPhpVersionDynamicIcon,
|
preference: .fullPhpVersionDynamicIcon,
|
||||||
|
@ -97,7 +97,8 @@
|
|||||||
"prefs.close" = "Close";
|
"prefs.close" = "Close";
|
||||||
|
|
||||||
"prefs.global_shortcut" = "Global shortcut:";
|
"prefs.global_shortcut" = "Global shortcut:";
|
||||||
"prefs.dynamic_icon" = "Dynamic icon:";
|
"prefs.dynamic_icon" = "Icon customization:";
|
||||||
|
"prefs.info_density" = "Info density:";
|
||||||
"prefs.services" = "Services:";
|
"prefs.services" = "Services:";
|
||||||
"prefs.switcher" = "Switcher:";
|
"prefs.switcher" = "Switcher:";
|
||||||
|
|
||||||
@ -107,6 +108,9 @@
|
|||||||
"prefs.dynamic_icon_title" = "Display dynamic icon in menu bar";
|
"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.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" = "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.)";
|
"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.)";
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user