~ruther/guix-config

ref: ea2c1b30d1865ee9ad45d07f9956d3ab00833e04 guix-config/home/modules/ruther/packages/browser-selector.scm -rw-r--r-- 1.8 KiB
ea2c1b30 — Rutherther chore: stop blocking codeberg hosts 9 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
(define-module (ruther packages browser-selector)
  #:use-module (guix packages)
  #:use-module (guix build-system copy)
  #:use-module (guix gexp)
  #:use-module (guix licenses)
  #:use-module (gnu packages guile))

(define-public browser-selector
  (package
    (name "browser-selector")
    (version "1.0")
    (source (local-file "browser-selector-script"))
    (build-system copy-build-system)
    (arguments
     '(#:install-plan
       '(("browser-selector-script" "bin/browser-selector"))
       #:phases
       (modify-phases %standard-phases
         (add-after 'install 'make-executable
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((bin-file (string-append (assoc-ref outputs "out")
                                            "/bin/browser-selector")))
               (chmod bin-file #o755))))
         (add-after 'make-executable 'install-desktop-file
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out")))
               (make-desktop-entry-file
                (string-append out "/share/applications/browser-selector.desktop")
                #:name "Browser Selector"
                #:comment "Smart browser selector for URLs"
                #:exec (string-append out "/bin/browser-selector %u")
                #:categories '("Network" "WebBrowser")
                #:mime-type '("text/html" "text/xml" "application/xhtml+xml" "x-scheme-handler/http" "x-scheme-handler/https"))))))))
    (native-inputs (list guile-3.0))
    (home-page "")
    (synopsis "Smart browser selector for URLs")
    (description "A Guile script that automatically selects Firefox or LibreWolf
based on URL patterns.  YouTube, Netflix, Max, Twitch, and Discord open in
Firefox, while all other URLs open in LibreWolf.")
    (license gpl3+)))