dotfiles

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit cec92894fcf3382a2d1dd8450c63767941fed404
parent 84557167e6a3c678202d4edb6dc06d1c8dfde51f
Author: Luke Smith <luke@lukesmith.xyz>
Date:   Sun, 22 Apr 2018 17:39:23 -0700

i3blocks scripts added

Diffstat:
M.scripts/dmenumount | 4+---
M.scripts/dmenuumount | 2+-
A.scripts/i3battery | 2++
A.scripts/i3mail | 5+++++
A.scripts/i3mpd | 18++++++++++++++++++
A.scripts/i3volume | 12++++++++++++
A.scripts/i3weather | 12++++++++++++
A.scripts/larbs.png | 0
8 files changed, 51 insertions(+), 4 deletions(-)

diff --git a/.scripts/dmenumount b/.scripts/dmenumount @@ -1,7 +1,5 @@ #!/bin/sh -# Should be run with sudo. - # Gives a dmenu prompt to mount unmounted drives. # If they're in /etc/fstab, they'll be mounted automatically. # Otherwise, you'll be prompted to give a mountpoint from already existsing directories. @@ -24,4 +22,4 @@ if [[ ! -d "$mountpoint" ]]; then mkdiryn=$(echo -e "No\nYes" | dmenu -i -p "$mountpoint does not exist. Create it?") [[ "$mkdiryn" = Yes ]] && sudo mkdir -p "$mountpoint" fi -sudo mount "$chosen" "$mountpoint" +sudo mount $chosen $mountpoint && pgrep -x dunst && notify-send "$chosen mounted to $mountpoint." diff --git a/.scripts/dmenuumount b/.scripts/dmenuumount @@ -11,4 +11,4 @@ drives=$(lsblk -lp | grep "t /" | grep -v "$exclusionregex" | awk '{print $1, "( [[ "$drives" = "" ]] && exit chosen=$(echo "$drives" | dmenu -i -p "Unmount which drive?" | awk '{print $1}') [[ "$chosen" = "" ]] && exit -sudo umount $chosen +sudo umount $chosen && pgrep -x dunst && notify-send "$chosen unmounted." diff --git a/.scripts/i3battery b/.scripts/i3battery @@ -0,0 +1,2 @@ +#!/bin/sh +#acpi | cut -d " " -f3-5 | sed -e "s/,//g;s/Discharging/🔋/;s/Charging/🔌/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g" diff --git a/.scripts/i3mail b/.scripts/i3mail @@ -0,0 +1,5 @@ +#!/bin/sh +case $BLOCK_BUTTON in + 1) $TERMINAL -e neomutt ;; +esac +echo $(find ~/.mail -wholename */INBOX/new/* | wc -l) diff --git a/.scripts/i3mpd b/.scripts/i3mpd @@ -0,0 +1,18 @@ +#!/bin/bash + +# Pass the password in the block instance +if [[ -n $BLOCK_INSTANCE ]]; then + password=("-h" "$BLOCK_INSTANCE@localhost") +fi + +filter() { + tr '\n' ' ' | grep -Po '.*(?= \[playing\])|paused' | tr -d '\n' +} + +case $BLOCK_BUTTON in + 1) mpc $password status | filter && $TERMINAL -e ncmpcpp & disown ;; # right click, pause/unpause + 3) mpc $password toggle | filter ;; # right click, pause/unpause + 4) mpc $password prev | filter ;; # scroll up, previous + 5) mpc $password next | filter ;; # scroll down, next + *) mpc $password status | filter ;; +esac diff --git a/.scripts/i3volume b/.scripts/i3volume @@ -0,0 +1,12 @@ +#!/bin/bash + +case $BLOCK_BUTTON in + 1) $TERMINAL -e ncpamixer & disown ;; + 3) pamixer -t ;; + 4) pamixer -i 5 ;; + 5) pamixer -d 5 ;; +esac + +printpastatus() { [[ $(pamixer --get-mute) = "true" ]] && echo -n 🔇 && exit +echo 🔊 $(pamixer --get-volume)% ;} +printpastatus diff --git a/.scripts/i3weather b/.scripts/i3weather @@ -0,0 +1,12 @@ +#!/bin/bash + +[[ $BLOCK_BUTTON = "1" ]] && st -e w3m wttr.in + +ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` >/dev/null || exit + +curl wttr.in > ~/.weatherreport + +echo -n ☔ $(cat ~/.weatherreport | sed -n 16p | sed -e 's/[^m]*m//g' | grep -o "[0-9]*%" | sort -n | sed -e '$!d') + +cat ~/.weatherreport | sed -n 13p | sed -e 's/[^m]*m//g;s/[^0-9]/ /g;s/ /\n/g;/^s*$/d' | grep [0-9] | sort -n | sed -e 1b -e '$!d' | tr '\n' ' ' | awk '{print " ❄️",$1 "°","☀️",$2 "°"}' + diff --git a/.scripts/larbs.png b/.scripts/larbs.png Binary files differ.