i3blocks scripts added

This commit is contained in:
Luke Smith 2018-04-22 17:39:23 -07:00
parent 84557167e6
commit cec92894fc
8 changed files with 51 additions and 4 deletions

View file

@ -1,7 +1,5 @@
#!/bin/sh #!/bin/sh
# Should be run with sudo.
# Gives a dmenu prompt to mount unmounted drives. # Gives a dmenu prompt to mount unmounted drives.
# If they're in /etc/fstab, they'll be mounted automatically. # If they're in /etc/fstab, they'll be mounted automatically.
# Otherwise, you'll be prompted to give a mountpoint from already existsing directories. # 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=$(echo -e "No\nYes" | dmenu -i -p "$mountpoint does not exist. Create it?")
[[ "$mkdiryn" = Yes ]] && sudo mkdir -p "$mountpoint" [[ "$mkdiryn" = Yes ]] && sudo mkdir -p "$mountpoint"
fi fi
sudo mount "$chosen" "$mountpoint" sudo mount $chosen $mountpoint && pgrep -x dunst && notify-send "$chosen mounted to $mountpoint."

View file

@ -11,4 +11,4 @@ drives=$(lsblk -lp | grep "t /" | grep -v "$exclusionregex" | awk '{print $1, "(
[[ "$drives" = "" ]] && exit [[ "$drives" = "" ]] && exit
chosen=$(echo "$drives" | dmenu -i -p "Unmount which drive?" | awk '{print $1}') chosen=$(echo "$drives" | dmenu -i -p "Unmount which drive?" | awk '{print $1}')
[[ "$chosen" = "" ]] && exit [[ "$chosen" = "" ]] && exit
sudo umount $chosen sudo umount $chosen && pgrep -x dunst && notify-send "$chosen unmounted."

2
.scripts/i3battery Executable file
View file

@ -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"

5
.scripts/i3mail Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
case $BLOCK_BUTTON in
1) $TERMINAL -e neomutt ;;
esac
echo $(find ~/.mail -wholename */INBOX/new/* | wc -l)

18
.scripts/i3mpd Executable file
View file

@ -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

12
.scripts/i3volume Executable file
View file

@ -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

12
.scripts/i3weather Executable file
View file

@ -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 "°"}'

BIN
.scripts/larbs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB