Skip to content

Effortlessly declutter the macOS Launchpad, ensuring swift access to your most-used apps, paving the way to a tidier, more organised Mac.

License

Notifications You must be signed in to change notification settings

nicolodiamante/prune

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

prune

The Launchpad on a Mac serves as a quick access hub to all installed applications. With a simple gesture or a click, it displays an easy-to-navigate grid of app icons, providing a user-friendly way to launch applications without digging through the Applications folder. However, over time, as more applications get installed, the Launchpad can become cluttered with icons, including those of seldom-used or obsolete apps. This accumulation of icons can hinder easy access to frequently used apps, transforming a feature initially intended for convenience into a source of potential annoyance.

Prune is a script designed to automate the removal of specified apps from the Launchpad, helping maintain a clean, tidy, and efficient app launch interface. By specifying which apps you want to keep or remove through a simple configuration, Prune takes care of the rest. It delves into the system, meticulously removes the selected apps from the Launchpad, and leaves it in a clean and organised state.



Launchpad


Getting Started

Installation

The installation process of Prune is streamlined for simplicity. You can automatically download and install Prune via curl by executing the following command in your terminal:

zsh -c "$(curl -fsSL https://raw.githubusercontent.com/nicolodiamante/prune/HEAD/bootstrap.zsh)"

If you prefer a more manual approach, you can clone the repository to your local machine using git with the command:

git clone https://github.com/nicolodiamante/prune.git

After cloning the repository, navigate to its directory in the terminal and run the installation script as follows:

source utils/install.zsh

When you run the installation script, it performs two main actions to set up Prune on your system. Firstly, it copies the agent files into the ~/Library/LaunchAgents directory. This step ensures that the necessary agent files are placed in the correct location, allowing the system to recognise and execute them as needed. Secondly, the script adds an alias to your shell configuration file .zshrc, making it easier for you to invoke Prune from the terminal.

# Launch the Prune script.
alias prune='$HOME/prune/scripts/prune.zsh'

These steps will ensure Prune is properly set up on your system, ready to assist you in managing your Launchpad efficiently and effortlessly.

How It Works

Prune operates through a trio of components: a configuration file, a script, and a plist file for automation. The heart of Prune lies in its straightforward configuration file named apps, where you specify which apps to keep or remove from the Launchpad. It's crucial to write down the app names exactly as they appear on your Mac, including spaces, capitalisation, etc., to ensure accurate matching. Each app name should be on a new line and enclosed in single quotes, like so:

Prune Apps List


By managing the list of app names in the apps file, you are essentially guiding Prune on which apps to retain or remove from the Launchpad. The core script, .pruneops.zsh, reads this file, translates your preferences into actions, and executes the necessary commands to tidy up your Launchpad.

For continuous tidiness, Prune leverages a plist file, allowing it to run automatically each time your Mac starts. This plist file, loaded via launchctl, points to .pruneops.zsh ensuring that every time your Mac boots up, Prune checks the apps file and cleans up your Launchpad accordingly.

Besides the automatic cleanup, you can also invoke Prune manually whenever needed. By typing prune in the terminal, you initiate the script. Upon entering your password, Prune swings into action, clearing away the unwanted apps from the Launchpad as specified in the apps file.



Prune Terminal



This blend of automated and manual operation, fueled by a simple configuration, makes Prune a powerful tool for maintaining a clutter-free, organised Launchpad, whether you're at the helm or letting it run on autopilot.

How to Reset Launchpad Layout

In case you wish to restore the Launchpad to its original state, erasing the customisations made by Prune, a simple command is built into the script for this purpose. By invoking prune --default or prune -d in the terminal, the Launchpad will revert to its default layout, including all apps and their original organisation. This action utilises a native macOS command to reset the Launchpad, ensuring a safe and straightforward return to the default setup. It's a quick way to undo Prune's changes, should you ever want to start afresh with your Launchpad organisation

Loading and Unloading Prune Agent

Prune's functionality is driven by a background agent that automates the cleaning of your Launchpad based on the preferences you've set. There might be instances where you'd want to stop the agent temporarily or start it after it has been stopped. Prune provides simple commands for these actions:

To load the Prune agent:

prune -l

To unload the Prune agent:

prune -u

These commands allow you to control the Prune agent's activity on your system.

Verifying Prune Agent Status

After loading or unloading the Prune agent, it's good practice to check its status to ensure it's operating as intended:

prune -c

A successful check should return the following output, indicating that the Prune agent is active and loaded:



Prune checking Agent



If the Prune agent is not loaded, there will be no output.

This verification step assures that Prune is set up correctly and ready to keep your Launchpad organised. It's a handy tool for troubleshooting and confirming the agent's operational status.

Removing a Specific App from the Launchpad

Prune now offers the ability to remove a specific app from your Launchpad. This feature is useful when you want to declutter your Launchpad by removing individual apps without affecting others.

To remove a specific app:

prune -r [AppName]

Replace [AppName] with the exact name of the app you wish to remove from the Launchpad.

For example, to remove an app named "QuickTime Player", you would use:

prune -r "QuickTime Player"

This command will instruct Prune to specifically remove the "QuickTime Player" from your Launchpad.

Note: Be sure to use the exact name of the app as it appears in your Launchpad. The removal is case-sensitive and requires the full app name.

Accessing Help

Prune comes with a built-in help option to provide quick access to its usage instructions right from the terminal. Whether you're unsure about how to reset the Launchpad layout or need a reminder about how to launch Prune, the help option is there to assist you. To access this, simply type prune --help or prune -h in the terminal. This will display a summary of available options and how to use them.

What's new in Prune

v1.1

Release Highlights:

  • Dynamic Database Path Detection: The script now dynamically finds the correct com.apple.dock.launchpad database path for the current user. This enhancement ensures that the script works seamlessly on systems with multiple users, addressing the issue where the incorrect path might be selected.



Notes

Restoring App Icons to Launchpad

If you wish to re-add an application icon to the Launchpad after it has been removed by Prune, you'll need to manually add it back. This can be done easily by finding the application in your Applications folder, and then dragging and dropping the application icon onto the Launchpad icon in your Dock. Remember, Prune is here to help keep your Launchpad tidy by automating the removal of specified apps, but re-adding apps to the Launchpad is a manual process.



Add apps to Launchpad


Resources

Contribution

Any suggestions or feedback you may have for improvement are welcome. If you encounter any issues or bugs, please report them to the issues page.

Nicolò Diamante Portfolio

MIT License