From 6f736b919a4da2fa8aecef046f8785bc110bd6f4 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Thu, 16 Jan 2020 15:05:53 +0100 Subject: Add small utility to open things (WIP) --- .config/shell/env | 3 ++- .config/termite/config | 2 +- .local/bin/open | 29 +++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100755 .local/bin/open diff --git a/.config/shell/env b/.config/shell/env index f614d7b..05505a8 100644 --- a/.config/shell/env +++ b/.config/shell/env @@ -7,8 +7,9 @@ export LANG="en_US.UTF-8" export LESSCHARSET="utf-8" # Set favourite applications +export BROWSER="firefox" export EDITOR="vim" -export ALTERNATE_EDITOR="vim" +export ALTERNATE_EDITOR="ed" # set homepage for w3m export WWW_HOME=https://duckduckgo.com/ diff --git a/.config/termite/config b/.config/termite/config index b7f88ae..7f76372 100644 --- a/.config/termite/config +++ b/.config/termite/config @@ -1,5 +1,5 @@ [options] -browser = firefox +browser = open cursor_blink = off font = Liberation Mono 9 scrollback_lines = 100000 diff --git a/.local/bin/open b/.local/bin/open new file mode 100755 index 0000000..f3391d7 --- /dev/null +++ b/.local/bin/open @@ -0,0 +1,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" "$url" » } + } + } + default { + run « xdg-open "$url" »; + } + } +} -- cgit v1.1