browser-ruler/sample-config.hcl
2022-01-27 22:07:41 -08:00

40 lines
1.3 KiB
HCL

default_browser_cmd = ["firefox"]
# The rule label doesn't matter
rule "Flatpak Chromium" {
# Command and args, like with default
browser_cmd = ["flatpak", "run", "org.chromium.Chromium"]
# match evaluates an expr that should result in a MatchFunc where the signature
# is MatchFunc = func(url.URL) bool
# There are several functions provided that contain common rules and help construct this.
# provided are:
# matchHostname(...string) MatchFunc
# matchHostRegexp(...string) MatchFunc
# matchRegexp(...string) MatchFunc
# matchAny(...MatchFunc) MatchFunc
#
# For writing custom rules using expr, you can use the following two variables:
# hostname: the URL hostname
# url: the full string of the URL
#
# When using those, you can turn them into a MatchFunc using
# MatchFunc(bool) MatchFunc
#
# For example:
# MatchFunc(hostname endsWith "example.com")
# is equivalent to:
# matchHostRegexp(".*\\example\\.com$")
match = "matchHostname('google.com', 'youtube.com')"
}
rule "Firefox Private" {
browser_cmd = ["firefox", "--private-window"]
# For more complex rules, rules can span multiple lines using EOF syntax
match = <<EOF
matchAny(
matchHostname('facebook.com'),
MatchFunc(hostname == 'instagram.com')
)
EOF
}