dotfiles

My configuration files.
Log | Files | Refs | README

commit a5a9556bbc438d119d22f144908864733f94b333
parent 4be0bdb498322d799c2b40c6f1461046f379501f
Author: Sven Möller <sven@svenmoeller.xyz>
Date:   Mon, 28 Feb 2022 22:18:30 +0100

Work on the scripts

Diffstat:
Mbin/.local/bin/bm | 20++++++++++++++++----
Abin/.local/bin/hackernews | 12++++++++++++
Mbin/.local/bin/lh | 30+++++++++++++++++++++---------
Mbin/.local/bin/news | 12++++++++----
Msxhkd/.config/sxhkd/sxhkdrc | 9++++++---
5 files changed, 63 insertions(+), 20 deletions(-)

diff --git a/bin/.local/bin/bm b/bin/.local/bin/bm @@ -1,6 +1,13 @@ #!/bin/sh -[ -z "$menu" ] && menu="fzf -i" +if [ "$1" = "-g" ] ; then + menu="dmenu -i -l 44" + browser="lh -g" + shift +else + menu="fzf -i" + browser="lh" +fi [ -z "$BM_DIR" ] \ && echo "No directory specified!" \ @@ -41,12 +48,12 @@ delete () { open () { url="$1" - $LINK_HANDLER "$url" + $browser "$url" } more () { url="$1" - lh "$url" + $browser -c "$url" } interactive () { @@ -114,7 +121,12 @@ help () { grep "^ [a-z|]\+)" $1 | sed 's/)//' | tr '|' '\n' | awk '{print "\t"$1}' } -if [ -z "$1" ]; then "$0" "unread" "-i"; exit; fi + +if [ -z "$1" ] ; then + cat "$BM_DIR/unread" | interactive unread; + exit; +fi + case "$1" in unread|favorite|archive) cat "$BM_DIR/$1" | foo "$@" ;; diff --git a/bin/.local/bin/hackernews b/bin/.local/bin/hackernews @@ -0,0 +1,12 @@ +#!/bin/sh + +if [ "$1" = "-g" ] ; then + menu="dmenu -i -l 44" + browser="lh -g" +else + menu="fzf" + browser="lh" +fi + +curl -s https://news.ycombinator.com/rss | sfeed | sfeed_plain | $menu\ + | grep -Eo 'https?://\S+' | xargs -r $browser diff --git a/bin/.local/bin/lh b/bin/.local/bin/lh @@ -10,14 +10,22 @@ open () { *.png|*.jpg|*.jpeg) curl $url | setsid -f imv -;; *.mp3|*.ogg|*youtube.com/watch*|*invidious.snopyta.org/watch*) mpv --fs --force-window $1 > /dev/null 2>&1 & ;; - *) qutebrowser $1 > /dev/null 2>&1 & ;; + *) openbrowser $1 ;; esac } +openbrowser () { + if [ $gui = true ] ; then + qutebrowser $1 > /dev/null 2>&1 & + else + python -m readability.readability -u $1 2> /dev/null | w3m -T text/html + fi + } + qr () { - [ $gui = true ] && \ - qrencode -o - "$1" | imv - || \ - qrencode -t UTF8 "$1" + [ $gui = true ] \ + && qrencode -o - "$1" | imv - \ + || qrencode -t UTF8 "$1" } clipboard () { @@ -44,13 +52,17 @@ choose () { $action "$1" } +while [ $# -gt 0 ]; do case $1 in - -g) gui=true ;; - -o) open $2 ;; - -c) choose ;; - -*) echo "Unknown option: $1" ;; + -g) + gui=true + shift ;; + -o) open $2 && exit ;; + -c) choose && exit;; + -*) echo "Unknown option: $1" && exit ;; *) [ $# -eq 2 ] && "$1" "$2" && exit - [ $# -eq 1 ] && cat "$0" | open "$1" + [ $# -eq 1 ] && cat "$0" | open "$1" && exit ;; esac +done diff --git a/bin/.local/bin/news b/bin/.local/bin/news @@ -1,8 +1,12 @@ #!/bin/sh -[ "$1" = "-g" ] \ - && menu="dmenu -i -l 44" \ - || menu="fzf" +if [ "$1" = "-g" ] ; then + menu="dmenu -i -l 44" + browser="lh -g" +else + menu="fzf" + browser="lh" +fi curl -s https://news.svenmoeller.xyz/index.txt | $menu\ - | grep -Eo 'https?://\S+' | xargs -r xdg-open + | grep -Eo 'https?://\S+' | xargs -r $browser diff --git a/sxhkd/.config/sxhkd/sxhkdrc b/sxhkd/.config/sxhkd/sxhkdrc @@ -37,12 +37,15 @@ super + c super + p passfill -super + o - menu="dmenu -i -l 44" bm all open +super + b + bm -g all open -super + i +super + n news -g +super + h + hackernews -g + super + odiaeresis i3lock -c 000000