When you double click on a file, xdg-open decides what program to use to open it. xdg-open is difficult to configure, inflexible and slow. This is where sesame comes in as an xdg-open alternative.
Sesame is:
- configured with a single JSON file,
- able to have complex rules including regex,
- faster.
By using a single JSON file as a configuration, it's easy to predict which program will be used and easy to change. Not only that but sesame is a single executable that open a single configuration file so it's pretty lightweight.
Sesame's configuration is a bit more powerful than simply choosing a program to use based on a type, it allows you to nest conditions and make smarter decisions. The first condition that passes determines which program is used to open the file. A good example of this is:
- use qutebrowser to open
http
andhttps
links, - but use mpv to play youtube videos,
- or use firefox for certain sites.
Expressed as a valid sesame configuration:
{
"protocol": {
"http,https": [
{
"contains": ["youtube.com/watch?", "youtu.be/watch?"],
"use": "mpv"
},
{
"contains": ["atlassian.net", "gitlab.com"],
"use": "firefox"
},
"qutebrowser"
]
}
}
Sesame is written in rust and so can be compiled to a static executable (~684 KB) which lets it do its job by using only two files:
- the sesame executable,
- the configuration file.
This is less flexible than the shell script that is often used but makes it faster and easier to understand.