Skip to content

a13/bruh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

BRowse Url Helpers

This package provides some helper functions and customs that allow you to open image and video URLs (using regexp-based matching) in external applications, while still having the possibility to fall back to defaults.

You can achieve the same functionality by customizing browse-url-browser-function to a list of (REGEXP . FUNCTION) elements (see its docstring), but it requires more manual work, which I personally don’t like. So that’s how this package was born.

Installation

The minimal one. Installs package and sets browse-url-browser-function to use the wrapper

(use-package bruh
  :after browse-url
  :quelpa
  (bruh :repo "a13/bruh" :fetcher github)
  :custom
  (browse-url-browser-function #'bruh-browse-url))

More advanced one (NB :custom-update keyword requires use-package-custom-update package)

(use-package bruh
  :after browse-url
  :quelpa
  (bruh :repo "a13/bruh" :fetcher github)
  :custom-update
  (bruh-images-re
   '("^https?://img-fotki\\.yandex\\.ru/get/"
     "^https?://pics\\.livejournal\\.com/.*/pic/"
     "^https?://l-userpic\\.livejournal\\.com/"
     "^https?://img\\.leprosorium\\.com/[0-9]+$"))
  :custom
  (browse-url-browser-function #'bruh-browse-url)
  (bruh-default-browser #'bruh-chromium-new-app)
  (bruh-videos-browser-function #'bruh-mpv))

Customizations

Base configuration

browse-url-browser-function set to bruh-browse-url if you want to use the wrapper

bruh-default-browser use if no images or videos were detected. Set to nil if you want to ignore it.

Images

bruh-images-re - a list of regular expressions for image URLs

bruh-images-browser-function - a browse-url-compatible function to open image URLs, the default is eww-browse-url, but you can use bruh-feh instead. Set to nil if you want to open images in the default browser.

Videos

bruh-videos-re - a list of regular expressions for video URLs

bruh-videos-browser-function - a browse-url-compatible function to open video URLs, the default is bruh-mpv. Set to nil if you want to open videos in the default browser.

Interactive commands

bruh-chromium-new-app (requires chrome or chromium)

bruh-feh uses feh to browse image URLs.

bruh-mpv uses mpv+youtube-dl to browse video URLs. Check if they are present in your system and work from the terminal.

bruh-browse-url - try to find suitable function to open URL argument

The search order is

  • URL matches some of the bruh-videos-re - bruh-videos-browser-function
  • URL matches some of the bruh-images-re - bruh-images-browser-function
  • bruh-default-browser
  • browse-url-default-browser

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published