Skip to content

Add "Open Custom Layouts Folder" button to Layouts preferences#1805

Merged
ianyh merged 1 commit intoianyh:developmentfrom
rgeraskin:add-open-custom-layouts-folder-button
Dec 16, 2025
Merged

Add "Open Custom Layouts Folder" button to Layouts preferences#1805
ianyh merged 1 commit intoianyh:developmentfrom
rgeraskin:add-open-custom-layouts-folder-button

Conversation

@rgeraskin
Copy link
Copy Markdown
Contributor

Add "Open Custom Layouts Folder" button to Layouts preferences

Closes #1434

What's Changed

Added a new button in the Layouts preferences tab that allows users to quickly open the custom layouts directory in Finder.

Why This Feature?

  • Better User Experience: Users no longer need to manually navigate to ~/Library/Application Support/Amethyst/Layouts/
  • Improved Discoverability: Makes it easier for users to find where to place custom layout JavaScript files
  • Consistency: Follows macOS app patterns of providing direct access to user data directories

How It Works

  • Button is positioned to the left of the existing "Relaunch Amethyst" button
  • Clicking "Open Custom Layouts Folder" opens the layouts directory in Finder
  • If the directory doesn't exist, it's automatically created (via existing layoutsDirectory() method)
  • Graceful error handling with logging if directory access fails

Implementation Details

  • UI Changes: Added button with proper Auto Layout constraints in LayoutsPreferencesViewController.xib
  • Controller Changes: Added @IBOutlet and @IBAction in LayoutsPreferencesViewController.swift
  • Leverages Existing API: Uses the existing FileManager.layoutsDirectory() extension method
  • Native macOS Integration: Uses NSWorkspace.shared.open() to open directory in default file manager

Files Modified

  • Amethyst/Preferences/LayoutsPreferencesViewController.xib - Added button UI and constraints
  • Amethyst/Preferences/LayoutsPreferencesViewController.swift - Added outlet and action method

User Benefit

This enhancement reduces friction for users who want to create or manage custom layouts, making the feature more accessible and user-friendly.

Comment on lines +109 to +110
// Handle error - could show an alert or log the error
NSLog("Failed to open layouts directory: \(error)")
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use log instead of NSLog?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@rgeraskin rgeraskin force-pushed the add-open-custom-layouts-folder-button branch from 4e2a43f to 1d65807 Compare December 15, 2025 10:29
@ianyh ianyh merged commit 8a48f15 into ianyh:development Dec 16, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add button or menu item to open custom layouts folder

2 participants