aboutsummaryrefslogtreecommitdiff
path: root/config/i3blocks/scripts
diff options
context:
space:
mode:
authorKarel Kočí <karel.koci@nic.cz>2020-10-08 07:49:07 +0200
committerKarel Kočí <karel.koci@nic.cz>2020-10-08 07:49:07 +0200
commit6c87803ec2c5338f9246c8689f3aded284417604 (patch)
treec37fa77117690c8592fa8922bf9ce256ca5423ad /config/i3blocks/scripts
parent1552cdb455cd342590f22adc3d647cefc7f99b14 (diff)
downloadmyconfigs-6c87803ec2c5338f9246c8689f3aded284417604.tar.gz
myconfigs-6c87803ec2c5338f9246c8689f3aded284417604.tar.bz2
myconfigs-6c87803ec2c5338f9246c8689f3aded284417604.zip
config/i3blocks: cleanup scripts
We either do not use these or can use contrib ones.
Diffstat (limited to 'config/i3blocks/scripts')
-rwxr-xr-xconfig/i3blocks/scripts/backup51
-rwxr-xr-xconfig/i3blocks/scripts/bandwidth85
-rwxr-xr-xconfig/i3blocks/scripts/battery75
-rwxr-xr-xconfig/i3blocks/scripts/wifi47
4 files changed, 0 insertions, 258 deletions
diff --git a/config/i3blocks/scripts/backup b/config/i3blocks/scripts/backup
deleted file mode 100755
index bfa3d39..0000000
--- a/config/i3blocks/scripts/backup
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/bash
-
-if [[ -n "$BLOCK_BUTTON" ]]; then
- nohup urxvt -title "System backup" -hold -e sudo system-backup 2>&1 >/dev/null &
-fi
-
-state=5
-if [[ -e ~/.backup_date ]]; then
- now=$(date +"%s")
- prev=$(cat ~/.backup_date)
- dif=$(expr $now - $prev)
- # 15 days
- if [[ $dif -ge 648000 ]]; then
- state=4
- # 12 days
- elif [[ $dif -ge 518400 ]]; then
- state=3
- # 5 days
- elif [[ $dif -ge 216000 ]]; then
- state=2
- # 2 days
- elif [[ $dif -ge 86400 ]]; then
- state=1
- else
- state=0
- fi
-fi
-
-if [[ $state -eq 0 ]]; then
- exit 0
-fi
-
-echo "Do backup"
-echo "Backup"
-case $state in
- 1)
- echo
- ;;
- 2)
- echo "#ffff00"
- ;;
- 3)
- echo "#ff8a00"
- ;;
- 4)
- echo "#ff5000"
- ;;
- 5)
- echo "#ff0000"
- ;;
-esac
diff --git a/config/i3blocks/scripts/bandwidth b/config/i3blocks/scripts/bandwidth
deleted file mode 100755
index ba15a27..0000000
--- a/config/i3blocks/scripts/bandwidth
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2012 Stefan Breunig <stefan+measure-net-speed@mathphys.fsk.uni-heidelberg.de>
-# Copyright (C) 2014 kaueraal
-# Copyright (C) 2015 Thiago Perrotta <perrotta dot thiago at poli dot ufrj dot br>
-
-# 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=$(ip route | awk '/^default .* (wlp|enp)/ { print $5 ; exit }')
-
-# Issue #36 compliant.
-if ! [ -e "/sys/class/net/${INTERFACE}/operstate" ] || ! [ "`cat /sys/class/net/${INTERFACE}/operstate`" = "up" ]
-then
- echo down # full text
- echo down # short text
- echo \#FF0000 # color
- 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 "IN "
-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
-
-echo -n " "
-
-# outgoing
-echo -n "OUT "
-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/config/i3blocks/scripts/battery b/config/i3blocks/scripts/battery
deleted file mode 100755
index 7a5563a..0000000
--- a/config/i3blocks/scripts/battery
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright 2014 Pierre Mavro <deimos@deimos.fr>
-# Copyright 2014 Vivien Didelot <vivien@didelot.org>
-#
-# Licensed under the terms of the GNU GPL v3, or any later version.
-#
-# This script is meant to use with i3blocks. It parses the output of the "acpi"
-# command (often provided by a package of the same name) to read the status of
-# the battery, and eventually its remaining time (to full charge or discharge).
-#
-# The color will gradually change for a percentage below 85%, and the urgency
-# (exit code 33) is set if there is less that 5% remaining.
-
-use strict;
-use warnings;
-use utf8;
-
-my $acpi;
-my $status;
-my $percent;
-my $full_text;
-my $short_text;
-my $bat_number = $ENV{BLOCK_INSTANCE} || 0;
-
-# read the first line of the "acpi" command output
-open (ACPI, "acpi -b | grep 'Battery $bat_number' |") or die;
-$acpi = <ACPI>;
-close(ACPI);
-
-# fail on unexpected output
-if ($acpi !~ /: (\w+), (\d+)%/) {
- die "$acpi\n";
-}
-
-$status = $1;
-$percent = $2;
-
-if ($status eq 'Discharging') {
- $full_text = '🔋 ';
-} elsif ($status eq 'Charging') {
- $full_text = '🔌 ';
-}
-
-$full_text .= "$percent%";
-
-$short_text = $full_text;
-
-if ($acpi =~ /(\d\d:\d\d):/) {
- $full_text .= " ($1)";
-}
-
-# print text
-print "$full_text\n";
-print "$short_text\n";
-
-# consider color and urgent flag only on discharge
-if ($status eq 'Discharging') {
-
- if ($percent < 20) {
- print "#FF0000\n";
- } elsif ($percent < 40) {
- print "#FFAE00\n";
- } elsif ($percent < 60) {
- print "#FFF600\n";
- } elsif ($percent < 85) {
- print "#A8FF00\n";
- }
-
- if ($percent < 5) {
- exit(33);
- }
-}
-
-exit(0);
diff --git a/config/i3blocks/scripts/wifi b/config/i3blocks/scripts/wifi
deleted file mode 100755
index d549b10..0000000
--- a/config/i3blocks/scripts/wifi
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2014 Alexander Keller <github@nycroth.com>
-
-# 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="$(ip link | awk '/wlp.*/ {print substr($2, 1, length($2)-1); exit}')"
-
-#------------------------------------------------------------------------
-
-# As per #36 -- It is transparent: e.g. if the machine has no battery or wireless
-# connection (think desktop), the corresponding block should not be displayed.
-[[ ! -d /sys/class/net/${INTERFACE}/wireless ]] ||
- [[ "$(cat /sys/class/net/$INTERFACE/operstate)" = 'down' ]] && exit
-
-#------------------------------------------------------------------------
-
-QUALITY=$(grep $INTERFACE /proc/net/wireless | awk '{ print int($3 * 100 / 70) }')
-SSID=$(iwgetid $INTERFACE | sed 's/.*ESSID:"\([^"]*\)"/\1/')
-
-#------------------------------------------------------------------------
-
-echo $SSID $QUALITY% # full text
-echo $SSID # short text
-
-# color
-if [[ $QUALITY -ge 80 ]]; then
- echo "#00FF00"
-elif [[ $QUALITY -lt 80 ]]; then
- echo "#FFF600"
-elif [[ $QUALITY -lt 60 ]]; then
- echo "#FFAE00"
-elif [[ $QUALITY -lt 40 ]]; then
- echo "#FF0000"
-fi