Add custom icon guide

This commit is contained in:
Mykola Grymalyuk
2021-03-13 10:25:56 -07:00
parent 6f5d5922dc
commit 51c3921cf8
14 changed files with 267 additions and 0 deletions

161
OCLP-GUI.command Executable file
View File

@@ -0,0 +1,161 @@
#!/usr/bin/env python3
# Current GUI issues:
#
# - Settings:
# - Broken toggle(Does not update variable)
# - Missing toggles(OpenCore, Kext, Metal, Wifi, SMBIOS)
# - Install OpenCore:
# - Outright non-functional
# - Pottential implementations would be to copy TUI's UI
from tkinter import *
import subprocess, sys, time
import tkinter as tk
from Resources import build, ModelArray, Constants, utilities
# Build main menu
class GUI_MENU():
def __init__(self):
self.constants = Constants.Constants()
self.current_model: str = None
self.constants.gui_mode = True
opencore_model: str = subprocess.run("nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:oem-product".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode()
if not opencore_model.startswith("nvram: Error getting variable"):
opencore_model = [line.strip().split(":oem-product ", 1)[1] for line in opencore_model.split("\n") if line.strip().startswith("4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:")][0]
self.current_model = opencore_model
else:
self.current_model = subprocess.run("system_profiler SPHardwareDataType".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
self.current_model = [line.strip().split(": ", 1)[1] for line in self.current_model.stdout.decode().split("\n") if line.strip().startswith("Model Identifier")][0]
# Update SMBIOS
def update_model_clicked(self):
current_model = self.entry_smbios.get()
self.current_model = current_model.strip()
if self.current_model in ModelArray.SupportedSMBIOS11:
self.support = True
self.support_string = "Model is supported"
else:
self.support = False
self.support_string = "Model is unsupported"
# Update Labels
self.label_smbios.configure(text=f" Configured model: {self.current_model} ", font=(".AppleSystemUIFont", 15))
self.label_support.configure(text=self.support_string, font=(".AppleSystemUIFont", 15))
def build_clicked(self):
build_window = tk.Tk()
build_window.title("Build Menu")
build_window.minsize(250, 30)
build_window.eval('tk::PlaceWindow %s center' % build_window.winfo_pathname(build_window.winfo_id()))
support_build_2 = """Model is unsupported
Please enter a supported model in the main menu.
"""
build_label = tk.Label(build_window, text=support_build_2)
if self.current_model in ModelArray.SupportedSMBIOS11:
support_build_2 = """
Model is supported, building EFI..
If you see this text for more than 15 seconds, try restarting the build
If repeated, please open an issue on Github
"""
build_label.configure(text=support_build_2)
build_label.pack()
build.BuildOpenCore(self.current_model, self.constants).build_opencore()
support_build_2 = f"""Finished building OpenCore for model {self.current_model}!
Built at:
{self.constants.opencore_release_folder}
Close this window and select Install OpenCore 🔧
"""
build_label.configure(text=support_build_2)
build_label.pack()
else:
support_build_2 = "Model is unsupported"
build_label.pack()
build_window.eval('tk::PlaceWindow %s center' % build_window.winfo_pathname(build_window.winfo_id()))
def settings_menu(self):
#def v_func(self, v_var):
settings_window = tk.Tk()
settings_window.title("Settings Menu")
settings_window.minsize(250, 20)
label_settings = tk.Label(settings_window, text="Patcher Settings")
label_settings.place(relx=0.1, rely=0.1, anchor=SW)
local_verbose_debug = tk.BooleanVar()
verbose_box = tk.Checkbutton(settings_window, text='Enable Verbose Booting', variable=local_verbose_debug)
verbose_box.pack()
local_verbose_debug.set(True)
print(local_verbose_debug.get())
verbose_box.local_verbose_debug = local_verbose_debug
#local_verbose_debug..set(self.constants.verbose_debug)
settings_window.eval('tk::PlaceWindow %s center' % settings_window.winfo_pathname(settings_window.winfo_id()))
def main_menu(self):
#self.identify_model()
main_window = tk.Tk()
main_window.title("Main Menu")
window_height = 350
window_width = 400
main_window.resizable(False, False)
screen_width = main_window.winfo_screenwidth()
screen_height = main_window.winfo_screenheight()
x_cordinate = int((screen_width/2) - (window_width/2))
y_cordinate = int((screen_height/2) - (window_height/2))
main_window.geometry("{}x{}+{}+{}".format(window_width, window_height, x_cordinate, y_cordinate))
# Check if supported
if self.current_model in ModelArray.SupportedSMBIOS11:
self.support = True
self.support_string = "Model is supported"
else:
self.support = False
self.support_string = "Model is unsupported"
# Setup Labels
self.label_header = tk.Label(text=f"OpenCore Legacy Patcher v{self.constants.patcher_version}", font=(".AppleSystemUIFont", 20))
self.label_smbios = tk.Label(text=f"Detected model: {self.current_model}", font=(".AppleSystemUIFont", 15))
self.label_support = tk.Label(text=self.support_string, font=(".AppleSystemUIFont", 15))
self.label_build = tk.Label(text="🔨",font=(".AppleSystemUIFont", 50))
self.label_install = tk.Label(text="🔧",font=(".AppleSystemUIFont", 50))
# Setup Text Entry
self.entry_smbios = tk.Entry(width=12, justify='center')
# Setup Buttons
self.button_update = tk.Button(text="Update SMBIOS", command=self.update_model_clicked)
self.button_build = tk.Button(text="Build OpenCore", command=self.build_clicked)
self.button_install = tk.Button(text="Install OpenCore")
self.button_settings = tk.Button(text="⚙️", command=self.settings_menu)
# Place Labels
self.label_header.place(relx=0.5, rely=0.0, anchor=N)
self.label_smbios.place(relx=0.5, rely=0.1, anchor=N)
self.label_support.place(relx=0.5, rely=0.2, anchor=N)
self.entry_smbios.place(relx=0.5, rely=0.3, anchor=N)
self.button_update.place(relx=0.5, rely=0.4, anchor=N)
self.label_build.place(relx=0.25, rely=0.75, anchor=S)
self.button_build.place(relx=0.25, rely=0.85, anchor=S)
self.label_install.place(relx=0.75, rely=0.75, anchor=S)
self.button_install.place(relx=0.75, rely=0.85, anchor=S)
self.button_settings.place(relx=0.9, rely=0.175, anchor=S)
main_window.mainloop()
GUI_MENU().main_menu()

View File

@@ -97,6 +97,7 @@ module.exports = {
children: [
'TROUBLESHOOTING',
'UNINSTALL',
'ICNS',
]
},

105
docs/ICNS.md Normal file
View File

@@ -0,0 +1,105 @@
# Creating custom icons for OpenCore and Mac Boot Picker
For users who want to customize your setup to be more personal, OpenCore does allow for custom icons and images in the boot picker.
* [Custom OpenCore icons](#custom-opencore-icons)
* [Custom Mac Boot Picker icons](#custom-mac-boot-picker-icons)
* [Installing updated icons](#installing-updated-icons)
# Custom OpenCore icons
To generate custom OpenCore icons, you'll need the following:
* Images in PNG format
* Each image, with the following res:
* Cursor — Mouse cursor (mandatory, up to 144x144).
* Selected — Selected item (mandatory, 144x144).
* Selector — Selecting item (mandatory, up to 144x40).
* Left — Scrolling left (mandatory, 40x40).
* Right — Scrolling right (mandatory, 40x40).
* HardDrive — Generic OS (mandatory, 128x128).
* Background — Centred background image. (Recommended max size 1920x1080)
* Apple — Apple OS (128x128).
* AppleRecv — Apple Recovery OS (128x128).
* AppleTM — Apple Time Machine (128x128).
* Windows — Windows (128x128).
* Other — Custom entry (see [Entries](https://dortania.github.io/docs/latest/Configuration.html), 128x128).
* ResetNVRAM — Reset NVRAM system action or tool (128x128).
* Shell — Entry with UEFI Shell name for e.g. OpenShell (128x128).
* Tool — Any other tool (128x128).
Note, for each image we recommend having one of double the size. This ensures that icons are scaled correctly since .icns support dedicated images depending on HiDPI or not.
Once you have a custom image you want to use(for example, as a background), download the [latest release of OpenCorePkg](https://github.com/acidanthera/OpenCorePkg/releases) and enter the `Utilities/icnspack/` folder:
![](../images/icnspack-folder.png)
Now `cd` this folder in terminal and run the following:
```sh
./icnspack Background.icns <insert_x1_image> <insert_x2_image>
```
Once done, you'll see your custom icon generated in `icnspack`'s folder:
![](../images/icnspack-done.png)
# Custom Mac Boot Picker icons
Custom boot picker icons is much more complicated on Legacy Macs, on late 2013+ Macs the [Custom OpenCore icons](#custom-opencore-icons) method will work just fine. However on many 2012 and older Macs, the icons generated will be incompatible with the firmware.
To generate legacy icons, you'll need the following:
* A machine running macOS 10.4 through 10.11
* Icon Composer.app (Requires Apple Developer Account for official download)
* Users without the developer account can find a mirrors here:
* [Icon Composer 10.6](./Icon-Composer-10.6.zip)
* [Icon Composer 10.11](./Icon-Composer-10.6.zip)
* PMG Image you wish to convert
Head to [developer.apple's More Downloads page](https://developer.apple.com/download/more/) and search for `Graphics Tools` that is supported by your OS(note for 10.6 and older, the app is hidden inside `Developer Tools`):
![](../images/graphics-download.png)
Once downloaded, open the disk image and you'll find Icon Composer.app:
![Graphics Open](../images/graphics-open.png)
Now run the app and simply drag the images to each section as so:
![](../images/icon-SL.png)
Now save and export the new icns
# Installing updated icons
To install, please ensure that Vault is disabled when you built OpenCore. If you're unsure, simply rebuild OpenCore with the Patcher setting "Vault" set to false.
* <span style="color:red"> Warning</span>: Editing your OpenCore EFI incorrectly can result in a bricked install. Please ensure you have a natively supported version of macOS installed to boot into in case of issues.
Now that you've verified you can edit OpenCore safely, you'll need to mount the drive that OpenCore is stored on. To do this, download [MountEFI](https://github.com/corpnewt/MountEFI) and run it:
![](../images/mountefi.png)
Select the drive you installed OpenCore to and mount it.
* [Updating OpenCore icons](#updating-opencore-icons)
* [Updating Mac Boot Picker icons](#updating-mac-boot-picker-icons)
### Updating OpenCore icons
Head to `EFI/OC/Resources/Image/` on your drive and you'll see all the custom icons. For Background.icns, we need to ensure the file matches the theme OpenCore has set so we add the prefix `Modern` to it:
![](../images/background-moved.png)
Now reboot and you should see your updated icon(s)!
### Updating Mac Boot Picker icons
To update the Mac Boo Picker icons is actually quite simple, on the root of your drive simply drop the icon onto the root of the drive with the name `.VolumeIcon.icns`
![](../images/mac-icns-drive.png)
Now reboot and you'll see the new icon!

Binary file not shown.

BIN
docs/Icon-Composer-10.6.zip Normal file

Binary file not shown.

BIN
images/background-moved.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 KiB

BIN
images/graphics-open.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 514 KiB

BIN
images/icns-sl-save.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
images/icnspack-done.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 KiB

BIN
images/icnspack-folder.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 KiB

BIN
images/icon-SL.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 KiB

BIN
images/mac-icns-drive.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 KiB

BIN
images/mountefi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB