aboutsummaryrefslogtreecommitdiff
path: root/env/.local/bin
diff options
context:
space:
mode:
Diffstat (limited to 'env/.local/bin')
-rwxr-xr-xenv/.local/bin/scripts/urlview.sh6
-rwxr-xr-xenv/.local/bin/system/start-scripts/newsboat-fetch.sh8
2 files changed, 10 insertions, 4 deletions
diff --git a/env/.local/bin/scripts/urlview.sh b/env/.local/bin/scripts/urlview.sh
index 797f40f..394ac66 100755
--- a/env/.local/bin/scripts/urlview.sh
+++ b/env/.local/bin/scripts/urlview.sh
@@ -1,14 +1,14 @@
#!/bin/sh
-url="$(grep -o -e 'http://[^"]*' -e 'https://[^"]*' <&0 | tr ' ' '\n' | fzf)"
-[ "$url" = "" ] && exit
+url="$(grep -Eo "https?://[^]})\"'' ]*" <&0 | fzf)" # extra ' because my editor dont syntax highlight correctly
+[ ! "$url" ] && exit
choices="\
clipboard
browser/xdg-open"
choice=$(echo "$choices" | fzf)
-[ "$choice" = "" ] && exit
+[ ! "$choice" ] && exit
choice=$(echo "$choice" | sed -e 's/browser\/xdg-open/xdg-open/') # browser/xdg-open should just run xdg-open
if [ "$choice" = "clipboard" ]; then
diff --git a/env/.local/bin/system/start-scripts/newsboat-fetch.sh b/env/.local/bin/system/start-scripts/newsboat-fetch.sh
index 5eefe9b..bd9146c 100755
--- a/env/.local/bin/system/start-scripts/newsboat-fetch.sh
+++ b/env/.local/bin/system/start-scripts/newsboat-fetch.sh
@@ -1,11 +1,17 @@
#!/bin/sh
+
+CACHE_FILE="/tmp/newsboat-unreads.cache"
+
+[ -f "$CACHE_FILE" ] || echo "0" > "$CACHE_FILE"
+
newsboat_loop(){
NO_PROXY=\".com,.org,.xyz,.chat,.social,.net,.co,.love\" newsboat -x reload
- #newsboat -x print-unread | xargs -0 notify-send "newsboat feed"
unreads=$(newsboat -x print-unread)
unreadnum=$(printf -- "%s" "$unreads" | sed 's/ .*//g')
+ echo "${unreadnum:-0}" > "$CACHE_FILE"
+
if [ "$unreadnum" -gt 0 ]; then
notify-send "newsboat feed" "$unreads"
fi