Manage default file and URI scheme handlers on macOS 12.0+
Project description
Manage default handlers for files and URI schemes on MacOS 12.0+.
Features
Manage handlers by specifying file extension, UTI or URI scheme.
Specify handlers by name, bundle ID or absolute path.
Check your associations into a dotfiles repository and ensure an idempotent state by simply running dooti apply.
Installation
I recommend installing with pipx, although pip will work fine as well:
pipx install dooti
Quickstart
dooti currently supports three specific subcommands (ext, scheme, uti) and a broad one (apply).
Lookup handlers
Simply pass a list of one specific type to the appropriate command. Example:
$ dooti ext html xml
html: /Applications/Firefox.app
xml: /Applications/Sublime Text.app
$ dooti --format json scheme http https ftp | jq
{
"http": "/Applications/Firefox.app",
"https": "/Applications/Firefox.app",
"ftp": "/System/Library/CoreServices/Finder.app"
}
$ dooti uti public.html
public.html: /Applications/Firefox.app
Set handlers
Changing the default handler can be requested by adding -x <handler_ref> to the lookup command. The handler reference can be a name, bundle ID or absolute filesystem path. Example:
$ dooti ext csv xml -x "Sublime Text"
The following extensions are set to be changed:
csv: /Applications/Numbers.app -> /Applications/Sublime Text.app
xml: /Applications/Firefox.app -> /Applications/Sublime Text.app
$ dooti scheme ftp -x /Applications/Firefox.app
The following scheme is set to be changed:
ftp: /System/Library/CoreServices/Finder.app -> /Applications/Firefox.app
$ dooti -tf json uti public.c-source -x com.sublimetext.4
{"changes": {"utis": {"public.c-source": {"from": "/Applications/Notes.app", "to": "/Applications/Sublime Text.app"}}}, "errors": []}
Ensure state
dooti can ingest and apply a YAML configuration like this:
ext:
jpeg: Preview
scheme:
http: Firefox
mailto: Mail
uti:
public.c‑source: Sublime Text
app:
Sublime Text:
ext:
- py
- rst
- yml
- yaml
uti:
- public.fortran‑source
Brave Browser:
scheme:
- ipfs
By default, it looks at $XDG_CONFIG_HOME/dooti/config.yaml (and others, see docs/usage.rst).
Limitations
The designated handler has to be installed before running the command.
Setting some URI scheme handlers (especially for http) might cause a prompt.
Setting some file extension handlers might be restricted (especially html seems to fail silently).
Why?
Most existing tools use LSSetDefaultRoleHandlerForContentType and LSSetDefaultHandlerForURLScheme, which are deprecated in macOS 12.0. dooti uses a more recent API and should work on Monterey (12.0) and above.
Similar tools
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file dooti-0.2.0.tar.gz
.
File metadata
- Download URL: dooti-0.2.0.tar.gz
- Upload date:
- Size: 21.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.10.8 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 012e54ba54fee18ca26741daa92a55fd70f1d14c31bc172a3fcf00f7778f10a8 |
|
MD5 | c289008716abd761cbd8baf19961464d |
|
BLAKE2b-256 | 678cad75180067b22418dd17a76f2f8e15e187b6099af0d047c817aaaa233a8f |
File details
Details for the file dooti-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: dooti-0.2.0-py3-none-any.whl
- Upload date:
- Size: 20.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.10.8 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 191964177121fe0ee995a95d704f55485c0ba003e49967e644716798a196ea0b |
|
MD5 | 22cd25968230175d38f2097027073a30 |
|
BLAKE2b-256 | 60d08b26a4611c2f294c17e2c28e9b68db845be68d9a9f2e6f608f1c194b06d1 |