From 0d68560bb9d22abb61aee44ecf1ce6d973b80546 Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Fri, 17 Jan 2020 11:31:19 +0000 Subject: [PATCH] Small changes --- bin/.bin/radio | 4 ++++ bin/.bin/todo | 60 +++++++++++++++++++++++++++++++++++++++++++++++++ bin/.bin/volume | 5 ++++- 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100755 bin/.bin/todo diff --git a/bin/.bin/radio b/bin/.bin/radio index daa68eef..07bd0d92 100755 --- a/bin/.bin/radio +++ b/bin/.bin/radio @@ -4,6 +4,10 @@ # Currently uses mpv to play the them # On first run it will download a list of radio stations # To update them run radio -u +# REQUIRES: +# * fzf +# * mpv +# * hq # Change this if you want the radio stations to be saved somewhere else LIST="$HOME/.local/share/radioStations" diff --git a/bin/.bin/todo b/bin/.bin/todo new file mode 100755 index 00000000..5e028b24 --- /dev/null +++ b/bin/.bin/todo @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +# Simple todo list + +FILE="$HOME/.todo" + +function is_int() { + return $(test "$@" -eq "$@" > /dev/null 2>&1); +} + +function list(){ + if [ -f "$FILE" ]; then + awk '{printf("%5d : %s\n", NR,$0)}' "$FILE" + else + echo "$FILE does not exist" + exit 1 + fi +} + +function add(){ + echo "$@" >> "$FILE" +} + +function delete(){ + while [ -n "$1" ]; do + if is_int "$1"; then + sed -i "${1}d" "$FILE" + fi + shift + done + exit +} + +if [ -n "$1" ]; then + while [ -n "$1" ]; do + case "$1" in + "list"|"l") + shift + list "$@" + exit 0 + ;; + "add"|"a") + shift + add "$@" + exit 0 + ;; + "delete"|"del"|"d") + shift + delete "$@" + exit 0 + ;; + *) + echo "Command $1 unknown" + exit 1 + esac + done +else + list +fi +exit diff --git a/bin/.bin/volume b/bin/.bin/volume index 402f3766..67146554 100755 --- a/bin/.bin/volume +++ b/bin/.bin/volume @@ -9,6 +9,9 @@ case "$1" in ;; "down") amixer -q -D default sset Master 5%- unmute + ;; + "toggle") + amixer -q -D default sset Master toggle esac -command -v notify-send && notify-send "Volume" "$(amixer -D default sget Master | grep -o '\[.*\%' | tr -d '[')" +command -v notify-send && notify-send "Volume" "$(amixer -D default sget Master | grep -o '\[.*\%' | head -n 1 | tr -d '[')"