aboutsummaryrefslogtreecommitdiff
path: root/i3blocks
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2018-12-16 19:24:40 +0100
committerInigoGutierrez <inigogf.95@gmail.com>2018-12-16 19:24:40 +0100
commit590e1b8feeab5949cc94dbfb7237676186fc0527 (patch)
treeea544eddf85dc10a0b6a57ef4713561c48c2e7b5 /i3blocks
parentb022a45f840b0b8d12e7e6cddd0b49fd0317afa7 (diff)
downloadscripts-590e1b8feeab5949cc94dbfb7237676186fc0527.tar.gz
scripts-590e1b8feeab5949cc94dbfb7237676186fc0527.zip
Several changes.
Diffstat (limited to 'i3blocks')
-rwxr-xr-xi3blocks/i3battery.sh33
-rwxr-xr-xi3blocks/i3internet.sh22
-rwxr-xr-xi3blocks/i3music.sh16
-rwxr-xr-xi3blocks/i3vol.sh6
4 files changed, 46 insertions, 31 deletions
diff --git a/i3blocks/i3battery.sh b/i3blocks/i3battery.sh
index 34c461a..0db8daf 100755
--- a/i3blocks/i3battery.sh
+++ b/i3blocks/i3battery.sh
@@ -2,7 +2,7 @@
# Give a battery name (e.g. BAT1) as an argument.
case $BLOCK_BUTTON in
- 3) pgrep -x dunst >/dev/null && notify-send "<b>🔋 Battery module:</b>
+ 3) pgrep -x dunst >/dev/null && notify-send -t 5000 "<b>🔋 Battery module:</b>
🔋: discharging
♻: stagnant charge
🔌: charging
@@ -14,24 +14,25 @@ esac
capacity=$(cat /sys/class/power_supply/"$1"/capacity) || exit
status=$(cat /sys/class/power_supply/"$1"/status)
-#if [ "$capacity" -ge 80 ]; then
-# color="#b8bb26"
-#elif [ "$capacity" -ge 60 ]; then
-# color="#ebdbb2"
-#elif [ "$capacity" -ge 40 ]; then
-# color="#fabd2f"
-#elif [ "$capacity" -ge 20 ]; then
-# color="#fe8019"
-#else
-# color="#fb4934"
-# warn="❗"
-#fi
+if [ "$capacity" -ge 80 ]; then
+ color="#b8bb26"
+elif [ "$capacity" -ge 60 ]; then
+ color="#ebdbb2"
+elif [ "$capacity" -ge 40 ]; then
+ color="#fabd2f"
+elif [ "$capacity" -ge 20 ]; then
+ color="#fe8019"
+else
+ color="#fb4934"
+ warn="❗"
+fi
-[ ! "$capacity" -gt 15 ] && warn="❗"
+#[ ! "$capacity" -gt 15 ] && warn="❗"
[ -z $warn ] && warn=""
-#[ "$status" = "Charging" ] && color="#FFF"
+[ "$status" = "Charging" ] && color="#1fffaf"
-printf "%s%s%s%s" "$(echo "$status" | sed -e "s/,//g;s/Discharging/🔋/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/')" "$warn"
+#printf "%s%s%s%s" "$(echo "$status" | sed -e "s/,//g;s/Discharging/🔋/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/')" "$warn"
+printf "<span color='%s'>%s%s%s</span>" "$color" "$(echo "$status" | sed -e "s/,//g;s/Discharging/🔋/;s/Charging/🔌/;s/Unknown/♻️/;s/Full/⚡/;s/ 0*/ /g;s/ :/ /g")" "$warn" "$(echo "$capacity" | sed -e 's/$/%/')"
echo ""
diff --git a/i3blocks/i3internet.sh b/i3blocks/i3internet.sh
index 536b242..049a479 100755
--- a/i3blocks/i3internet.sh
+++ b/i3blocks/i3internet.sh
@@ -1,15 +1,15 @@
#!/bin/sh
-#case $BLOCK_BUTTON in
-# 1) $TERMINAL -e nmtui ;;
-# 3) pgrep -x dunst >/dev/null && notify-send "<b>🌐 Internet module:</b>
-#- Click for \`nmtui\` for wifi access
-#📡: no wifi connection
-#📶: wifi connection with quality
-#❎: no ethernet
-#🌐: ethernet working
-#" ;;
-#esac
+case $BLOCK_BUTTON in
+ 1) i3-msg "exec urxvt -e nmtui" >/dev/null ;;
+ 3) pgrep -x dunst >/dev/null && notify-send "<b>🌐 Internet module:</b>
+- Click for 'nmtui' for wifi access
+📡: no wifi connection
+📶: wifi connection with quality
+❎: no ethernet
+🌐: ethernet working
+" ;;
+esac
#
#[ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && wifiicon="📡"
#
@@ -23,4 +23,4 @@ wifi="$(nmcli | grep "wlp2s0: conectado to " | cut -d' ' -f4-) ($(ip addr show w
en=$(ip addr show enp3s0 | grep "inet " | cut -d' ' -f6)
[ $wstatus = "down" ] && wifi="down"
[ $estatus = "down" ] && en="down"
-echo "W: 📶 $wifi - E: 🌐 $en"
+echo "📶 $wifi | 🌐 $en"
diff --git a/i3blocks/i3music.sh b/i3blocks/i3music.sh
index 6cb9f10..3aa764e 100755
--- a/i3blocks/i3music.sh
+++ b/i3blocks/i3music.sh
@@ -1,12 +1,20 @@
#!/bin/bash
+case $BLOCK_BUTTON in
+ 1) cmus-remote -r ;;
+ 2) cmus-remote -u ;;
+ 3) cmus-remote -n ;;
+esac
+
status=$(cmus-remote -Q | grep status | awk '{print $2}')
+artist=$(cmus-remote -Q | grep "tag artist " | cut -d' ' -f3-)
+title=$(cmus-remote -Q | grep "tag title " | cut -d' ' -f3-)
+[ -z $artist ] && artist="(unknown)"
+[ -z $title ] && title=$(cmus-remote -Q | grep "file " | cut -d'/' -f5-)
if [ $status = "playing" ]; then
- artist=$(cmus-remote -Q | grep "tag artist " | cut -d' ' -f3-)
- title=$(cmus-remote -Q | grep "tag title " | cut -d' ' -f3-)
- [ -z $artist ] && artist="(unknown)"
- [ -z $title ] && title=$(cmus-remote -Q | grep "file " | cut -d'/' -f5-)
echo "$artist ─ $title"
+elif [ $status = "paused" ]; then
+ echo "( $artist ─ $title )"
else
echo "$status"
fi
diff --git a/i3blocks/i3vol.sh b/i3blocks/i3vol.sh
index 5f91bde..f702656 100755
--- a/i3blocks/i3vol.sh
+++ b/i3blocks/i3vol.sh
@@ -1,4 +1,10 @@
#!/bin/bash
+
+case $BLOCK_BUTTON in
+ 1) i3-msg "exec urxvt -e alsamixer" >/dev/null ;;
+ 3) pgrep -x dunst >/dev/null && notify-send -t 2000 "Click for alsamixer" ;;
+esac
+
vol=$(pactl list sinks | grep Volumen: | awk '{print $5}')
mute=$(pactl list sinks | grep Silencio: | cut -d' ' -f2)
if [ $mute = "no" ]; then