aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Odersky <jakob@odersky.com>2018-06-11 00:25:49 -0700
committerJakob Odersky <jakob@odersky.com>2018-06-11 00:25:49 -0700
commit5a672f6fbaebdff114ab59b9f0ef3e8c42bf4c37 (patch)
tree13ec3b781e4e834c92f223c329c670f0bd25b9e5
parente4f115e1a42991a5f3f2aebc28889c57f94ba5db (diff)
downloaddotfiles-5a672f6fbaebdff114ab59b9f0ef3e8c42bf4c37.tar.gz
dotfiles-5a672f6fbaebdff114ab59b9f0ef3e8c42bf4c37.tar.bz2
dotfiles-5a672f6fbaebdff114ab59b9f0ef3e8c42bf4c37.zip
Include wifi and bluetooth config in status bar
-rw-r--r--home/.config/i3/config2
-rw-r--r--home/.config/i3/i3blocks.conf11
-rwxr-xr-xhome/.config/i3/status/bluetooth9
-rwxr-xr-xhome/.config/i3/status/wireless17
4 files changed, 37 insertions, 2 deletions
diff --git a/home/.config/i3/config b/home/.config/i3/config
index f47247c..b37ba7a 100644
--- a/home/.config/i3/config
+++ b/home/.config/i3/config
@@ -281,8 +281,6 @@ exec --no-startup-id gnome-shell
exec --no-startup-id xss-lock -- i3lock -n -i $background_image -e
# utility applications
-exec --no-startup-id nm-applet
-exec --no-startup-id blueman-applet
exec --no-startup-id redshift
# layout preferences
diff --git a/home/.config/i3/i3blocks.conf b/home/.config/i3/i3blocks.conf
index 37078e8..ca7e38e 100644
--- a/home/.config/i3/i3blocks.conf
+++ b/home/.config/i3/i3blocks.conf
@@ -93,6 +93,17 @@ separator=false
command=~/.config/i3/status/pwr
interval=30
+[wireless]
+command=~/.config/i3/status/wireless
+label=
+interval=30
+separator=false
+
+[bluetooth]
+command=~/.config/i3/status/bluetooth
+label=
+interval=30
+
[time]
#command=date '+%a, %e %B %H:%M'
command=date '+%a %Y-%m-%d %H:%M'
diff --git a/home/.config/i3/status/bluetooth b/home/.config/i3/status/bluetooth
new file mode 100755
index 0000000..3c2f9f1
--- /dev/null
+++ b/home/.config/i3/status/bluetooth
@@ -0,0 +1,9 @@
+#!/bin/bash
+if (/usr/sbin/rfkill list bluetooth --output SOFT,HARD --noheadings \
+ | grep -w blocked --quiet); then
+ echo "OFF"
+ echo "blocked"
+else
+ echo "ON"
+ echo "unblocked"
+fi
diff --git a/home/.config/i3/status/wireless b/home/.config/i3/status/wireless
new file mode 100755
index 0000000..b113ea4
--- /dev/null
+++ b/home/.config/i3/status/wireless
@@ -0,0 +1,17 @@
+#!/bin/bash
+set -o errexit
+
+interface="${BLOCK_INSTANCE:-wlp4s0}"
+
+[[ -d /sys/class/net/$interface/wireless ]] || exit 0
+
+if [[ $(cat "/sys/class/net/$interface/operstate") = "down" ]]; then
+ echo OFF
+ echo OFF
+else
+ quality="$(grep "$interface" /proc/net/wireless | \
+ awk '{ print int($3 * 100 / 70) }')"
+ echo "$quality%" # full text
+ echo "$quality%" # short text
+fi
+exit 0