-
Notifications
You must be signed in to change notification settings - Fork 8
Implement YAML-driven sjust-based macOS defaults with user overrides #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
@copilot try again to implement this PR |
Co-authored-by: paolomainardi <[email protected]>
I've successfully implemented the macOS defaults provisioning as requested in issue #99. The implementation includes: ✅ New Ansible task file ( The implementation follows Jeff Geerling's approach using the Commit: 5f742ff |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements comprehensive macOS system defaults configuration optimized for developer productivity, automatically applying 40+ system-level settings to enhance the development experience. The solution integrates seamlessly with the existing Ansible provisioning system using proper tagging for selective execution.
Key Changes
- New Ansible task file with developer-focused macOS defaults for UI/UX, Finder, Dock, keyboard, Safari, and development tools
- Integration into the main provisioning playbook with
macos-defaults
tag support - Documentation updates showing usage examples and selective deployment options
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
ansible/macos/macos/defaults.yml | New comprehensive macOS defaults configuration with 40+ developer-optimized settings |
ansible/macos/macos/base.yml | Integration of defaults task into main provisioning workflow |
README.md | Documentation updates explaining the new defaults feature and usage examples |
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
ansible/macos/macos/defaults.yml
Outdated
value: true | ||
tags: macos-defaults | ||
|
||
- name: Enable Safari Developer menu |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate functionality: This task (line 300-306) appears to duplicate the functionality of the previous task 'Enable Safari's developer menu' (line 292-298). Both tasks enable Safari's developer menu using different keys. Consider consolidating or clarifying the distinction between these settings.
- name: Enable Safari Developer menu | |
- name: Enable Safari's Develop menu |
Copilot uses AI. Check for mistakes.
ansible/macos/macos/defaults.yml
Outdated
|
||
- name: Restart Activity Monitor to apply changes | ||
command: killall "Activity Monitor" | ||
ignore_errors: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The restart tasks use command
module with killall
which may not be the most robust approach. Consider using ansible.builtin.shell
with error handling or checking if the process exists before attempting to kill it. The current approach may generate unnecessary error messages in logs.
ignore_errors: true | |
ansible.builtin.shell: | | |
if pgrep Finder > /dev/null; then | |
killall Finder | |
fi | |
tags: macos-defaults | |
- name: Restart Dock to apply changes | |
ansible.builtin.shell: | | |
if pgrep Dock > /dev/null; then | |
killall Dock | |
fi | |
tags: macos-defaults | |
- name: Restart Safari to apply changes | |
ansible.builtin.shell: | | |
if pgrep Safari > /dev/null; then | |
killall Safari | |
fi | |
tags: macos-defaults | |
- name: Restart Activity Monitor to apply changes | |
ansible.builtin.shell: | | |
if pgrep "Activity Monitor" > /dev/null; then | |
killall "Activity Monitor" | |
fi |
Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <[email protected]>
@copilot, I would like to migrate the Ansible implementation to a simple task that Ansible can reuse, making it easier for users to run without the burden of executing the Ansible provisioner. Another thing I want to add is this |
Co-authored-by: paolomainardi <[email protected]>
I've successfully migrated the Ansible implementation to standalone sjust tasks that make it much easier for users to apply macOS defaults without running the full provisioner: New SparkJust commands:
Added the requested setting:
The standalone tasks provide user-friendly output, progress indicators, and safety features while maintaining full compatibility with the existing Ansible integration. Users can now easily apply just the macOS defaults without the complexity of running the full provisioner. Commit: 8725bc8 |
@copilot i still see the ansible implementation, this isn't correct. I want to have the implementation just as an sjust task that ansible will execute. |
Co-authored-by: paolomainardi <[email protected]>
I've successfully migrated the implementation to a unified sjust approach as requested. The changes include: Removed the separate Ansible implementation:
Unified sjust implementation:
Benefits:
The reduce motion accessibility setting ( Commit: 6f820e8 |
- Add both 'sjust' and 'macos-defaults' tags to sjust installation block - Add both tags to macOS defaults application task - Now running --tags "macos-defaults" includes sjust installation - Ensures sjust is always available before executing macos-defaults Co-authored-by: paolomainardi <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sjust/recipes/03-macos-defaults.just
Outdated
echo "${yellow}You may need to restart applications or reboot for all changes to take effect.${normal}" | ||
else | ||
echo "Reset cancelled." | ||
fi No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to try making this list of settings easier by putting them in a YAML file, so they are easily discoverable and readable, and then process the YAML file to apply the settings.
We should have a way to let the user to override this default in a file ~/.local/spark/macos-defaults/overrides.yml
that will override the original settings.
We should use a language that has a native YAML processor. I do not want to write a script that is too complex and requires dependencies. Otherwise we can install https://github.com/mikefarah/yq with brew and use it from a shell script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented YAML-based configuration system as requested. All 40+ settings are now defined in config/macos/defaults.yml
for better readability and discoverability. Added user override support via ~/.local/spark/macos-defaults/overrides.yml
that automatically merges with default settings. Using yq (installed via Homebrew) for YAML processing from shell scripts. Added sjust macos-defaults-init-overrides
command to help users get started with customization.
Commit: 61c1468
Co-authored-by: paolomainardi <[email protected]>
Completed the refactoring to implement both requested changes:
The system now provides better discoverability, easier customization, and cleaner dependency management. Commit: 61c1468 |
defaults
command--tags macos-defaults
) and standalone usage (sjust macos-defaults
) execute identical logicsjust macos-defaults
command to apply all developer defaultssjust macos-defaults-check
command to show current defaults statussjust macos-defaults-reset
command to reset selected defaults (with safety prompts)sjust macos-defaults-init-overrides
command to create user customization filescom.apple.universalaccess.plist reduceMotion 1
)config/macos/defaults.yml
)~/.local/spark/macos-defaults/overrides.yml
sjust
The implementation provides a single, unified YAML-driven approach where both Ansible and standalone usage execute the same sjust task, eliminating code duplication and simplifying maintenance. Users can now easily customize settings via YAML overrides without touching the core configuration. All 40+ developer defaults are now discoverable and documented in structured YAML format.
ENHANCED USER EXPERIENCE: The new YAML-based system allows users to override any default setting through a simple configuration file (
~/.local/spark/macos-defaults/overrides.yml
), making customization accessible without modifying core system files.💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.