0xdevalias / dotfiles

devalias does dotfiles
http://zachholman.com/2010/08/dotfiles-are-meant-to-be-forked/
MIT License
8 stars 1 forks source link

Automate macOS launchpad sorting, folders, etc #7

Open 0xdevalias opened 4 years ago

0xdevalias commented 4 years ago

It would be cool if we could create folders and sort apps into them in an automated way.

⇒  lsof | grep com.apple.dock.launchpad
Dock       1322 devalias  txt       REG                1,4       32768              444803 /private/var/folders/rd/nx4rzsrn1ms23qcgtpbkh_jm0000gn/0/com.apple.dock.launchpad/db/db-shm
Dock       1322 devalias    5u      REG                1,4     7376896              444800 /private/var/folders/rd/nx4rzsrn1ms23qcgtpbkh_jm0000gn/0/com.apple.dock.launchpad/db/db
Dock       1322 devalias    6u      REG                1,4     3889312              444802 /private/var/folders/rd/nx4rzsrn1ms23qcgtpbkh_jm0000gn/0/com.apple.dock.launchpad/db/db-wal
Dock       1322 devalias    7u      REG                1,4       32768              444803 /private/var/folders/rd/nx4rzsrn1ms23qcgtpbkh_jm0000gn/0/com.apple.dock.launchpad/db/db-shm
0xdevalias commented 2 years ago

The following is an extract from my (private) obsidian note: DeepDive - Dotfiles (and macOS defaults, settings) management tools, processes, etc

obsidian://open?vault=Notes%20(Dropbox)&file=deepdive%2FDeepDive%20-%20Dotfiles%20(and%20macOS%20defaults%2C%20settings)%20management%20tools%2C%20processes%2C%20etc)

Edit [[macOS]] launchpad database

0xdevalias commented 1 year ago

ChatGPT Ref: https://chat.openai.com/chat/68754471-c6a5-446e-a37b-af15d36c72c6

USER

What is the macOS screen called that shows all installed apps?

ASSISTANT

The macOS screen that shows all installed apps is called the Launchpad. It provides a convenient way to access and launch applications on a Mac, similar to the home screen on an iOS device. The Launchpad can be opened by clicking on its icon in the Dock, pressing the F4 key on newer Macs, or using a multi-touch gesture. Once open, you can scroll through your installed applications, organize them into folders, or search for a specific app using the search bar at the top.

USER

Where is the data from launchpad stored, including the folder names, and which apps are stored within them?

ASSISTANT

The data for Launchpad is stored in a database file called "db" located in the folder /private/var/folders/xx/xxxxxxxxxxxxxxxxxxxxxxxxxxxxx/0/com.apple.dock.launchpad/. The xx/xxxxxxxxxxxxxxxxxxxxxxxxxxxxx part of the path is a randomly generated folder name that will be different on every Mac. You can navigate to this folder by opening Finder and pressing Shift+Command+G, then pasting the above path into the "Go to folder" dialog.

Within this folder, you will find the Launchpad database file named "db". This file contains information about all of the apps installed on your Mac, including their names, icons, and the folders they are organized into. It is a SQLite database file that can be opened and queried using various third-party tools.

Note that modifying this database file directly can be risky and may cause issues with Launchpad. It is recommended that you use the built-in functionality of Launchpad to organize your apps, rather than attempting to modify the database file manually.

USER

How can I directly access the database?

ASSISTANT

Directly accessing and modifying the Launchpad database file can be risky and may cause issues with Launchpad. However, if you still want to access the Launchpad database file, you can use a SQLite database viewer, such as the free "DB Browser for SQLite" application.

Here are the steps to access the Launchpad database file:

  1. Download and install DB Browser for SQLite from its official website.

  2. Open the "Finder" application on your Mac, then press "Shift+Command+G" to open the "Go to Folder" dialog.

  3. In the "Go to Folder" dialog, type /private/var/folders, then press the "Go" button.

  4. In the "folders" folder, you will find a randomly named folder. Open it and navigate to /0/com.apple.dock.launchpad/.

  5. In this folder, you will find the Launchpad database file named "db". Make a backup of this file before you proceed.

  6. Open the DB Browser for SQLite application, and select "Open Database" from the "File" menu.

  7. In the file selection dialog, navigate to the Launchpad database file named "db", select it, and click the "Open" button.

  8. You can now view and query the Launchpad database using DB Browser for SQLite.

Note that modifying the Launchpad database file directly can be risky and may cause issues with Launchpad. It is recommended that you use the built-in functionality of Launchpad to organize your apps, rather than attempting to modify the database file manually.

USER

What tables exist in this db, and what are they used for?

ASSISTANT

The Launchpad database file ("db") contains several tables that store information about the installed applications and how they are organized within Launchpad. Here is a brief overview of the tables and their purpose:

  1. apps: This table contains information about each installed application, such as its name, bundle identifier, and path to its executable file.

  2. groups: This table contains information about each Launchpad folder, such as its name and position within Launchpad.

  3. items: This table contains information about each item in Launchpad, which can be an application or a folder. This includes the item's position within Launchpad, its type (app or folder), and its association with a specific app or folder.

  4. aliases: This table contains information about any aliases used in Launchpad, which can point to an application or a folder.

  5. bundle_data: This table contains additional information about each installed application, such as its icon and version number.

  6. dbinfo: This table contains metadata about the Launchpad database, such as its schema version and last modified date.

  7. pictures: This table contains information about the pictures used in Launchpad, such as their name and file path.

These tables are used by Launchpad to organize and display the installed applications on your Mac. By querying and modifying the Launchpad database file, you can change how the applications are organized and displayed within Launchpad. However, modifying the Launchpad database file directly can be risky and may cause issues with Launchpad. It is recommended that you use the built-in functionality of Launchpad to organize your apps, rather than attempting to modify the database file manually.