aboutsummaryrefslogtreecommitdiff
path: root/config/i3blocks/scripts
diff options
context:
space:
mode:
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/bbswitch9
-rwxr-xr-xconfig/i3blocks/scripts/email6
-rwxr-xr-xconfig/i3blocks/scripts/iface82
-rwxr-xr-xconfig/i3blocks/scripts/mpd68
-rwxr-xr-xconfig/i3blocks/scripts/wifi47
8 files changed, 0 insertions, 423 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/bbswitch b/config/i3blocks/scripts/bbswitch
deleted file mode 100755
index a6ad24c..0000000
--- a/config/i3blocks/scripts/bbswitch
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-if [ -e /proc/acpi/bbswitch ]; then
- if [ -n "`cat /proc/acpi/bbswitch | grep ON`" ]; then
- echo OPTIMUS
- echo OP
- echo '#ffff00'
- fi
-fi
diff --git a/config/i3blocks/scripts/email b/config/i3blocks/scripts/email
deleted file mode 100755
index 2d26280..0000000
--- a/config/i3blocks/scripts/email
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-# Note: we cut last character because output ends with new line
-OUT="$(email-unread -s | tr "\n" " " | sed 's/ $//')"
-echo "$OUT"
-echo "$OUT"
-echo "#ffff00"
diff --git a/config/i3blocks/scripts/iface b/config/i3blocks/scripts/iface
deleted file mode 100755
index dc82438..0000000
--- a/config/i3blocks/scripts/iface
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/bin/bash
-# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info>
-# 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/>.
-
-#------------------------------------------------------------------------
-
-# Locate current default interface, but use only wlp (wifi) or enp (ethernet)
-# TODO probably also add connection over phone
-IF=$(ip route | awk '/^default .* (wlp|enp)/ { print $5 ; 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/${IF} ]] && exit
-# Note this passes if IF is empty!
-
-#------------------------------------------------------------------------
-
-# If no IF is selected then we want see down, not anything else.
-if [ -z "$IF" ] || [[ "$(cat /sys/class/net/$IF/operstate)" = 'down' ]]; then
- exit
-fi
-
-case $1 in
- -4)
- AF=inet ;;
- -6)
- AF=inet6 ;;
- *)
- AF=inet6? ;;
-esac
-
-# Use the first global scope address
-IPADDR=$(ip addr show $IF | perl -n -e "/$AF ([^\/]+).* scope global/ && print \$1 and exit")
-
-case $BLOCK_BUTTON in
- 3) echo -n "$IPADDR" | xclip -q -se c ;;
-esac
-
-#------------------------------------------------------------------------
-
-echo "$IPADDR" # full text
-echo "$IPADDR" # short text
-
-#------------------------------------------------------------------------
-# Use ping to check if we have connection
-
-# We ping only once and wait for one second
-PINGV="-c 1 -w 1"
-# Ping nic.cz
-if ping $PINGV nic.cz >/dev/null 2>&1; then
- echo \#00FF00 # color
-else
- # Ping nic.cz by ip
- if ping $PINGV 217.31.205.50 >/dev/null 2>&1; then
- # No DNS
- echo \#FFFF00 # color
- else
- # Ping default gateway of this interface
- if ping $PINGV $(ip route show dev $IF | awk '/^default via/ {print $3}') >/dev/null 2>&1; then
- # No internet connection but gateway accessible
- echo \#FF9000 # color
- else
- # No internet connection
- echo \#FF0000 # color
- fi
- fi
-fi
diff --git a/config/i3blocks/scripts/mpd b/config/i3blocks/scripts/mpd
deleted file mode 100755
index 12f0fdd..0000000
--- a/config/i3blocks/scripts/mpd
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/bin/bash
-HOST_HOME="192.168.0.51"
-
-HOST=""
-# Let's be sneaky and verify that we are on relevant network before we try to ping
-if ip a | grep -q 'inet 192.168.0.' && \
- ping -c 1 -w 1 "$HOST_HOME" >/dev/null 2>&1; then
- # TODO check that mpd is running?
- HOST="-h $HOST_HOME"
-fi
-
-STATUS="$(mpc $HOST status)"
-
-# Handle remote volume
-if [ "$BLOCK_INSTANCE" = "remote" ]; then
- [ -n "$HOST" ] || exit 0
- case "$BLOCK_BUTTON" in
- 1)
- mpc $HOST volume 40 >/dev/null
- ;;
- 3)
- mpc $HOST volume 0 >/dev/null
- ;;
- 4)
- mpc $HOST volume +2 >/dev/null
- ;;
- 5)
- mpc $HOST volume -2 >/dev/null
- ;;
- esac
-
- if echo "$STATUS" | grep -qE "(playing|paused)"; then
- echo "♫ $(mpc $HOST volume | sed 's/volume: //')"
- fi
- exit 0
-fi
-
-# Handle user input
-case "$BLOCK_BUTTON" in
- 1)
- mpc $HOST toggle >/dev/null
- ;;
- 2)
- mpc $HOST stop >/dev/null
- ;;
- 3)
- nohup urxvt -title "Music player daemon client" -e ncmpcpp $HOST 2>&1 >/dev/null &
- ;;
- 4)
- mpc $HOST prev >/dev/null
- ;;
- 5)
- mpc $HOST next >/dev/null
- ;;
-esac
-
-STATUS="$(mpc $HOST status)"
-if echo "$STATUS" | grep -qE "(playing|paused)"; then
- echo `mpc $HOST -f "♫ %artist%, %album%, %title%" status | head -1`
- echo
- if echo "$STATUS" | grep -q playing; then
- echo "#00ff00"
- elif echo "$STATUS" | grep -q paused; then
- echo "#ffff00"
- fi
-else
- echo "♫"
-fi
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