aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/open
blob: f3391d728166275e72935f133f12ef9f6b8cdc5d (plain)
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
#! /usr/bin/env raku

use URL;

sub MAIN ($target)
{
	my URL $url .= new($target);

	if (!$url.scheme) {
		run « xdg-open "$target" »;
		exit 0;
	}

	given $url.scheme.fc {
		when 'http'|'https' {
			given $url.hostname.fc {
				when *.ends-with('aws.amazon.com') { run « chromium-browser "$url" » }
				when *.ends-with('google.com') { run « chromium-browser "$url" » }
				when *.ends-with('slack.com') { run « chromium-browser "$url" » }
				when *.ends-with('zaaksysteem.net') { run « chromium-browser "$url" » }
				when *.ends-with('zaaksysteem.nl') { run « chromium-browser "$url" » }
				default { run « "%*ENV<BROWSER>" "$url" » }
			}
		}
		default {
			run « xdg-open "$url" »;
		}
	}
}