openurl

Version, currently 0.1.02 versions

github.com/jo1gi/openurl

Opens urls in the specified program

2 stars
0 dependents
License: MIT

Nothing has been indexed for 0.1.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.

Installation

# Add this to your shard.yml
dependencies:
  openurl:
    github: jo1gi/openurl
    version: ~> 0.1.0

Then run:

shards install

shard.yml

No shard.yml has been indexed for 0.1.0. You can read it on the repository.

Dependencies

Unknown: the shard.yml for this version has not been read yet.

README

This README is the one indexed from the repository at its latest ref, not from the tag for this version.

openurl

GitHub release GitHub top language License Build

Opens urls based on rules in a yaml file.

Usage

To run, just execute the program with a url as the argument. The program will expect a config file located at $XDG_CONFIG_HOME/openurl/config.yaml. The program will then open the url with the command specified in the config.

Configuration

The Configuration file specifies which programs should open which urls. It consists of a list of rules for opening urls.

Here is an example where youtube is opened in vlc, all other websites are opened through firefox, and gemini capsules are opened in amfora.

- protocol: https?
  command: firefox
  subrules:
    - domain: youtube.com
      command: vlc

- protocol: gemini
  command: amfora

The program checks each rule one by one. When it finds a rule set that matches the url, it will check if any subrules match the url. When the first matching rule is found, the corresponding command will be run with the url appended.

Each rules is comprised of a list of attributes that can be tested. Each attribute corresponds with a part of the url. This part will be checked to see if the given regex matches.

AttrubuteDescriptionExample
protocolCommunication protocolhttps://channels.nixos.org/nixos-21.05/latest-nixos-gnome-x86_64-linux.iso
domainWebsite domain name and subdomainhttps://channels.nixos.org/nixos-21.05/latest-nixos-gnome-x86_64-linux.iso
last_fileLast part of pathhttps://channels.nixos.org/nixos-21.05/latest-nixos-gnome-x86_64-linux.iso
filetypeFile extension if it existshttps://channels.nixos.org/nixos-21.05/latest-nixos-gnome-x86_64-linux.iso
pathAnything after the domain and before parametershttps://channels.nixos.org/nixos-21.05/latest-nixos-gnome-x86_64-linux.iso
urlMatches everythinghttps://channels.nixos.org/nixos-21.05/latest-nixos-gnome-x86_64-linux.iso