diff --git a/CHANGELOG.md b/CHANGELOG.md index 645738095..796e133f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,8 @@ - Implemented via: - Userspace: [RSRRepair](https://github.com/flagersgit/RSRRepair) at `/etc/rc.server` (2b1c9e3) - Kernelspace: [RSRHelper.kext](https://github.com/khronokernel/RSRHelper) (cbe1be9) +- Add APFS Trim Configuration + - Settings -> Misc Settings -> APFS Trim - Increment Binaries: - OpenCorePkg 0.8.8 - release - PatcherSupportPkg 0.8.0 - release diff --git a/resources/build/storage.py b/resources/build/storage.py index e3474eae8..8a2be547d 100644 --- a/resources/build/storage.py +++ b/resources/build/storage.py @@ -20,6 +20,7 @@ class build_storage: self.pata_handling() self.misc_handling() self.pcie_handling() + self.trim_handling() def ahci_handling(self): # MacBookAir6,x ship with an AHCI over PCIe SSD model 'APPLE SSD TS0128F' and 'APPLE SSD TS0256F' @@ -126,4 +127,10 @@ class build_storage: # However pre-Ivy Bridge don't support this feature if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.sandy_bridge.value: if (self.constants.computer.sdxc_controller and not self.constants.custom_model) or (self.model.startswith("MacBookPro8") or self.model.startswith("Macmini5")): - support.build_support(self.model, self.constants, self.config).enable_kext("BigSurSDXC.kext", self.constants.bigsursdxc_version, self.constants.bigsursdxc_path) \ No newline at end of file + support.build_support(self.model, self.constants, self.config).enable_kext("BigSurSDXC.kext", self.constants.bigsursdxc_version, self.constants.bigsursdxc_path) + + + def trim_handling(self): + if self.constants.apfs_trim_timeout is False: + print(f"- Disabling APFS TRIM timeout") + self.config["Kernel"]["Quirks"]["SetApfsTrimTimeout"] = 0 \ No newline at end of file diff --git a/resources/constants.py b/resources/constants.py index f1b47f7a6..7e8b33d2c 100644 --- a/resources/constants.py +++ b/resources/constants.py @@ -212,6 +212,7 @@ class Constants: self.commit_info = (None, None, None) self.set_vmm_cpuid = False # Set VMM bit inside CPUID self.oc_timeout = 5 # Set OpenCore timeout + self.apfs_trim_timeout = True # Set APFS Trim timeout self.legacy_accel_support = [ os_data.os_data.big_sur, diff --git a/resources/gui/gui_main.py b/resources/gui/gui_main.py index a0af03368..34534edc8 100644 --- a/resources/gui/gui_main.py +++ b/resources/gui/gui_main.py @@ -2862,6 +2862,14 @@ class wx_python_gui: print("Wake on WLAN Disabled") self.constants.enable_wake_on_wlan = False + def apfs_trim_click(self, event=None): + if self.apfs_trim_checkbox.GetValue(): + print("APFS Trim Enabled") + self.constants.apfs_trim_timeout = True + else: + print("APFS Trim Disabled") + self.constants.apfs_trim_timeout = False + def content_caching_click(self, event=None): if self.content_caching_checkbox.GetValue(): print("Content Caching Enabled") @@ -3550,12 +3558,19 @@ OpenCore Legacy Patcher by default knows the most ideal self.content_caching_checkbox.SetPosition(wx.Point(self.wake_on_wlan_checkbox.GetPosition().x, self.wake_on_wlan_checkbox.GetPosition().y + self.wake_on_wlan_checkbox.GetSize().height)) self.content_caching_checkbox.SetToolTip(wx.ToolTip("Enables content caching support in macOS")) + # APFS Trim + self.apfs_trim_checkbox = wx.CheckBox(self.frame_modal, label="APFS Trim") + self.apfs_trim_checkbox.SetValue(self.constants.apfs_trim_timeout) + self.apfs_trim_checkbox.Bind(wx.EVT_CHECKBOX, self.apfs_trim_click) + self.apfs_trim_checkbox.SetPosition(wx.Point(self.content_caching_checkbox.GetPosition().x, self.content_caching_checkbox.GetPosition().y + self.content_caching_checkbox.GetSize().height)) + self.apfs_trim_checkbox.SetToolTip(wx.ToolTip("Enables APFS Trim support in macOS")) + # Button: return to main menu self.return_to_main_menu_button = wx.Button(self.frame_modal, label="Return to Settings") self.return_to_main_menu_button.Bind(wx.EVT_BUTTON, self.settings_menu) self.return_to_main_menu_button.SetPosition(wx.Point( - self.content_caching_checkbox.GetPosition().x, - self.content_caching_checkbox.GetPosition().y + self.content_caching_checkbox.GetSize().height + 10)) + self.apfs_trim_checkbox.GetPosition().x, + self.apfs_trim_checkbox.GetPosition().y + self.apfs_trim_checkbox.GetSize().height + 10)) self.return_to_main_menu_button.Center(wx.HORIZONTAL) # set frame_modal size below return to main menu button