From 6cc31a2b88476fe42b7bca369d0b782bf9b0c7cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Mon, 4 Dec 2017 07:21:04 +0100 Subject: Drop surf-menu as it's now part of mysurf --- install | 1 - local/bin/surf-menu | 60 ----------------------------------------------------- 2 files changed, 61 deletions(-) delete mode 100755 local/bin/surf-menu diff --git a/install b/install index 1a23184..8f96cc6 100755 --- a/install +++ b/install @@ -102,7 +102,6 @@ fi if ask "Install Surf configuration"; then inst surf/script.js ~/.surf/script.js inst surf/styles/default.css ~/.surf/styles/default.css - inst local/bin/surf-menu ~/.local/bin/surf-menu fi if ask "Install MPD configuration"; then diff --git a/local/bin/surf-menu b/local/bin/surf-menu deleted file mode 100755 index b2e0111..0000000 --- a/local/bin/surf-menu +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh -set -e - -BOOKMARDS=~/notes/bookmarks.md - -run() { - echo "Run $1" - echo "$1" | grep -qE '^~?/' || true - echo $? - if echo "$1" | grep -qE '^\?'; then # We do search on duckduckgo - - surf "https://duckduckgo.com/?q=${L#?}&t=surf&kk=-1&ia=web" & - - elif echo "$1" | grep -qE '^~?/'; then # This is local path - - surf "${1/#\~/$HOME}" & - - elif echo "$1" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+'; then # This ipv4 address - - surf "$1" & - - else # We follow address - - LPROTOCOL="$(echo "$1" | sed -n 's#^\([^:]*\)://.*#\1#p')" - LHOST="$(echo "$1" | sed -n 's#^[^:]*://##;s#^\([^/]\+\)/\?.*#\1#p')" - LPATH="$(echo "$1" | sed 's#^[^:]*://##;s#^[^/]\+/\?##')" - - if ! getent hosts "$LHOST" >/dev/null; then - if getent hosts "$LHOST.cz" >/dev/null; then - LHOST="$LHOST.cz" - elif getent hosts "$LHOST.org" >/dev/null; then - LHOST="$LHOST.org" - elif getent hosts "$LHOST.com" >/dev/null; then - LHOST="$LHOST.com" - fi - # TODO what to do when we can't expand it? - fi - # Decide on protocol (if connection to 443 is not possible then use http otherwise https) - if [ -z "$LPROTOCOL" ]; then # We already have protocol (given explicitly) - if nc -z -w1 "$LHOST" 443 2>/dev/null; then - LPROTOCOL="https" - else - LPROTOCOL="http" - fi - fi - - surf "$LPROTOCOL://$LHOST/$LPATH" & - - fi -} - -if [ -n "$1" ]; then - run "$1" - exit -else - # Note: Bookmarks starts with '* ' - sed -n 's/\* //p' "$BOOKMARDS" | dmenu -p 'surf' | while read L; do - run "$L" - done -fi -- cgit v1.2.3