summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rwxr-xr-x.local/bin/linkhandler26
-rwxr-xr-x.local/bin/statusbar28
3 files changed, 56 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 21309db..3834a83 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
*
!/.gitignore
!/.config**
+!/.local
+!/.local/bin**
diff --git a/.local/bin/linkhandler b/.local/bin/linkhandler
new file mode 100755
index 0000000..cc971fc
--- /dev/null
+++ b/.local/bin/linkhandler
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# Feed script a url or file location.
+# If an image, it will view in sxiv,
+# if a video or gif, it will view in mpv
+# if a music file or pdf, it will download,
+# otherwise it opens link in browser.
+
+if [ -z "$1" ]; then
+ url="$(xclip -o)"
+else
+ url="$1"
+fi
+
+case "$url" in
+ *mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*|*odysee.com*)
+ setsid -f mpv -quiet "$url" >/dev/null 2>&1 ;;
+ *png|*jpg|*jpe|*jpeg|*gif)
+ curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
+ *pdf|*cbz|*cbr)
+ curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
+ *mp3|*flac|*opus|*mp3?source*)
+ qndl "$url" 'curl -LO' >/dev/null 2>&1 ;;
+ *)
+ [ -f "$url" ] && setsid -f "$TERMINAL" -e "$EDITOR" "$url" >/dev/null 2>&1 || setsid -f "$BROWSER" "$url" >/dev/null 2>&1
+esac
diff --git a/.local/bin/statusbar b/.local/bin/statusbar
new file mode 100755
index 0000000..9f124a7
--- /dev/null
+++ b/.local/bin/statusbar
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+print_wifi() {
+ if=wlan0
+ while IFS=$': \t' read -r label value
+ do
+ case $label in SSID) SSID=$value
+ ;;
+ signal) SIGNAL=$value
+ ;;
+ esac
+ done < <(iw "$if" link)
+ test "$SIGNAL" && echo -e "$SSID $SIGNAL"
+}
+
+
+
+while true
+do
+ xsetroot -name\
+ "$(printf "%s %s %s %s%% %s"\
+ "$(print_wifi)"\
+ "`ip -4 -j a show wlan0 | jq -r ".[0].addr_info[0].local"`"\
+ "$(($(cat /proc/meminfo|grep MemAvailable | awk '{print $2}')/1024))M"\
+ "`</sys/class/power_supply/BAT0/capacity`"\
+ "`date "+W%V %d/%m %T%:::z"`")"
+sleep 1
+done