Created
July 18, 2015 16:50
-
-
Save mkf/1e7d7369fb65606b91ad to your computer and use it in GitHub Desktop.
My .i3blocks.conf and /usr/libexec/i3blocks/network
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ArchieT's i3blocks config file | |
# state as of 2015-07-18 | |
# | |
# Please see man i3blocks for a complete reference! | |
# The man page is also hosted at http://vivien.github.io/i3blocks | |
# | |
# List of valid properties: | |
# | |
# align | |
# color | |
# command | |
# full_text | |
# instance | |
# interval | |
# label | |
# min_width | |
# name | |
# separator | |
# separator_block_width | |
# short_text | |
# signal | |
# urgent | |
# Global properties | |
separator_block_width=15 | |
[volume] | |
label=VOL | |
#label=♪ | |
instance=Master | |
#instance=PCM | |
command=/usr/libexec/i3blocks/volume | |
interval=once | |
signal=10 | |
[memory] | |
label=MEM | |
command=/usr/libexec/i3blocks/memory | |
separator=false | |
interval=2 | |
[swap] | |
label=SWAP | |
instance=swap | |
command=/usr/libexec/i3blocks/memory | |
interval=2 | |
[disk-home] | |
instance=$HOME | |
command=/usr/libexec/i3blocks/disk | |
interval=30 | |
[wireless] | |
label=W | |
instance=wlan0 | |
#instance=wlp2s0 | |
command=/usr/libexec/i3blocks/network | |
color=#00FF00 | |
interval=4 | |
[ethernet] | |
label=E | |
instance=eth0 | |
#instance=enp4s1 | |
command=/usr/libexec/i3blocks/network | |
color=#00FF00 | |
interval=4 | |
[ethernet] | |
label=U | |
instance=usb0 | |
command=/usr/libexec/i3blocks/network | |
color=#00FF00 | |
interval=4 | |
[cpu] | |
label=CPU | |
command=/usr/libexec/i3blocks/cpu_usage | |
interval=1 | |
min_width=CPU: 100.00% | |
#separator=false | |
[temp] | |
label=T | |
command=sensors acerhdf-virtual-0 | awk '/temp1/ { print $2 }' | |
interval=1 | |
[load] | |
command=/usr/libexec/i3blocks/load_average | |
interval=5 | |
[battery] | |
#label=BAT | |
label=⚡ | |
command=/usr/libexec/i3blocks/battery | |
interval=3 | |
[time] | |
command=date '+%Y-%m-%d %H:%M:%S' | |
interval=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info> | |
# modified 2015 by ArchieT <feiler.michal@mensa.org.pl> | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
# You should have received a copy of the GNU General Public License | |
# along with this program. If not, see <http://www.gnu.org/licenses/>. | |
INTERFACE="${BLOCK_INSTANCE:-eth0}" | |
state="$(cat /sys/class/net/$INTERFACE/operstate)" | |
if [ "$state" == "down" ]; then | |
echo "down" | |
echo "down" | |
echo "#FF0000" | |
exit 0 | |
fi | |
speed="$(cat /sys/class/net/$INTERFACE/speed 2> /dev/null)" | |
ipaddr="$(ip addr show $INTERFACE | perl -n -e'/inet (.+)\// && print $1')" | |
ipaddr="${ipaddr:-0.0.0.0}" | |
# full text | |
echo -n "$ipaddr" | |
[ -n "$speed" ] && echo " ($speed Mbits/s)" || echo | |
# short text | |
echo "$ipaddr" | |
if [ "$ipaddr" == "0.0.0.0" ]; then | |
if [ "$state" == "up" ]; then | |
echo "#0069FF" | |
exit 0 | |
fi | |
echo "#555555" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment