diff options
Diffstat (limited to 'configs/i3/i3blocks/scripts')
| -rwxr-xr-x | configs/i3/i3blocks/scripts/archupdates | 10 | ||||
| -rwxr-xr-x | configs/i3/i3blocks/scripts/bandwidth | 88 | ||||
| -rwxr-xr-x | configs/i3/i3blocks/scripts/battery | 29 | ||||
| -rwxr-xr-x | configs/i3/i3blocks/scripts/brightness | 10 | ||||
| -rwxr-xr-x | configs/i3/i3blocks/scripts/calendar | 40 | ||||
| -rwxr-xr-x | configs/i3/i3blocks/scripts/volume | 70 |
6 files changed, 0 insertions, 247 deletions
diff --git a/configs/i3/i3blocks/scripts/archupdates b/configs/i3/i3blocks/scripts/archupdates deleted file mode 100755 index c07c45f..0000000 --- a/configs/i3/i3blocks/scripts/archupdates +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/bash - -PAC_UPDATES=$(checkupdates | wc -l) -AUR_UPDATES=$(cower -u | wc -l) - -if [[ $PAC_UPDATES -gt 0 || $AUR_UPDATES -gt 0 ]]; then - echo " [$PAC_UPDATES .. $AUR_UPDATES]" -else - echo "<span color=\"#586e75\"> 0</span>" -fi
\ No newline at end of file diff --git a/configs/i3/i3blocks/scripts/bandwidth b/configs/i3/i3blocks/scripts/bandwidth deleted file mode 100755 index d7db2a6..0000000 --- a/configs/i3/i3blocks/scripts/bandwidth +++ /dev/null @@ -1,88 +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/>. - -# 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 "<span color=\"#93a1a1\">⇖</span>" -tx_kib=$(( $tx_rate >> 10 )) -if [[ "$tx_rate" -gt 1048576 ]]; then - printf '%sM' "`echo "scale=1; $tx_kib / 1024" | bc`" -else - echo -n "<span color=\"#93a1a1\">${tx_kib}K</span>" -fi diff --git a/configs/i3/i3blocks/scripts/battery b/configs/i3/i3blocks/scripts/battery deleted file mode 100755 index 802689b..0000000 --- a/configs/i3/i3blocks/scripts/battery +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/bash - -BAT_DIR=/sys/class/power_supply/BAT0 -CHARGE=$(cat $BAT_DIR/capacity) -CHARGE_FULL=$(cat $BAT_DIR/charge_full) -CHARGE_NOW=$(cat $BAT_DIR/charge_now) -STATUS=$(cat $BAT_DIR/status) - -ICON_BATTERY_25_P= -ICON_BATTERY_50_P= -ICON_BATTERY_75_P= -ICON_BATTERY_FULL= -ICON_BATTERY_CHARGING= -ICON_FULL= - -PERCENT_FULL=$(echo - | awk -v charge_full="$CHARGE_FULL" -v charge_now="$CHARGE_NOW" '{printf "%1.0f\n", (charge_now / charge_full)*100}') -if [[ $STATUS == "Full" ]]; then - echo "$ICON_FULL" -elif [[ $STATUS == "Charging" ]]; then - echo "$ICON_BATTERY_CHARGING ($PERCENT_FULL%)" -elif [[ $PERCENT_FULL -lt 100 ]]; then - echo "$ICON_BATTERY_FULL ($PERCENT_FULL%)" -elif [[ $PERCENT_FULL -lt 75 ]]; then - echo "$ICON_BATTERY_75_P ($PERCENT_FULL%)" -elif [[ $PERCENT_FULL -lt 50 ]]; then - echo "$ICON_BATTERY_50_P ($PERCENT_FULL%)" -elif [[ $PERCENT_FULL -lt 25 ]]; then - echo "$ICON_BATTERY_25_P ($PERCENT_FULL%)" -fi diff --git a/configs/i3/i3blocks/scripts/brightness b/configs/i3/i3blocks/scripts/brightness deleted file mode 100755 index 64ea1d8..0000000 --- a/configs/i3/i3blocks/scripts/brightness +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/bash - -BRIGHTNESS_DIR=/sys/class/backlight/intel_backlight -MAX_BRIGHTNESS=$(cat $BRIGHTNESS_DIR/max_brightness) -CURR_BRIGHTNESS=$(cat $BRIGHTNESS_DIR/actual_brightness) - -ICON_BRIGHT_SUN="☀" -BRIGHTNESS_P=$(echo - | awk -v max="$MAX_BRIGHTNESS" -v curr="$CURR_BRIGHTNESS" '{printf "%1.0f\n", (curr / max)*100}') - -echo "$ICON_BRIGHT_SUN $BRIGHTNESS_P%" diff --git a/configs/i3/i3blocks/scripts/calendar b/configs/i3/i3blocks/scripts/calendar deleted file mode 100755 index 7ad0363..0000000 --- a/configs/i3/i3blocks/scripts/calendar +++ /dev/null @@ -1,40 +0,0 @@ -#! /bin/sh - -WIDTH=${WIDTH:-100} -HEIGHT=${HEIGHT:-100} -DATEFMT=${DATEFMT:-"+%Y-%M-%d %H:%m"} -SHORTFMT=${SHORTFMT:-"+%H:%M:%S"} - -OPTIND=1 -while getopts ":f:W:H:" opt; do - case $opt in - f) DATEFMT="$OPTARG" ;; - W) WIDTH="$OPTARG" ;; - H) HEIGHT="$OPTARG" ;; - \?) - echo "Invalid option: -$OPTARG" >&2 - exit 1 - ;; - :) - echo "Option -$OPTARG requires an argument." >&2 - exit 1 - ;; - esac -done - -case "$BLOCK_BUTTON" in - 1|2|3) - - # the position of the upper left corner of the popup - posX=$(( ( $BLOCK_X - 230 ) - $WIDTH / 2 )) - posY=$(( ( $BLOCK_Y - 200 ) - $HEIGHT )) - - i3-msg -q "exec yad --calendar \ - --width=$WIDTH --height=$HEIGHT \ - --undecorated --fixed \ - --close-on-unfocus --no-buttons \ - --posx=$posX --posy=$posY \ - > /dev/null" -esac -echo "$LABEL$(date "$DATEFMT") " -echo "$LABEL$(date "$SHORTFMT") " diff --git a/configs/i3/i3blocks/scripts/volume b/configs/i3/i3blocks/scripts/volume deleted file mode 100755 index 1e318a0..0000000 --- a/configs/i3/i3blocks/scripts/volume +++ /dev/null @@ -1,70 +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/>. - -#------------------------------------------------------------------------ - -# The second parameter overrides the mixer selection -# For PulseAudio users, use "pulse" -# For Jack/Jack2 users, use "jackplug" -# For ALSA users, you may use "default" for your primary card -# or you may use hw:# where # is the number of the card desired -MIXER="default" -[ -n "$(lsmod | grep pulse)" ] && MIXER="pulse" -[ -n "$(lsmod | grep jack)" ] && MIXER="jackplug" -MIXER="${2:-$MIXER}" - -# The instance option sets the control to report and configure -# This defaults to the first control of your selected mixer -# For a list of the available, use `amixer -D $Your_Mixer scontrols` -SCONTROL="${BLOCK_INSTANCE:-$(amixer -D $MIXER scontrols | - sed -n "s/Simple mixer control '\([A-Za-z ]*\)',0/\1/p" | - head -n1 - )}" - -# The first parameter sets the step to change the volume by (and units to display) -# This may be in in % or dB (eg. 5% or 3dB) -STEP="${1:-5%}" - -#------------------------------------------------------------------------ - -capability() { # Return "Capture" if the device is a capture device - amixer -D $MIXER get $SCONTROL | - sed -n "s/ Capabilities:.*cvolume.*/Capture/p" -} - -volume() { - amixer -D $MIXER get $SCONTROL $(capability) -} - -format() { - perl_filter='if (/.*\[(\d+%)\] (\[(-?\d+.\d+dB)\] )?\[(on|off)\]/)' - perl_filter+='{CORE::say $4 eq "off" ? " MUTE" : "' - # If dB was selected, print that instead - perl_filter+=$([[ $STEP = *dB ]] && echo '$3' || echo ' $1') - perl_filter+='"; exit}' - perl -ne "$perl_filter" -} - -#------------------------------------------------------------------------ - -case $BLOCK_BUTTON in - 3) amixer -q -D $MIXER sset $SCONTROL $(capability) toggle ;; # right click, mute/unmute - 4) amixer -q -D $MIXER sset $SCONTROL $(capability) ${STEP}+ unmute ;; # scroll up, increase - 5) amixer -q -D $MIXER sset $SCONTROL $(capability) ${STEP}- unmute ;; # scroll down, decrease -esac - -volume | format |
