aboutsummaryrefslogtreecommitdiff
path: root/.local/bin
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin')
-rwxr-xr-x.local/bin/brainmassage54
-rwxr-xr-x.local/bin/clock11
-rwxr-xr-x.local/bin/cmus-refresh5
-rwxr-xr-x.local/bin/cmus_edit_tags9
-rwxr-xr-x.local/bin/disk23
-rwxr-xr-x.local/bin/dmount14
-rwxr-xr-x.local/bin/es3
-rwxr-xr-x.local/bin/fzfimg147
-rwxr-xr-x.local/bin/internet22
-rwxr-xr-x.local/bin/kbselect16
-rwxr-xr-x.local/bin/libview17
-rwxr-xr-x.local/bin/manuals2
-rwxr-xr-x.local/bin/map8
-rwxr-xr-x.local/bin/memory12
-rwxr-xr-x.local/bin/messages3
-rwxr-xr-x.local/bin/mkbackup1
-rwxr-xr-x.local/bin/ncureses-extendedbin0 -> 16464 bytes
-rwxr-xr-x.local/bin/nettraf28
-rwxr-xr-x.local/bin/news17
-rwxr-xr-x.local/bin/outset3
-rwxr-xr-x.local/bin/pacpackages31
-rwxr-xr-x.local/bin/playjazz1
-rwxr-xr-x.local/bin/podfetch21
-rwxr-xr-x.local/bin/podplay2
-rwxr-xr-x.local/bin/popupgrade9
-rwxr-xr-x.local/bin/powerdialog15
-rwxr-xr-x.local/bin/printcolors4
-rwxr-xr-x.local/bin/screencast11
-rwxr-xr-x.local/bin/search2
-rwxr-xr-x.local/bin/showimg26
-rwxr-xr-x.local/bin/sprogs5
-rwxr-xr-x.local/bin/startsession6
-rwxr-xr-x.local/bin/storeless46
-rwxr-xr-x.local/bin/torrent33
-rwxr-xr-x.local/bin/tvimb2
-rwxr-xr-x.local/bin/updates15
-rwxr-xr-x.local/bin/volume28
-rwxr-xr-x.local/bin/weather35
-rwxr-xr-x.local/bin/xstart_dwm12
39 files changed, 699 insertions, 0 deletions
diff --git a/.local/bin/brainmassage b/.local/bin/brainmassage
new file mode 100755
index 0000000..57796f3
--- /dev/null
+++ b/.local/bin/brainmassage
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+parse_query() {
+ sed "s/ /+/g"
+}
+
+unquery() {
+ sed "s/+/ /g"
+}
+
+artist() {
+ artist_name=$(printf "" | dmenu -p "Search Artist" | parse_query)
+ json=$(wget -qO- "https://musicbrainz.org/ws/2/release-group/?fmt=json&artist=$(search_artist $artist_name)&type=album|ep" 2>/dev/null)
+ album_name=$(echo "$json" | jq '."release-groups"[] | .title' | sed 's/"//g' | dmenu -p "Select Album")
+ album_id=$(echo "$json" | jq ".\"release-groups\"[] | select(.title==\"$album_name\") .id" | sed "s/\"//g")
+ release_id=$(wget -qO- "https://musicbrainz.org/ws/2/release/?fmt=json&release-group=${album_id}" 2>/dev/null | jq '.releases[0] .id' | sed 's/"//g')
+
+ recording_names=$(wget -qO- "https://musicbrainz.org/ws/2/recording/?fmt=json&release=${release_id}" 2>/dev/null | jq '.recordings[] | .title' | sed 's/"//g')
+
+ recordings_query=$(echo "$recording_names" | parse_query)
+
+ mkdir "$album_name"
+ cd "$album_name"
+
+ echo "Download $album_name"
+
+ for name in $recordings_query; do
+ echo "Download $(echo ${name} | unquery)"
+ download "${artist_name}" "${album_name}" "${name}" &
+ done
+
+ wait
+}
+
+download() {
+ artist_name="$1"
+ album_name="$2"
+ name="$3"
+
+ query=$(echo "${artist_name} ${album_name} ${name}" | parse_query)
+ video_url=$(wget -qO- "https://www.youtube.com/results?search_query=${query}" 2>/dev/null | grep -E -o '"/watch\?v=[^"]*"' | sed -e 's/"//g' | sed -e "s/\/watch/https:\/\/www.youtube.com\/watch/g" | head -n1)
+ youtube-dl -q --extract-audio --audio-format mp3 "${video_url}" -o "${name}.%(ext)s"
+ mp3info -a "$(echo "$artist_name" | unquery)" -l "$album_name" -t "$(echo $name | sed 's/+/ /g')" "${name}.mp3"
+ mv "${name}.mp3" "$(echo $name | sed 's/+/ /g').mp3"
+}
+
+search_artist() {
+ json=$(wget -qO- "https://musicbrainz.org/ws/2/artist/?fmt=json&limit=100&query=$1" 2>/dev/null)
+
+ artist_name=$(echo "$json" | jq ".artists[] | .name" | sed "s/\"//g" | dmenu -p "Select Artist")
+ echo "$json" | jq ".artists[] | select(.name==\"$artist_name\") .id" | sed "s/\"//g"
+}
+
+artist
diff --git a/.local/bin/clock b/.local/bin/clock
new file mode 100755
index 0000000..a4eb334
--- /dev/null
+++ b/.local/bin/clock
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+case $BLOCK_BUTTON in
+ 1) notify-send "This Month" "$(cal --color=always | sed "s/..7m/<b><span color=\"red\">/;s/..27m/<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -d3)" ;;
+ 2) setsid -f "$TERMINAL" -e calcurse ;;
+ 3) notify-send "πŸ“… Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\`
+- Middle click opens calcurse if installed" ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+date "+%H:%M %d %b %Y"
diff --git a/.local/bin/cmus-refresh b/.local/bin/cmus-refresh
new file mode 100755
index 0000000..044561b
--- /dev/null
+++ b/.local/bin/cmus-refresh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+cmus-remote -C clear
+cmus-remote -C "add /mnt/data/Musik/Musik/"
+cmus-remote -C "update-cache -f"
diff --git a/.local/bin/cmus_edit_tags b/.local/bin/cmus_edit_tags
new file mode 100755
index 0000000..955997b
--- /dev/null
+++ b/.local/bin/cmus_edit_tags
@@ -0,0 +1,9 @@
+#!/bin/bash
+file="$(cmus-remote -C 'echo {}')"
+
+if [ -f "$file" ]
+then
+ st -e mp3info -i "$file" &
+else
+ echo "Oops, couldn't find selected track" >&2
+fi
diff --git a/.local/bin/disk b/.local/bin/disk
new file mode 100755
index 0000000..e947509
--- /dev/null
+++ b/.local/bin/disk
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+# Status bar module for disk space
+# $1 should be drive mountpoint, otherwise assumed /.
+
+location=${1:-/}
+
+[ -d "$location" ] || exit
+
+case $BLOCK_BUTTON in
+ 1) notify-send "πŸ’½ Disk space" "$(df -h --output=target,used,size)" ;;
+ 3) notify-send "πŸ’½ Disk module" "\- Shows used hard drive space.
+- Click to show all disk info." ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+case "$location" in
+ "/home"* ) icon="🏠" ;;
+ "/mnt"* ) icon="πŸ’Ύ" ;;
+ *) icon="πŸ–₯";;
+esac
+
+printf "%s: %s\n" "$icon" "$(df -h "$location" | awk ' /[0-9]/ {print $3 "/" $2}')"
diff --git a/.local/bin/dmount b/.local/bin/dmount
new file mode 100755
index 0000000..495410f
--- /dev/null
+++ b/.local/bin/dmount
@@ -0,0 +1,14 @@
+#/bin/sh
+
+disks=$(lsblk -o PATH,SIZE,TYPE,LABEL | grep "part" | grep -v "part $" | awk '{print $1 ":", $4, "[" $2 "]"}')
+
+chosen=$(echo $disks | dmenu -p "Mount disk:")
+
+[[ "$chosen" = "" ]] && exit 1
+
+mountpoint=$(echo $chosen | awk '{print "/mnt/" $2}' | dmenu -p "Mountpoint:")
+
+[[ "$mountpoint" = "" ]] && exit 1
+
+mkdir -p $mountpoint
+sudo mount $(echo $chosen | awk '{print $1}' | sed 's/://') $mountpoint
diff --git a/.local/bin/es b/.local/bin/es
new file mode 100755
index 0000000..e162559
--- /dev/null
+++ b/.local/bin/es
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+nvim $HOME/.local/bin/$(ls $HOME/.local/bin | fzf)
diff --git a/.local/bin/fzfimg b/.local/bin/fzfimg
new file mode 100755
index 0000000..b33ffb0
--- /dev/null
+++ b/.local/bin/fzfimg
@@ -0,0 +1,147 @@
+#!/usr/bin/env bash
+# This is just an example how ueberzug can be used with fzf.
+# Copyright (C) 2019 Nico BΓ€urer
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+readonly BASH_BINARY="$(which bash)"
+readonly REDRAW_COMMAND="toggle-preview+toggle-preview"
+readonly REDRAW_KEY="Β΅"
+declare -r -x DEFAULT_PREVIEW_POSITION="right"
+declare -r -x UEBERZUG_FIFO="$(mktemp --dry-run --suffix "fzf-$$-ueberzug")"
+declare -r -x PREVIEW_ID="preview"
+
+
+function is_option_key [[ "${@}" =~ ^(\-.*|\+.*) ]]
+function is_key_value [[ "${@}" == *=* ]]
+
+
+function map_options {
+ local -n options="${1}"
+ local -n options_map="${2}"
+
+ for ((i=0; i < ${#options[@]}; i++)); do
+ local key="${options[$i]}" next_key="${options[$((i + 1))]:---}"
+ local value=true
+ is_option_key "${key}" || \
+ continue
+ if is_key_value "${key}"; then
+ <<<"${key}" \
+ IFS='=' read key value
+ elif ! is_option_key "${next_key}"; then
+ value="${next_key}"
+ fi
+ options_map["${key}"]="${value}"
+ done
+}
+
+
+function parse_options {
+ declare -g -a script_options=("${@}")
+ declare -g -A mapped_options
+ map_options script_options mapped_options
+ declare -g -r -x PREVIEW_POSITION="${mapped_options[--preview-window]%%:[^:]*}"
+}
+
+
+function start_ueberzug {
+ mkfifo "${UEBERZUG_FIFO}"
+ <"${UEBERZUG_FIFO}" \
+ ueberzug layer --parser bash --silent &
+ # prevent EOF
+ 3>"${UEBERZUG_FIFO}" \
+ exec
+}
+
+
+function finalise {
+ 3>&- \
+ exec
+ &>/dev/null \
+ rm "${UEBERZUG_FIFO}"
+ &>/dev/null \
+ kill $(jobs -p)
+}
+
+
+function calculate_position {
+ # TODO costs: creating processes > reading files
+ # so.. maybe we should store the terminal size in a temporary file
+ # on receiving SIGWINCH
+ # (in this case we will also need to use perl or something else
+ # as bash won't execute traps if a command is running)
+ < <(</dev/tty stty size) \
+ read TERMINAL_LINES TERMINAL_COLUMNS
+
+ case "${PREVIEW_POSITION:-${DEFAULT_PREVIEW_POSITION}}" in
+ left|up|top)
+ X=1
+ Y=1
+ ;;
+ right)
+ X=$((TERMINAL_COLUMNS - COLUMNS - 2))
+ Y=1
+ ;;
+ down|bottom)
+ X=1
+ Y=$((TERMINAL_LINES - LINES - 1))
+ ;;
+ esac
+}
+
+
+function draw_preview {
+ calculate_position
+
+ >"${UEBERZUG_FIFO}" declare -A -p cmd=( \
+ [action]=add [identifier]="${PREVIEW_ID}" \
+ [x]="${X}" [y]="${Y}" \
+ [width]="${COLUMNS}" [height]="${LINES}" \
+ [scaler]=forced_cover [scaling_position_x]=0.5 [scaling_position_y]=0.5 \
+ [path]="${@}")
+ # add [synchronously_draw]=True if you want to see each change
+}
+
+
+function print_on_winch {
+ # print "$@" to stdin on receiving SIGWINCH
+ # use exec as we will only kill direct childs on exiting,
+ # also the additional bash process isn't needed
+ </dev/tty \
+ exec perl -e '
+ require "sys/ioctl.ph";
+ while (1) {
+ local $SIG{WINCH} = sub {
+ ioctl(STDIN, &TIOCSTI, $_) for split "", join " ", @ARGV;
+ };
+ sleep;
+ }' \
+ "${@}" &
+}
+
+
+if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
+ trap finalise EXIT
+ parse_options "${@}"
+ # print the redraw key twice as there's a run condition we can't circumvent
+ # (we can't know the time fzf finished redrawing it's layout)
+ print_on_winch "${REDRAW_KEY}${REDRAW_KEY}"
+ start_ueberzug
+
+ export -f draw_preview calculate_position
+ SHELL="${BASH_BINARY}" \
+ fzf --preview "draw_preview {}" \
+ --preview-window "${DEFAULT_PREVIEW_POSITION}" \
+ --bind "${REDRAW_KEY}:${REDRAW_COMMAND}" \
+ "${@}"
+fi
diff --git a/.local/bin/internet b/.local/bin/internet
new file mode 100755
index 0000000..603714c
--- /dev/null
+++ b/.local/bin/internet
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# Show wifi πŸ“Ά and percent strength or πŸ“‘ if none.
+# Show 🌐 if connected to ethernet or ❎ if none.
+
+case $BLOCK_BUTTON in
+ 1) "$TERMINAL" -e nmtui; pkill -RTMIN+4 dwmblocks ;;
+ 3) notify-send "🌍 Internet module" "\- Click to connect
+πŸ“‘: no wifi connection
+πŸ“Ά: wifi connection with quality
+❎: no ethernet
+🌍: ethernet working
+" ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+case "$(cat /sys/class/net/w*/operstate 2>/dev/null)" in
+ down) wifiicon="πŸ“‘ " ;;
+ up) wifiicon="$(awk '/^\s*w/ { print "πŸ“Ά", int($3 * 100 / 70) "% " }' /proc/net/wireless)" ;;
+esac
+
+printf "%s%s\n" "$wifiicon" "$(sed "s/down/❎/;s/up/⬌/" /sys/class/net/e*/operstate 2>/dev/null)"
diff --git a/.local/bin/kbselect b/.local/bin/kbselect
new file mode 100755
index 0000000..d7313c6
--- /dev/null
+++ b/.local/bin/kbselect
@@ -0,0 +1,16 @@
+#!/bin/sh
+# works on any init system
+# requirements: dmenu, xorg-setxkbmap, xkblayout-state (https://github.com/nonpop/xkblayout-state)
+kb="$(xkblayout-state print "%s")" || exit 1
+
+case $BLOCK_BUTTON in
+ 1) kb_choice="$(awk '/! layout/{flag=1; next} /! variant/{flag=0} flag {print $2, "- " $1}' /usr/share/X11/xkb/rules/base.lst | dmenu -l 15)"
+ kb="$(echo "$kb_choice" | awk '{print $3}')"
+ setxkbmap "$kb"
+ pkill -RTMIN+30 "${STATUSBAR:-dwmblocks}";;
+ 3) notify-send "⌨ Keyboard/language module" "$(xkblayout-state print "\- Current layout: %s (%n)")
+- Left click to change keyboard.";;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+echo "$kb"
diff --git a/.local/bin/libview b/.local/bin/libview
new file mode 100755
index 0000000..5f96d73
--- /dev/null
+++ b/.local/bin/libview
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+cd /usr/include
+
+file=$(find . -name "*.h" | sed -e 's/^.\///g' | fzf)
+
+#echo $file
+
+fname=$(grep -E '^extern .*;$' "/usr/include/$file" | awk '{ print $3 }' | fzf)
+
+page=$(whatis "$fname" | sed -E 's/([A-Za-z]*) \(([^)]*)\).*/\2 \1/g')
+
+selpage="$page"
+
+[ "$(echo "$page" | wc -l)" -ne 1 ] && selpage=$(echo "$page" | fzf)
+
+man $selpage
diff --git a/.local/bin/manuals b/.local/bin/manuals
new file mode 100755
index 0000000..8b57b2b
--- /dev/null
+++ b/.local/bin/manuals
@@ -0,0 +1,2 @@
+#!/bin/sh
+st man $(man -k - | dmenu | awk '{print $1}')
diff --git a/.local/bin/map b/.local/bin/map
new file mode 100755
index 0000000..1b19380
--- /dev/null
+++ b/.local/bin/map
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+keylayout=$(localectl list-x11-keymap-layouts | dmenu -p "Select keyboard layouts")
+keymodel=$(localectl list-x11-keymap-variants | dmenu -p "Select keyboard model")
+
+setxkbmap $keylayout $keymodel
+
+notify-send "Set Keyboardlayout" "Layout: $keylayout\nModel: $keymodel"
diff --git a/.local/bin/memory b/.local/bin/memory
new file mode 100755
index 0000000..01d3daf
--- /dev/null
+++ b/.local/bin/memory
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+case $BLOCK_BUTTON in
+ 1) notify-send "🧠 Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;;
+ 2) setsid -f "$TERMINAL" -e htop ;;
+ 3) notify-send "🧠 Memory module" "\- Shows Memory Used/Total.
+- Click to show memory hogs.
+- Middle click to open htop." ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+free --mebi | sed -n '2{p;q}' | awk '{printf ("🧠%2.2fGiB/%2.2fGiB\n", ( $3 / 1024), ($2 / 1024))}'
diff --git a/.local/bin/messages b/.local/bin/messages
new file mode 100755
index 0000000..a4d2427
--- /dev/null
+++ b/.local/bin/messages
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+$BROWSER https://messages.google.com/web
diff --git a/.local/bin/mkbackup b/.local/bin/mkbackup
new file mode 100755
index 0000000..e0d5e69
--- /dev/null
+++ b/.local/bin/mkbackup
@@ -0,0 +1 @@
+duplicity --progress $HOME --exclude $HOME/.cache file:///mnt/backups
diff --git a/.local/bin/ncureses-extended b/.local/bin/ncureses-extended
new file mode 100755
index 0000000..8ebac35
--- /dev/null
+++ b/.local/bin/ncureses-extended
Binary files differ
diff --git a/.local/bin/nettraf b/.local/bin/nettraf
new file mode 100755
index 0000000..71e6fe4
--- /dev/null
+++ b/.local/bin/nettraf
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# Module showing network traffic. Shows how much data has been received (RX) or
+# transmitted (TX) since the previous time this script ran. So if run every
+# second, gives network traffic per second.
+
+case $BLOCK_BUTTON in
+ 3) notify-send "🌐 Network traffic module" "πŸ”»: Traffic received
+πŸ”Ί: Traffic transmitted" ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+update() {
+ sum=0
+ for arg; do
+ read -r i < "$arg"
+ sum=$(( sum + i ))
+ done
+ cache=${XDG_CACHE_HOME:-$HOME/.cache}/${1##*/}
+ [ -f "$cache" ] && read -r old < "$cache" || old=0
+ printf %d\\n "$sum" > "$cache"
+ printf %d\\n $(( sum - old ))
+}
+
+rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes)
+tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes)
+
+printf "πŸ”»%4sB πŸ”Ί%4sB\\n" $(numfmt --to=iec $rx) $(numfmt --to=iec $tx)
diff --git a/.local/bin/news b/.local/bin/news
new file mode 100755
index 0000000..fe701db
--- /dev/null
+++ b/.local/bin/news
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# Displays number of unread news items and an loading icon if updating.
+# When clicked, brings up `newsboat`.
+
+case $BLOCK_BUTTON in
+ 1) setsid "$TERMINAL" -e newsboat ;;
+ 2) setsid -f newsup >/dev/null exit ;;
+ 3) notify-send "πŸ“° News module" "\- Shows unread news items
+- Shows πŸ”ƒ if updating with \`newsup\`
+- Left click opens newsboat
+- Middle click syncs RSS feeds
+<b>Note:</b> Only one instance of newsboat (including updates) may be running at a time." ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+ cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ if($1>0) print "πŸ“°" $1}')$(cat "${XDG_CONFIG_HOME:-$HOME/.config}"/newsboat/.update 2>/dev/null)"
diff --git a/.local/bin/outset b/.local/bin/outset
new file mode 100755
index 0000000..397cbd5
--- /dev/null
+++ b/.local/bin/outset
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+setsid swaymsg "output VGA-1 mode --custom 1600x900"
diff --git a/.local/bin/pacpackages b/.local/bin/pacpackages
new file mode 100755
index 0000000..8c86e6d
--- /dev/null
+++ b/.local/bin/pacpackages
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# Displays number of upgradeable packages.
+# For this to work, have a `pacman -Sy` command run in the background as a
+# cronjob every so often as root. This script will then read those packages.
+# When clicked, it will run an upgrade via pacman.
+#
+# Add the following text as a file in /usr/share/libalpm/hooks/statusbar.hook:
+#
+# [Trigger]
+# Operation = Upgrade
+# Type = Package
+# Target = *
+#
+# [Action]
+# Description = Updating statusbar...
+# When = PostTransaction
+# Exec = /usr/bin/pkill -RTMIN+8 dwmblocks # Or i3blocks if using i3.
+
+case $BLOCK_BUTTON in
+ 1) setsid -f "$TERMINAL" -e popupgrade ;;
+ 2) notify-send "$(/usr/bin/pacman -Qu)" ;;
+ 3) notify-send "🎁 Upgrade module" "πŸ“¦: number of upgradable packages
+- Left click to upgrade packages
+- Middle click to show upgradable packages" ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+n=$(pacman -Qu | grep -Fcv "[ignored]")
+
+[ "$n" = "0" ] && echo "βœ“";
diff --git a/.local/bin/playjazz b/.local/bin/playjazz
new file mode 100755
index 0000000..d4f327c
--- /dev/null
+++ b/.local/bin/playjazz
@@ -0,0 +1 @@
+wget -qO- "http://stream.srg-ssr.ch/m/rsj/mp3_128" | mpv -
diff --git a/.local/bin/podfetch b/.local/bin/podfetch
new file mode 100755
index 0000000..ce8cf6c
--- /dev/null
+++ b/.local/bin/podfetch
@@ -0,0 +1,21 @@
+#! /bin/sh
+
+feeds='Brainpain|https://w8gez1.podcaster.de/Brainpain.rss'
+
+feed=$(printf "$feeds" | column -t -s"|" | dmenu | awk '{print $NF}')
+
+echo "Fetching feed: $feed"
+
+download=$(wget -qO- $feed | grep "<title>\|<enclosure " | tail -n+2 | awk '{$1=$1};1' | tr '\n' ' ' | sed -e "s/\/> /\/>\n/g" | sed -e "s/<title>//g" | sed -e "s/<\/title>//g" | sed -e "s/ <enclosure type.*url=/Β΄/g" | sed -e "s/\/>$//g" | column -t -s"Β΄" | dmenu)
+
+link=$(echo $download | awk '{print $NF}' | sed -e "s/\"//g")
+name=$(echo $download | sed -e "s/ \".*\"//g")
+filename=$(echo $name | tr ' ' '_')$(echo $link | sed -e "s/.*\././g")
+
+echo "Link: $link"
+echo "Filename: $filename"
+
+notify-send "Downloading Podcast" "$name"
+
+wget -O "/mnt/data/Podcasts/$filename" "$link" && notify-send "Finished Downloading Podcast" "$name" || notify-send "Download Failed" "$name"
+
diff --git a/.local/bin/podplay b/.local/bin/podplay
new file mode 100755
index 0000000..3619286
--- /dev/null
+++ b/.local/bin/podplay
@@ -0,0 +1,2 @@
+#!/bin/sh
+mpv /mnt/data/Podcasts/$(ls /mnt/data/Podcasts | dmenu -p "Play: ")
diff --git a/.local/bin/popupgrade b/.local/bin/popupgrade
new file mode 100755
index 0000000..3a62727
--- /dev/null
+++ b/.local/bin/popupgrade
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+printf "Beginning upgrade.\\n"
+
+yay -Syu
+pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}"
+
+printf "\\nUpgrade complete.\\nPress <Enter> to exit window.\\n\\n"
+read -r
diff --git a/.local/bin/powerdialog b/.local/bin/powerdialog
new file mode 100755
index 0000000..642c45f
--- /dev/null
+++ b/.local/bin/powerdialog
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+options() {
+ selection=$(printf "Cancel\nSuspend\nPower Off\nLogout" | dmenu -p "Logout Dialog")
+
+ [ "$selection" = "Suspend" ] && systemctl suspend && exit
+ [ "$selection" = "Power Off" ] && poweroff && exit
+ [ "$selection" = "Logout" ] && loginctl terminate-session self && exit
+}
+
+case $BLOCK_BUTTON in
+ 1) options;;
+esac
+
+printf "%s\n" "⏻"
diff --git a/.local/bin/printcolors b/.local/bin/printcolors
new file mode 100755
index 0000000..07f8663
--- /dev/null
+++ b/.local/bin/printcolors
@@ -0,0 +1,4 @@
+#!/bin/bash
+for (( i = 0; i < 256; i++ ));
+ do printf "$(tput setaf $i)$i$(tput sgr0) ";
+done
diff --git a/.local/bin/screencast b/.local/bin/screencast
new file mode 100755
index 0000000..0d64e7e
--- /dev/null
+++ b/.local/bin/screencast
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+name=$(date "+recording_%H-%M-%S_%d_%m_%y.mp4")
+
+
+case "$(printf "Screen\nWindow\nRegion\nEnd Recording" | dmenu -p "Record")" in
+ Screen)ffcast -x "$(ffcast -x list | dmenu -p "Monitor" | gcol 2 | tr -d '#:')" rec "$name";;
+ Window)ffcast -w rec "$name";;
+ Region)ffcast -s rec "$name";;
+ End\ Recording)killall -s INT ffmpeg;;
+esac
diff --git a/.local/bin/search b/.local/bin/search
new file mode 100755
index 0000000..38d8f27
--- /dev/null
+++ b/.local/bin/search
@@ -0,0 +1,2 @@
+# /bin/zsh
+xdg-open $(find ~ -name $(printf "" | dmenu -p "Search Object: ") | dmenu -p "Open: ")
diff --git a/.local/bin/showimg b/.local/bin/showimg
new file mode 100755
index 0000000..38550a6
--- /dev/null
+++ b/.local/bin/showimg
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+[ -z $1 ] && printf "no image given:\n$(echo $0 | tr '/' ' ' | awk '{print $NF}') [Image]\n" && exit
+
+term_width=$(tput cols)
+term_width=$(($term_width*8))
+term_height=$(tput lines)
+term_height=$(($term_height*20))
+
+size=$(identify $1 | awk '{print $3}' | tr 'x' ' ')
+width=$(echo $size | awk '{print $1}')
+height=$(echo $size | awk '{print $2}')
+height=$(($height*$term_width/$width))
+
+if [ $term_height -gt $height ]
+then
+ $(printf "0;1;0;0;$term_width;$height;;;;;$1\n4;\n3;\n" | /usr/lib/w3m/w3mimgdisplay) &
+ read wt && exit
+fi
+
+width=$(echo $size | awk '{print $1}')
+height=$(echo $size | awk '{print $2}')
+width=$(($width*$term_height/$height))
+
+$(printf "1;0;0;0;$width;$term_height;;;;;$1\n4;\n3;\n" | /usr/lib/w3m/w3mimgdisplay) &
+read wt && exit
diff --git a/.local/bin/sprogs b/.local/bin/sprogs
new file mode 100755
index 0000000..6785691
--- /dev/null
+++ b/.local/bin/sprogs
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+kdeconnect-indicator &
+syncthing --no-browser &
+nextcloud &
diff --git a/.local/bin/startsession b/.local/bin/startsession
new file mode 100755
index 0000000..443aca5
--- /dev/null
+++ b/.local/bin/startsession
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+export XINITRC="$XDG_CONFIG_HOME/X11/xinitrc"
+
+# Start Session
+[ "$(fgconsole 2>/dev/null)" = "1" ] && exec startx ~/.config/X11/xinitrc -- vt1 &> /dev/null
diff --git a/.local/bin/storeless b/.local/bin/storeless
new file mode 100755
index 0000000..a7114d5
--- /dev/null
+++ b/.local/bin/storeless
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+store() {
+ selection=$(yay -Ss | sed -z 's/\n\s\+/ - /g' | sed -E 's/^[^\/]*\///g' | sed -e 's/([0-9.]* .iB /(/g' | sed -e 's/\[base-devel\]//g' | sed -e 's/ \+/ /g' | dmenu)
+
+ name=$(echo $selection | awk '{ print $1 }')
+
+ if [ -z "$name" ]; then
+ exit
+ fi
+
+ if [ -z "$(yay -Qs $name)" ]; then
+ selection=$(printf 'Install\nInfo\nBack' | dmenu -p "Package: $name ")
+ else
+ selection=$(printf 'Remove\nInfo\nBack' | dmenu -p "Package: $name ")
+ fi
+
+ echo $name
+
+ case "$selection" in
+ Install)window "yay -S $name" && notify-send "Storeless" "$name Successfully Installed";;
+ Remove)window "yay -Rns $name" && notify-send "Storeless" "$name Successfully Removed ";;
+ Info)notify-send -t 0 "$name" "$(yay -Si $name)";;
+ Back)store;;
+ esac
+}
+
+primaryscreenwidth() {
+ xrandr | grep primary | awk '{ print $4 }' | grep -o '^[0-9]*'
+}
+
+window() {
+ st -g 108x24+10+40 -c floating $1
+}
+
+update() {
+ window yay
+ notify-send "Storeless" "System Up To Date"
+}
+
+case "$(printf "Store\nUpdate" | dmenu)" in
+ Store)store;;
+ Update)update;;
+esac
+
+
diff --git a/.local/bin/torrent b/.local/bin/torrent
new file mode 100755
index 0000000..9e1da3a
--- /dev/null
+++ b/.local/bin/torrent
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+transmission-remote -l | grep % |
+ sed " # This first sed command is to ensure a desirable order with sort
+ s/.*Stopped.*/A/g;
+ s/.*Seeding.*/Z/g;
+ s/.*100%.*/N/g;
+ s/.*Idle.*/B/g;
+ s/.*Uploading.*/L/g;
+ s/.*%.*/M/g" |
+ sort -h | uniq -c | sed " # Now we replace the standin letters with icons.
+ s/A/πŸ›‘/g;
+ s/B/πŸ•°/g;
+ s/L/πŸ”Ό/g;
+ s/M/πŸ”½/g;
+ s/N/βœ…/g;
+ s/Z/🌱/g" | awk '{print $2 $1}' | paste -sd ' '
+
+case $BLOCK_BUTTON in
+ 1) setsid -f "$TERMINAL" -e tremc ;;
+ 2) td-toggle ;;
+ 3) notify-send "🌱 Torrent module" "\- Left click to open tremc.
+- Middle click to toggle transmission.
+- Shift click to edit script.
+Module shows number of torrents:
+πŸ›‘: paused
+πŸ•°: idle (seeds needed)
+πŸ”Ό: uploading (unfinished)
+πŸ”½: downloading
+βœ…: done
+🌱: done and seeding" ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
diff --git a/.local/bin/tvimb b/.local/bin/tvimb
new file mode 100755
index 0000000..7aa76b7
--- /dev/null
+++ b/.local/bin/tvimb
@@ -0,0 +1,2 @@
+#!/bin/sh
+GDK_BACKEND=x11 tabbed -c vimb -e
diff --git a/.local/bin/updates b/.local/bin/updates
new file mode 100755
index 0000000..b3acb48
--- /dev/null
+++ b/.local/bin/updates
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+case $BLOCK_BUTTON in
+ 1) setsid storeless;;
+ 3) notify-send "πŸ“¦ Upates" "$(yay -Qu)";;
+esac
+
+packages=$(yay -Sy >/dev/null && yay -Qu)
+
+if [ -n "$packages" ]
+then
+ echo $(echo "$packages" | wc -l) ⏬
+else
+ echo πŸ”
+fi
diff --git a/.local/bin/volume b/.local/bin/volume
new file mode 100755
index 0000000..3fac23e
--- /dev/null
+++ b/.local/bin/volume
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# Prints the current volume or πŸ”‡ if muted.
+
+case $BLOCK_BUTTON in
+ 1) setsid -f "$TERMINAL" -e pulsemixer ;;
+ 2) pamixer -t ; pkill -RTMIN+10 dwmblocks;;
+ 4) pamixer --allow-boost -i 1 ;;
+ 5) pamixer --allow-boost -d 1 ;;
+ 3) notify-send "πŸ“’ Volume module" "\- Shows volume πŸ”Š, πŸ”‡ if muted.
+- Middle click to mute.
+- Scroll to change." ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+[ $(pamixer --get-mute) = true ] && echo πŸ”‡ && exit
+
+vol="$(pamixer --sink 0 --get-volume)"
+
+if [ "$vol" -gt "70" ]; then
+ icon="πŸ”Š"
+elif [ "$vol" -lt "30" ]; then
+ icon="πŸ”ˆ"
+else
+ icon="πŸ”‰"
+fi
+
+echo "$vol% $icon"
diff --git a/.local/bin/weather b/.local/bin/weather
new file mode 100755
index 0000000..e04bac0
--- /dev/null
+++ b/.local/bin/weather
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# Displays todays precipication chance (β˜”) and daily low (πŸ₯Ά) and high (🌞).
+# Usually intended for the statusbar.
+
+# If we have internet, get a weather report from wttr.in and store it locally.
+# You could set up a shell alias to view the full file in a pager in the
+# terminal if desired. This function will only be run once a day when needed.
+weatherreport="${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport"
+getforecast() { curl -sf "wttr.in/$LOCATION" > "$weatherreport" || exit 1 ;}
+
+# Some very particular and terse stream manipulation. We get the maximum
+# precipication chance and the daily high and low from the downloaded file and
+# display them with coresponding emojis.
+showweather() { printf "%s" "$(sed '16q;d' "$weatherreport" |
+ grep -wo "[0-9]*%" | sort -rn | sed "s/^/β˜”/g;1q" | tr -d '\n')"
+sed '13q;d' "$weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " πŸ₯Ά" $1 "Β°","🌞" $2 "Β°"}' ;}
+
+case $BLOCK_BUTTON in
+ 1) setsid -f "$TERMINAL" -e less -Srf "$weatherreport" ;;
+ 2) getforecast && showweather ;;
+ 3) notify-send "🌈 Weather module" "\- Left click for full forecast.
+- Middle click to update forecast.
+β˜”: Chance of rain/snow
+πŸ₯Ά: Daily low
+🌞: Daily high" ;;
+ 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+esac
+
+# The test if our forcecast is updated to the day. If it isn't download a new
+# weather report from wttr.in with the above function.
+[ "$(stat -c %y "$weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
+ getforecast
+
+showweather
diff --git a/.local/bin/xstart_dwm b/.local/bin/xstart_dwm
new file mode 100755
index 0000000..bf1ec4a
--- /dev/null
+++ b/.local/bin/xstart_dwm
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+while true; do
+ # Log stderror to a file
+ dunst &
+ st cmus &
+ dwmblocks 2>&1 > /dev/null &
+ dwm 2> ~/.cache/dwm.log
+ killall dwmblocks
+ # No error logging
+ #dwm >/dev/null 2>&1
+done