     func window(_ window: NSWindow, willPositionSheet sheet: NSWindow, using rect: NSRect) -> NSRect {
         
         if sheet.className == "NSToolbarConfigPanel" {
-            sheet.removeSmallSizeButton()
+            sheet.contentView?.removeSmallSizeButton()
         }
         
         return rect
     }
     
 }
+
+
+
+private extension NSView {
+    
+    /// remove "Use small size" button in the toolbar customization sheet
+    func removeSmallSizeButton() {
+        
+        let toggleButton: NSButton? = self.descendants.lazy
+            .compactMap { $0 as? NSButton }
+            .first { $0.action?.string == "toggleUsingSmallToolbarIcons:" }
+        
+        toggleButton?.isHidden = true
+        self.needsDisplay = true
+    }
+    
+    
+    /// find all subviews recursively
+    private var descendants: [NSView] {
+        
+        return self.subviews + self.subviews.flatMap { $0.descendants }
+    }
+    
+}
+
+
+private extension Selector {
+    
+    var string: String {
+        
+        return NSStringFromSelector(self)
+    }
+    
+}

        guard let contextMenu = self.window?.contentView?.superview?.menu else { return }
        
        // find "Use Small Size" menu item
        guard let menuItem = contextMenu.items.first(where: {
            guard let action = $0.action else { return false }
            return NSStringFromSelector(action) == "toggleUsingSmallToolbarIcons:"
        }) else { return }
        
        // remove separator
        let index = contextMenu.index(of: menuItem)
        if contextMenu.item(at: index + 1) == NSMenuItem.separator() {
            contextMenu.removeItem(at: index + 1)
        }
        
        // remove item

        
        // fallback for removing "Use small size" button in `window(:willPositionSheet:using)`
        if let sheet = self.window?.attachedSheet {
            sheet.contentView?.removeSmallSizeButton()
        }
    }
    
}
