scripts sorted
This commit is contained in:
22
.scripts/statusbar/i3battery
Executable file
22
.scripts/statusbar/i3battery
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Give a battery name (e.g. BAT0) as an argument.
|
||||
|
||||
capacity=$(cat /sys/class/power_supply/"$1"/capacity) || exit
|
||||
status=$(cat /sys/class/power_supply/"$1"/status)
|
||||
|
||||
if [ "$capacity" -ge 80 ]; then
|
||||
color="#00FF00"
|
||||
elif [ "$capacity" -ge 60 ]; then
|
||||
color="#FFFFFF"
|
||||
elif [ "$capacity" -ge 40 ]; then
|
||||
color="#FFF600"
|
||||
elif [ "$capacity" -ge 20 ]; then
|
||||
color="#FFAE00"
|
||||
else
|
||||
color="#FF0000"
|
||||
fi
|
||||
|
||||
[ "$status" = "Charging" ] && color="#FFF"
|
||||
|
||||
printf "<span color='%s'>%s %s</span>" "$color" "$(echo "$status" | sed -e "s/,//g;s/Discharging/🔋/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g")" "$(echo "$capacity" | sed -e 's/$/%/')"
|
||||
11
.scripts/statusbar/i3mail
Executable file
11
.scripts/statusbar/i3mail
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
# i3blocks mail module.
|
||||
# Displays number of unread mail and an loading icon if updating.
|
||||
# When clicked, brings up `neomutt`.
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) $TERMINAL -e neomutt ;;
|
||||
esac
|
||||
|
||||
echo "$(du -a ~/.mail/*/INBOX/new/* | sed -n '$=')" $(cat ~/.config/mutt/.dl)
|
||||
13
.scripts/statusbar/i3mpd
Executable file
13
.scripts/statusbar/i3mpd
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
filter() {
|
||||
sed "/^volume:/d" | tac | sed -e "s/\\&/&/g;s/\\[paused\\].*/<span color=\"gray\" font_style=\"italic\">/g;s/\\[playing\\].*/<span>/g" | tr -d '\n' | sed -e "s/$/<\\/span>/g"
|
||||
}
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) mpc status | filter && $TERMINAL -e ncmpcpp & disown ;; # right click, pause/unpause
|
||||
3) mpc toggle | filter ;; # right click, pause/unpause
|
||||
4) mpc prev | filter ;; # scroll up, previous
|
||||
5) mpc next | filter ;; # scroll down, next
|
||||
*) mpc status | filter ;;
|
||||
esac
|
||||
9
.scripts/statusbar/i3mpdupdate
Executable file
9
.scripts/statusbar/i3mpdupdate
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$(pgrep -x i3mpdupdate | wc -l)" -gt 2 ] && exit
|
||||
|
||||
while : ; do
|
||||
pgrep -x mpd || exit
|
||||
mpc idle > /dev/null
|
||||
pkill -RTMIN+11 i3blocks ;
|
||||
done
|
||||
13
.scripts/statusbar/i3pacman
Executable file
13
.scripts/statusbar/i3pacman
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
# i3blocks module for pacman upgrades.
|
||||
# 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 `yay`. (`yay` required, duh.)
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) $TERMINAL -e "popupgrade" ;;
|
||||
esac
|
||||
|
||||
yay -Qu | sed -e '/^Get/d' | wc -l | sed -e "s/^0$//g"
|
||||
6
.scripts/statusbar/i3torrent
Executable file
6
.scripts/statusbar/i3torrent
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
case $BLOCK_BUTTON in
|
||||
1) $TERMINAL -e transmission-remote-cli
|
||||
esac
|
||||
|
||||
transmission-remote -l | grep % | sed -e "s/.*100%.*/Z/g;s/.*Idle.*/A/g;s/.*%.*/M/g" | sort -h | uniq -c | sed -e "s/Z/🌱/g;s/M/⬇️/g;s/A/⌛️/g" | awk '{print $2, $1}' | tr '\n' ' ' | sed -e "s/ $//g"
|
||||
22
.scripts/statusbar/i3volume
Executable file
22
.scripts/statusbar/i3volume
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) setsid "$TERMINAL" -e pulsemixer & ;;
|
||||
3) pulsemixer --toggle-mute ;;
|
||||
4) pulsemixer --change-volume +5 ;;
|
||||
5) pulsemixer --change-volume -5 ;;
|
||||
esac
|
||||
|
||||
[ "$(pulsemixer --get-mute)" = "1" ] && printf "🔇\\n" && exit
|
||||
|
||||
vol=$(pulsemixer --get-volume | awk '{print $1}')
|
||||
|
||||
if [ "$vol" -gt "70" ]; then
|
||||
icon="🔊"
|
||||
elif [ "$vol" -lt "30" ]; then
|
||||
icon="🔈"
|
||||
else
|
||||
icon="🔉"
|
||||
fi
|
||||
|
||||
printf "%s %s%%\\n" "$icon" "$vol"
|
||||
15
.scripts/statusbar/i3weather
Executable file
15
.scripts/statusbar/i3weather
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
### This is only if your location isn't automatically detected, otherwise you can leave it blank.
|
||||
location=""
|
||||
|
||||
[ "$location" != "" ] && location="$location+"
|
||||
|
||||
[ "$BLOCK_BUTTON" = "1" ] && $TERMINAL -e popweather
|
||||
|
||||
ping -q -w 1 -c 1 "$(ip r | grep default | tail -1 | cut -d ' ' -f 3)" >/dev/null || exit
|
||||
|
||||
curl -s wttr.in/$location > ~/.weatherreport
|
||||
|
||||
printf "%s" "$(sed '16q;d' ~/.weatherreport | grep -wo "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/☔ /g" | 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 "°"}'
|
||||
9
.scripts/statusbar/i3wifi
Executable file
9
.scripts/statusbar/i3wifi
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) $TERMINAL -e nmtui ;;
|
||||
esac
|
||||
|
||||
[ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && echo 📡 && exit
|
||||
|
||||
grep ^w /proc/net/wireless | awk '{ print "📶", int($3 * 100 / 70) "%" }'
|
||||
10
.scripts/statusbar/popupgrade
Executable file
10
.scripts/statusbar/popupgrade
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
printf "Beginning upgrade.\\n"
|
||||
|
||||
yay -Syu
|
||||
pacman -Qu | wc -l > ~/.pacupgrnum
|
||||
pkill -RTMIN+8 i3blocks
|
||||
|
||||
printf "\\nUpgrade complete.\\nPress <Enter> to exit window.\\n\\n"
|
||||
read -r
|
||||
2
.scripts/statusbar/popweather
Executable file
2
.scripts/statusbar/popweather
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
cat ~/.weatherreport && read
|
||||
Reference in New Issue
Block a user