Giter Club home page Giter Club logo

sesam's Introduction

Sesam

Very simple xdg-open replacement in python. xdg-open sucks without a full desktop environment, plus, things should be simpler to configure. Sesam allows you to use wildcards in your config to easily catch media types and URLS. It also ignores the desktop files and uses commands instead, although it is possible to fall back on xdg-open and use the desktop files in this way.

Install

Just add the xdg-open file in this repo to your path (before the real xdg-open) and make sure it is executable. You will need python3 with python-magic installed (pip3 install python-magic)

Config

The configuration file is in ~/.sesam for the user and /etc/sesam.conf for the system wide config. A simple example:

# you can simply list your mimetypes:
application/pdf = zathura

# mimetypes might have wildcards:
text/* = xemacs
video/* = mpv

# you can use shorthands to include (parts of) the filename where needed
uimage/* = feh <file> -.Z

# URLs are also handled by scheme type:

x-scheme-handler/mailto = thunderbird
x-scheme-handler/http = firefox
x-scheme-handler/https = firefox

# You can even fallback on xdg-open if you would like
* = /usr/bin/xdg-open

Shorthands

You can use the following shorthand to the path for a filetype:

  • <filename> - name of the file, without the path.
  • <folder> - the folder of the file without the filename.

For URLs you can use the following shorthand:

  • <scheme> - URL scheme that was matches
  • <path> - Everything after the scheme

For both file types and URLs you can add:

  • <mime> - the mimetype that was matched
  • <file> - full path as passed

If no shorthand is present, then the the full filename is added at the end of the command.

Inspiration

This project is inspired by mimi. However, mini seems to hard code URLs and some other stuff, which takes power away from the config.

Questions & Input

Please feel free to ask questions or suggest features!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.