From 727eb3208ceac2f80559f166f3b34e41d40c958e Mon Sep 17 00:00:00 2001 From: benj Date: Sat, 19 Jun 2021 16:40:00 -0700 Subject: i3config for laptop; likely going to need to split this up -- otherwise it's a headache --- des/i3/i3blocks/config | 14 ++++--- des/i3/i3blocks/scripts/bandwidth | 88 --------------------------------------- des/i3/i3blocks/scripts/genfan | 7 ++-- des/i3/lockscreen.sh | 8 ---- 4 files changed, 12 insertions(+), 105 deletions(-) delete mode 100755 des/i3/i3blocks/scripts/bandwidth delete mode 100755 des/i3/lockscreen.sh (limited to 'des/i3') diff --git a/des/i3/i3blocks/config b/des/i3/i3blocks/config index 3d61ba7..7ca8810 100644 --- a/des/i3/i3blocks/config +++ b/des/i3/i3blocks/config @@ -3,6 +3,15 @@ separator=false separator_block_width=15 markup=pango +[battery] +interval=1 +color=#a8afb0 + +[brightness] +interval=once +signal=9 +color=#ffff33 + [volume] instance=Master interval=once @@ -13,11 +22,6 @@ color=#4ca2df interval=1 color=#a8afb0 -[bandwidth] -instance=wlp114s0 -interval=1 -# color=#859900 - [memory] label= interval=1 diff --git a/des/i3/i3blocks/scripts/bandwidth b/des/i3/i3blocks/scripts/bandwidth deleted file mode 100755 index d7db2a6..0000000 --- a/des/i3/i3blocks/scripts/bandwidth +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/bash -# Copyright (C) 2012 Stefan Breunig -# Copyright (C) 2014 kaueraal -# Copyright (C) 2015 Thiago Perrotta - -# 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 . - -# Use the provided interface, otherwise the device used for the default route. -if [[ -n $BLOCK_INSTANCE ]]; then - INTERFACE=$BLOCK_INSTANCE -else - INTERFACE=$(ip route | awk '/^default/ { print $5 ; exit }') -fi - -# Issue #36 compliant. -if ! [ -e "/sys/class/net/${INTERFACE}/operstate" ] || ! [ "`cat /sys/class/net/${INTERFACE}/operstate`" = "up" ] -then - echo "$INTERFACE down" - echo "$INTERFACE down" - echo "#FF0000" - exit 0 -fi - -# path to store the old results in -path="/dev/shm/$(basename $0)-${INTERFACE}" - -# grabbing data for each adapter. -read rx < "/sys/class/net/${INTERFACE}/statistics/rx_bytes" -read tx < "/sys/class/net/${INTERFACE}/statistics/tx_bytes" - -# get time -time=$(date +%s) - -# write current data if file does not exist. Do not exit, this will cause -# problems if this file is sourced instead of executed as another process. -if ! [[ -f "${path}" ]]; then - echo "${time} ${rx} ${tx}" > "${path}" - chmod 0666 "${path}" -fi - -# read previous state and update data storage -read old < "${path}" -echo "${time} ${rx} ${tx}" > "${path}" - -# parse old data and calc time passed -old=(${old//;/ }) -time_diff=$(( $time - ${old[0]} )) - -# sanity check: has a positive amount of time passed -[[ "${time_diff}" -gt 0 ]] || exit - -# calc bytes transferred, and their rate in byte/s -rx_diff=$(( $rx - ${old[1]} )) -tx_diff=$(( $tx - ${old[2]} )) -rx_rate=$(( $rx_diff / $time_diff )) -tx_rate=$(( $tx_diff / $time_diff )) - -# shift by 10 bytes to get KiB/s. If the value is larger than -# 1024^2 = 1048576, then display MiB/s instead - -# incoming -echo -n "⇘" -rx_kib=$(( $rx_rate >> 10 )) -if [[ "$rx_rate" -gt 1048576 ]]; then - printf '%sM' "`echo "scale=1; $rx_kib / 1024" | bc`" -else - echo -n "${rx_kib}K" -fi - -# outgoing -echo -n "" -tx_kib=$(( $tx_rate >> 10 )) -if [[ "$tx_rate" -gt 1048576 ]]; then - printf '%sM' "`echo "scale=1; $tx_kib / 1024" | bc`" -else - echo -n "${tx_kib}K" -fi diff --git a/des/i3/i3blocks/scripts/genfan b/des/i3/i3blocks/scripts/genfan index 7a52e8b..b14c730 100755 --- a/des/i3/i3blocks/scripts/genfan +++ b/des/i3/i3blocks/scripts/genfan @@ -6,9 +6,8 @@ ICON_FAN="" IFS=$'\n' for i in $(sensors | grep RPM); do RPM=$(echo $i | awk '{print $2}') - if [ "$RPM" -ne "0" ]; then - FAN_RPMS+="$ICON_FAN $RPM " - fi + FAN_RPMS+="$ICON_FAN $RPM " done -echo "${FAN_RPMS[@]}" +# trim trailing whitespace +echo "${FAN_RPMS[@]}" | awk '{$1=$1;print}' diff --git a/des/i3/lockscreen.sh b/des/i3/lockscreen.sh deleted file mode 100755 index 31e1451..0000000 --- a/des/i3/lockscreen.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -IMG=/tmp/screen_locked.png -scrot $IMG -mogrify -scale 10% -scale 1000% $IMG -i3lock -i $IMG - -xautolock -time 1 -locker "i3lock -i $IMG" -notify 20 -notifier 'xset dpms force off' & -- cgit v1.2.3