diff options
Diffstat (limited to '.config/i3blocks/scripts')
21 files changed, 0 insertions, 1178 deletions
diff --git a/.config/i3blocks/scripts/arch-update.py b/.config/i3blocks/scripts/arch-update.py deleted file mode 100755 index 7dc5d62..0000000 --- a/.config/i3blocks/scripts/arch-update.py +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/python3 -# -# Copyright (C) 2017 Marcel Patzwahl -# Licensed under the terms of the GNU GPL v3 only. -# -# i3blocks blocklet script to see the available updates of pacman and the AUR -import subprocess -from subprocess import check_output -import argparse -import re - - -def create_argparse(): - parser = argparse.ArgumentParser(description='Check for pacman updates') - parser.add_argument( - '-b', - '--base_color', - default='cyan', - help='base color of the output(default=cyan)' - ) - parser.add_argument( - '-u', - '--updates_available_color', - default='yellow', - help='color of the output, when updates are available(default=yellow)' - ) - parser.add_argument( - '-a', - '--aur', - action='store_true', - help='Include AUR packages. Attn: Yaourt must be installed' - ) - parser.add_argument( - '-q', - '--quiet', - action='store_true', - help='Do not produce output when system is up to date' - ) - parser.add_argument( - '-w', - '--watch', - nargs='*', - default=[], - help='Explicitly watch for specified packages. ' - 'Listed elements are treated as regular expressions for matching.' - ) - return parser.parse_args() - - -def get_updates(): - output = check_output(['checkupdates']).decode('utf-8') - if not output: - return [] - - updates = [line.split(' ')[0] - for line in output.split('\n') - if line] - - return updates - - -def get_aur_updates(): - output = '' - try: - output = check_output(['yaourt', '-Qua']).decode('utf-8') - except subprocess.CalledProcessError as exc: - # yaourt exits with 1 and no output if no updates are available. - # we ignore this case and go on - if not (exc.returncode == 1 and not exc.output): - raise exc - if not output: - return [] - - aur_updates = [line.split(' ')[0] - for line in output.split('\n') - if line.startswith('aur/')] - - return aur_updates - - -def matching_updates(updates, watch_list): - matches = set() - for u in updates: - for w in watch_list: - if re.match(w, u): - matches.add(u) - - return matches - - -message = "<span color='{0}'>{1}</span>" -args = create_argparse() - -updates = get_updates() -if args.aur: - updates += get_aur_updates() - -update_count = len(updates) -if update_count > 0: - info = '-Syu : {}'.format(update_count) - matches = matching_updates(updates, args.watch) - if matches: - info += ' [{0}]'.format(', '.join(matches)) - print(message.format(args.updates_available_color, info)) - - import os - if 'BLOCK_BUTTON' in os.environ: - button = os.environ['BLOCK_BUTTON'] - if button is not '': - button = int(button) - if button is 1: - subprocess.call("termite -e 'sudo pacman -Syu' --hold", - shell=True) - -elif not args.quiet: - print(message.format(args.base_color, '-Syu ')) diff --git a/.config/i3blocks/scripts/bandwidth b/.config/i3blocks/scripts/bandwidth deleted file mode 100755 index 6a93c35..0000000 --- a/.config/i3blocks/scripts/bandwidth +++ /dev/null @@ -1,113 +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/>. - -# Get custom IN and OUT labels if provided by command line arguments -while [[ $# -gt 1 ]]; do - key="$1" - case "$key" in - -i|--inlabel) - INLABEL="$2" - shift;; - -o|--outlabel) - OUTLABEL="$2" - shift;; - esac - shift -done - -[[ -z "$INLABEL" ]] && INLABEL="IN " -[[ -z "$OUTLABEL" ]] && OUTLABEL="OUT " - -# Use the provided interface, otherwise the device used for the default route. -if [[ -z $INTERFACE ]] && [[ -n $BLOCK_INSTANCE ]]; then - INTERFACE=$BLOCK_INSTANCE -elif [[ -z $INTERFACE ]]; then - INTERFACE=$(ip route | awk '/^default/ { print $5 ; exit }') -fi - -# Exit if there is no default route -[[ -z "$INTERFACE" ]] && exit - -# Issue #36 compliant. -if ! [ -e "/sys/class/net/${INTERFACE}/operstate" ] || \ - (! [ "$TREAT_UNKNOWN_AS_UP" = "1" ] && - ! [ "`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 "$INLABEL" -rx_kib=$(( $rx_rate >> 10 )) -if hash bc 2>/dev/null && [[ "$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 "$OUTLABEL" -tx_kib=$(( $tx_rate >> 10 )) -if hash bc 2>/dev/null && [[ "$tx_rate" -gt 1048576 ]]; then - printf '%sM\n' "`echo "scale=1; $tx_kib / 1024" | bc`" -else - echo "${tx_kib}K" -fi diff --git a/.config/i3blocks/scripts/batterybar b/.config/i3blocks/scripts/batterybar deleted file mode 100755 index 5b5e869..0000000 --- a/.config/i3blocks/scripts/batterybar +++ /dev/null @@ -1,138 +0,0 @@ -#!/usr/bin/env bash -# batterybar; displays battery percentage as a bar on i3blocks -# -# Copyright 2015 Keftaa <adnan.37h@gmail.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 2 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, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -# MA 02110-1301, USA. -# -# -readarray -t output <<< $(acpi battery) -battery_count=${#output[@]} - - -for line in "${output[@]}"; -do - percentages+=($(echo "$line" | grep -o -m1 '[0-9]\{1,3\}%' | tr -d '%')) - statuses+=($(echo "$line" | egrep -o -m1 'Discharging|Charging|AC|Full|Unknown')) - remaining=$(echo "$line" | egrep -o -m1 '[0-9][0-9]:[0-9][0-9]') - if [[ -n $remaining ]]; then - remainings+=(" ($remaining)") - else - remainings+=("") - fi -done - -squares="■" - -#There are 8 colors that reflect the current battery percentage when -#discharging -dis_colors=("#FF0027" "#FF3B05" "#FFB923" "#FFD000" "#E4FF00" "#ADFF00" -"#6DFF00" "#10BA00") -charging_color="#00FFFF" -full_color="#FFFFFF" -ac_color="#535353" - - -while getopts 1:2:3:4:5:6:7:8:c:f:a:h opt; do - case "$opt" in - 1) dis_colors[0]="$OPTARG";; - 2) dis_colors[1]="$OPTARG";; - 3) dis_colors[2]="$OPTARG";; - 4) dis_colors[3]="$OPTARG";; - 5) dis_colors[4]="$OPTARG";; - 6) dis_colors[5]="$OPTARG";; - 7) dis_colors[6]="$OPTARG";; - 8) dis_colors[7]="$OPTARG";; - c) charging_color="$OPTARG";; - f) full_color="$OPTARG";; - a) ac_color="$OPTARG";; - h) printf "Usage: batterybar [OPTION] color - When discharging, there are 8 [1-8] levels colors. - You can specify custom colors, for example: - - batterybar -1 red -2 \"#F6F6F6\" -8 green - - You can also specify the colors for the charging, AC and - charged states: - - batterybar -c green -f white -a \"#EEEEEE\"\n"; - exit 0; - esac -done - -end=$(($battery_count - 1)) -for i in $(seq 0 $end); -do - if (( percentages[$i] >=85 )); then - squares="" - elif (( percentages[$i] >=65 )); then - squares="" - elif (( percentages[$i] >=35 )); then - squares="" - elif (( percentages[$i] >=10 )); then - squares="" - else - squares="" - fi - - if [[ "${statuses[$i]}" = "Unknown" ]]; then - #squares="<sup>?</sup>$squares" - continue - fi - - case "${statuses[$i]}" in - "Charging") - color="$charging_color" - ;; - "Full") - color="$full_color" - ;; - "AC") - color="$ac_color" - ;; - "Discharging"|"Unknown") - if (( percentages[$i] >= 80 )); then - color="${dis_colors[7]}" - elif (( percentages[$i] >= 70)); then - color="${dis_colors[6]}" - elif (( percentages[$i] >= 60)); then - color="${dis_colors[5]}" - elif (( percentages[$i] >= 40)); then - color="${dis_colors[4]}" - elif (( percentages[$i] >= 30)); then - color="${dis_colors[3]}" - elif (( percentages[$i] >= 20)); then - color="${dis_colors[2]}" - elif (( percentages[$i] >= 10)); then - color="${dis_colors[1]}" - else - color="${dis_colors[0]}" - fi - ;; - esac - - # Print Battery number if there is more than one - if (( $end > 1 )) ; then - message="$message $(($i + 1)):" - fi - - if [[ "$BLOCK_BUTTON" -eq 1 ]]; then - message="$message ${statuses[$i]} <span foreground=\"$color\">${remainings[i]}</span>" - fi - message="$message <span foreground=\"$color\">$squares ${percentages[$i]}%</span>" -done - -echo $message diff --git a/.config/i3blocks/scripts/brightness.py b/.config/i3blocks/scripts/brightness.py deleted file mode 100755 index 983a54f..0000000 --- a/.config/i3blocks/scripts/brightness.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/python3 -# This script is for my i3blocks bar, its handles scrolling to change -# brightness of monitor - -import subprocess -import re -import os - -display = "eDP-1" - -proc = subprocess.Popen("xrandr --verbose | grep Brightness", shell=True, - stdout=subprocess.PIPE) - - -res = proc.stdout.readline().strip() -res = str(res) - -num = re.compile("\d\.\d+") -bri = num.findall(res)[0] - -bri = round(float(bri)*100) - -env = os.environ -if 'BLOCK_BUTTON' in env: - button = env['BLOCK_BUTTON'] - if button is not '': - button = int(button) - if button is 4: - new_bri = bri + 5 - elif button is 5: - new_bri = bri - 5 - else: - new_bri = bri - - if new_bri <= 100 and new_bri >= 10: - bri = new_bri - new_bri = new_bri/100 - subprocess.call(f"xrandr --output {display} --brightness {new_bri}", - shell=True) - subprocess.call(f"echo {new_bri} > ~/.last_brightness", shell=True) - -print(f"{bri}%") diff --git a/.config/i3blocks/scripts/calendar b/.config/i3blocks/scripts/calendar deleted file mode 100755 index fe09fcc..0000000 --- a/.config/i3blocks/scripts/calendar +++ /dev/null @@ -1,38 +0,0 @@ -#! /bin/sh - -width=200 -height=200 -datefmt="+%a %Y-%m-%d" - -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 - $width)) - posY=$(($BLOCK_Y)) #+ $height)) - - i3-msg -q "exec yad --calendar \ - --width=$width --height=$height \ - --fixed \ - --close-on-unfocus --no-buttons \ - --posx=$posX --posy=$posY \ - > /dev/null" -esac -date "$datefmt" diff --git a/.config/i3blocks/scripts/cpu_usage b/.config/i3blocks/scripts/cpu_usage deleted file mode 100755 index 44c1189..0000000 --- a/.config/i3blocks/scripts/cpu_usage +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/perl -# -# Copyright 2014 Pierre Mavro <deimos@deimos.fr> -# Copyright 2014 Vivien Didelot <vivien@didelot.org> -# Copyright 2014 Andreas Guldstrand <andreas.guldstrand@gmail.com> -# -# Licensed under the terms of the GNU GPL v3, or any later version. - -use strict; -use warnings; -use utf8; -use Getopt::Long; - -# default values -my $t_warn = $ENV{T_WARN} // 50; -my $t_crit = $ENV{T_CRIT} // 80; -my $cpu_usage = -1; -my $decimals = $ENV{DECIMALS} // 2; -my $label = $ENV{LABEL} // ""; - -sub help { - print "Usage: cpu_usage [-w <warning>] [-c <critical>] [-d <decimals>]\n"; - print "-w <percent>: warning threshold to become yellow\n"; - print "-c <percent>: critical threshold to become red\n"; - print "-d <decimals>: Use <decimals> decimals for percentage (default is $decimals) \n"; - exit 0; -} - -GetOptions("help|h" => \&help, - "w=i" => \$t_warn, - "c=i" => \$t_crit, - "d=i" => \$decimals, -); - -# Get CPU usage -$ENV{LC_ALL}="en_US"; # if mpstat is not run under en_US locale, things may break, so make sure it is -open (MPSTAT, 'mpstat 1 1 |') or die; -while (<MPSTAT>) { - if (/^.*\s+(\d+\.\d+)[\s\x00]?$/) { - $cpu_usage = 100 - $1; # 100% - %idle - last; - } -} -close(MPSTAT); - -$cpu_usage eq -1 and die 'Can\'t find CPU information'; - -# Print short_text, full_text -print "${label}"; -printf "%.${decimals}f%%\n", $cpu_usage; -print "${label}"; -printf "%.${decimals}f%%\n", $cpu_usage; - -# Print color, if needed -if ($cpu_usage >= $t_crit) { - print "#FF0000\n"; - exit 33; -} elsif ($cpu_usage >= $t_warn) { - print "#FFFC00\n"; -} - -exit 0; diff --git a/.config/i3blocks/scripts/disk b/.config/i3blocks/scripts/disk deleted file mode 100755 index c34240d..0000000 --- a/.config/i3blocks/scripts/disk +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh -# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info> - -# 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/>. - -DIR="${DIR:-$BLOCK_INSTANCE}" -DIR="${DIR:-$HOME}" -ALERT_LOW="${ALERT_LOW:-$1}" -ALERT_LOW="${ALERT_LOW:-10}" # color will turn red under this value (default: 10%) - -LOCAL_FLAG="-l" -if [ "$1" = "-n" ] || [ "$2" = "-n" ]; then - LOCAL_FLAG="" -fi - -df -h -P $LOCAL_FLAG "$DIR" | awk -v label="$LABEL" -v alert_low=$ALERT_LOW ' -/\/.*/ { - # full text - print label $4 - - # short text - print label $4 - - use=$5 - - # no need to continue parsing - exit 0 -} - -END { - gsub(/%$/,"",use) - if (100 - use < alert_low) { - # color - print "#FF0000" - } -} -' diff --git a/.config/i3blocks/scripts/disk-io b/.config/i3blocks/scripts/disk-io deleted file mode 100755 index b6bebc2..0000000 --- a/.config/i3blocks/scripts/disk-io +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright (C) 2016 James Murphy -# Licensed under the terms of the GNU GPL v2 only. -# -# i3blocks blocklet script to monitor disk io - -label="${LABEL:-""}" -dt="${DT:-5}" -MB_only="${MB_ONLY:-0}" -kB_only="${KB_ONLY:-0}" -width="${WIDTH:-4}" -MB_precision="${MB_PRECISION:-1}" -kB_precision="${KB_PRECISION:-0}" -regex="${REGEX:-$BLOCK_INSTANCE}" -regex="${regex:-/^(s|h)d[a-zA-Z]+/}" -threshold="${THRESHOLD:-0}" -warn_color="${WARN_COLOR:-#FF0000}" -sep="${SEPARATOR:-/}" -unit_suffix="${SUFFIX:-B/s}" - -function list_devices { - echo "Devices iostat reports that match our regex:" - iostat | awk '$1~/^(s|h)d[a-zA-Z]+/{print $1}' -} - -while getopts L:t:w:p:P:R:s:ST:C:lLMmKkh opt; do - case "$opt" in - L) label="$OPTARG" ;; - t) dt="$OPTARG" ;; - w) width="$OPTARG" ;; - p) kB_precision="$OPTARG" ;; - P) MB_precision="$OPTARG" ;; - R) regex="$OPTARG" ;; - s) sep="$OPTARG" ;; - S) unit_suffix="" ;; - T) threshold="$OPTARG" ;; - C) warn_color="$OPTARG" ;; - l) list_devices; exit 0 ;; - M|m) MB_only=1 ;; - K|k) kB_only=1 ;; - h) printf \ -"Usage: disk-io [-t time] [-w width] [-p kB_precision] [-P MB_precision] [-R regex] [-s separator] [-S] [-T threshold [-C warn_color]] [-k|-M] [-l] [-h] -Options: --L\tLabel to put in front of the text. Default: $label --t\tTime interval in seconds between measurements. Default: $dt --w\tThe width of printed floats. Default: $width --p\tThe precision of kB/s floats. Default: $kB_precision --P\tThe precision of MB/s floats. Default: $MB_precision --R\tRegex that devices must match. Default: $regex --s\tSeparator to put between rates. Default: $sep --S\tShort units, omit B/s in kB/s and MB/s. --T\tRate in kB/s to exceed to trigger a warning. Default: not enabled --C\tColor to change the blocklet to warn the user. Default: $warn_color --l\tList devices that iostat reports --M\tDo not switch between MB/s and kB/s, use only MB/s --k\tDo not switch between MB/s and kB/s, use only kB/s --h\tShow this help text -" && exit 0;; - esac -done - -iostat -dyz "$dt" | awk -v sep="$sep" " - BEGIN { - rx = wx = 0; - } - { - if(\$0 == \"\") { - if ($threshold > 0 && (rx >= $threshold || wx >= $threshold)) { - printf \"<span color='$warn_color'>\"; - } - printf \"$label\"; - if(!$kB_only && ($MB_only || rx >= 1024 || wx >= 1024)) { - printf \"%-$width.${MB_precision}f%s%$width.${MB_precision}f M$unit_suffix\", rx/1024, sep, wx/1024; - } - else { - printf \"%-$width.${kB_precision}f%s%$width.${kB_precision}f k$unit_suffix\", rx, sep, wx; - } - if ($threshold > 0 && (rx >= $threshold || wx >= $threshold)) { - printf \"</span>\"; - } - printf \"\n\"; - fflush(stdout); - } - else if(\$1~/^Device:?/) { - rx = wx = 0; - } - else if(\$1~$regex) { - rx += \$3; - wx += \$4; - } - }" diff --git a/.config/i3blocks/scripts/i3blocks-cmus b/.config/i3blocks/scripts/i3blocks-cmus Binary files differdeleted file mode 100755 index bd90f14..0000000 --- a/.config/i3blocks/scripts/i3blocks-cmus +++ /dev/null diff --git a/.config/i3blocks/scripts/i3blocks-contrib b/.config/i3blocks/scripts/i3blocks-contrib deleted file mode 160000 -Subproject 21708edc3d12c1f37285e3e9363f6541be72359 diff --git a/.config/i3blocks/scripts/iface b/.config/i3blocks/scripts/iface deleted file mode 100755 index 75baa94..0000000 --- a/.config/i3blocks/scripts/iface +++ /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/>. - -#------------------------------------------------------------------------ - -# Use the provided interface, otherwise the device used for the default route. -IF="${IFACE:-$BLOCK_INSTANCE}" -IF="${IF:-$(ip route | awk '/^default/ { print $5 ; exit }')}" - -# Exit if there is no default route -[[ -z "$IF" ]] && 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 - -#------------------------------------------------------------------------ - -AF=${ADDRESS_FAMILY:-inet6?} -LABEL="${LABEL:-}" - -for flag in "$1" "$2"; do - case "$flag" in - -4) - AF=inet ;; - -6) - AF=inet6 ;; - -L) - if [[ "$IF" = "" ]]; then - LABEL="iface " - else - LABEL="$IF: " - fi ;; - esac -done - -if [[ "$IF" = "" ]] || [[ "$(cat /sys/class/net/$IF/operstate)" = 'down' ]]; then - echo "${LABEL}down" # full text - echo "${LABEL}down" # short text - echo \#FF0000 # color - exit -fi - -# if no interface is found, use the first device with a global scope -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 "$LABEL$IPADDR" # full text -echo "$LABEL$IPADDR" # short text diff --git a/.config/i3blocks/scripts/keyindicator b/.config/i3blocks/scripts/keyindicator deleted file mode 100755 index 50c3a3f..0000000 --- a/.config/i3blocks/scripts/keyindicator +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/env perl -# -# Copyright 2014 Marcelo Cerri <mhcerri at gmail dot 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/>. - -use strict; -use warnings; -use utf8; -use Getopt::Long; -use File::Basename; - -# Default values -my $indicator = $ENV{BLOCK_INSTANCE} || $ENV{KEY} || "CAPS"; -my $color_on = $ENV{COLOR_ON} || "#00FF00"; -my $color_off = $ENV{COLOR_OFF} || "#222222"; -my $bg_color_on = $ENV{BG_COLOR_ON}; -my $bg_color_off = $ENV{BG_COLOR_OFF}; -my $hide = $ENV{HIDE_WHEN_OFF} || 0; - -sub help { - my $program = basename($0); - printf "Usage: %s [-c <color on>] [-C <color off>] [-b <bg color on>] [-B <bg color off>] [--hide]\n", $program; - printf " -c <color on>: hex color to use when indicator is on\n"; - printf " -C <color off>: hex color to use when indicator is off\n"; - printf " -b <background color on>: hex color to use when indicator is on\n"; - printf " -B <background color off>: hex color to use when indicator is off\n"; - printf " --hide: don't output anything when indicator is off\n"; - printf "\n"; - printf "Note: environment variable \$BLOCK_INSTANCE should be one of:\n"; - printf " CAPS, NUM (default is CAPS).\n"; - exit 0; -} - -Getopt::Long::config qw(no_ignore_case); -GetOptions("help|h" => \&help, - "c=s" => \$color_on, - "C=s" => \$color_off, - "b=s" => \$bg_color_on, - "B=s" => \$bg_color_off, - "hide" => \$hide) or exit 1; - -# Key mapping -my %indicators = ( - CAPS => 0x00000001, - NUM => 0x00000002, -); - -# Retrieve key flags -my $mask = 0; -open(XSET, "xset -q |") or die; -while (<XSET>) { - if (/LED mask:\s*([0-9a-f]+)/) { - $mask = hex $1; - last; - } -} -close(XSET); - -# Determine if indicator is on or off -my $indicator_status = ($indicators{$indicator} || 0) & $mask; - -# Exit if --hide and indicator is off -if ($hide and !$indicator_status) { - exit 0 -} - -# Output -my $fg_color = $indicator_status ? $color_on : $color_off; -my $bg_color = $indicator_status ? $bg_color_on : $bg_color_off; - -if (defined $bg_color) { - printf "<span color='%s' bgcolor='%s'>%s</span>\n", $fg_color, $bg_color, $indicator; -} else { - printf "<span color='%s'>%s</span>\n", $fg_color, $indicator; -} - -exit 0 diff --git a/.config/i3blocks/scripts/load_average b/.config/i3blocks/scripts/load_average deleted file mode 100755 index 37a5c71..0000000 --- a/.config/i3blocks/scripts/load_average +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info> - -# 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/>. - -load="$(cut -d ' ' -f1 /proc/loadavg)" -cpus="$(nproc)" - -# full text -echo "$load" - -# short text -echo "$load" - -# color if load is too high -awk -v cpus=$cpus -v cpuload=$load ' - BEGIN { - if (cpus <= cpuload) { - print "#FF0000"; - exit 33; - } - } -' diff --git a/.config/i3blocks/scripts/mediaplayer b/.config/i3blocks/scripts/mediaplayer Binary files differdeleted file mode 100644 index dede5fd..0000000 --- a/.config/i3blocks/scripts/mediaplayer +++ /dev/null diff --git a/.config/i3blocks/scripts/memory b/.config/i3blocks/scripts/memory deleted file mode 100755 index 90eb2c6..0000000 --- a/.config/i3blocks/scripts/memory +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh -# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info> - -# 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/>. - -TYPE="${BLOCK_INSTANCE:-mem}" - -awk -v type=$TYPE ' -/^MemTotal:/ { - mem_total=$2 -} -/^MemFree:/ { - mem_free=$2 -} -/^Buffers:/ { - mem_free+=$2 -} -/^Cached:/ { - mem_free+=$2 -} -/^SwapTotal:/ { - swap_total=$2 -} -/^SwapFree:/ { - swap_free=$2 -} -END { - if (type == "swap") { - free=swap_free/1024/1024 - used=(swap_total-swap_free)/1024/1024 - total=swap_total/1024/1024 - } else { - free=mem_free/1024/1024 - used=(mem_total-mem_free)/1024/1024 - total=mem_total/1024/1024 - } - - pct=0 - if (total > 0) { - pct=used/total*100 - } - - # full text - printf("%.1fG/%.1fG (%.f%%)\n", used, total, pct) - - # short text - printf("%.f%%\n", pct) - - # color - if (pct > 90) { - print("#FF0000") - } else if (pct > 80) { - print("#FFAE00") - } else if (pct > 70) { - print("#FFF600") - } -} -' /proc/meminfo diff --git a/.config/i3blocks/scripts/myCalendar b/.config/i3blocks/scripts/myCalendar deleted file mode 100755 index d1557ba..0000000 --- a/.config/i3blocks/scripts/myCalendar +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# this is a simple bash script / blocklet for i3blocks -# that will open a new termite instance with 'cal' when clicked - -datefmt='+%a %Y-%m-%d %H:%M:%S' - -while getopts "f:" opt; do - case $opt in - f) datefmt="$OPTARG" ;; - esac -done - -case "$BLOCK_BUTTON" in 1|2|3) - exec termite -e "bash -c 'cal -Y'" --hold & disown -esac - -date "$datefmt" diff --git a/.config/i3blocks/scripts/old_brightness.py b/.config/i3blocks/scripts/old_brightness.py deleted file mode 100755 index 993856e..0000000 --- a/.config/i3blocks/scripts/old_brightness.py +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/python3 - -backlight_dir = '/sys/class/backlight/intel_backlight/' - -brightness_file = 'brightness' -max_brightness_file = 'max_brightness' - -brightness = int(open(backlight_dir + brightness_file).read()) -max_brightness = int(open(backlight_dir + max_brightness_file).read()) - -ratio = (brightness / max_brightness) -percent = ratio * 100 - -round_percent = percent + 2.5 -round_percent = round_percent - round_percent%5 - -print("{}%".format(round(round_percent))) diff --git a/.config/i3blocks/scripts/rofi-calendar b/.config/i3blocks/scripts/rofi-calendar deleted file mode 100755 index e1f12d0..0000000 --- a/.config/i3blocks/scripts/rofi-calendar +++ /dev/null @@ -1,28 +0,0 @@ -#! /bin/sh - -blockdate=$(date '+%a. %d. %b. %Y') - -case "$BLOCK_BUTTON" in - 1|2|3) date=$(date '+%A, %d. %B') -export TERM=xterm -cal --color=always \ - | sed 's/\x1b\[[7;]*m/\<b\>\<u\>/g' \ - | sed 's/\x1b\[[27;]*m/\<\/u\>\<\/b\>/g' \ - | tail -n +2 \ - | rofi \ - -dmenu \ - -markup-rows \ - -no-fullscreen \ - -font "Monospace 6" \ - -hide-scrollbar \ - -bw 2 \ - -m -3 \ - -theme-str '#window {anchor:northeast; location: southeast;}' \ - -eh 1 \ - -width -22 \ - -no-custom \ - -no-config \ - -p "$date" > /dev/null - esac -echo $blockdate -date '+%d.%m.%Y' diff --git a/.config/i3blocks/scripts/temperature b/.config/i3blocks/scripts/temperature deleted file mode 100755 index 2170f10..0000000 --- a/.config/i3blocks/scripts/temperature +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env perl -# Copyright 2014 Pierre Mavro <deimos@deimos.fr> -# Copyright 2014 Vivien Didelot <vivien@didelot.org> -# Copyright 2014 Andreas Guldstrand <andreas.guldstrand@gmail.com> -# Copyright 2014 Benjamin Chretien <chretien at lirmm dot fr> - -# 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 strict; -use warnings; -use utf8; -use Getopt::Long; - -binmode(STDOUT, ":utf8"); - -# default values -my $t_warn = $ENV{T_WARN} || 70; -my $t_crit = $ENV{T_CRIT} || 90; -my $chip = $ENV{SENSOR_CHIP} || ""; -my $temperature = -9999; - -sub help { - print "Usage: temperature [-w <warning>] [-c <critical>] [--chip <chip>]\n"; - print "-w <percent>: warning threshold to become yellow\n"; - print "-c <percent>: critical threshold to become red\n"; - print "--chip <chip>: sensor chip\n"; - exit 0; -} - -GetOptions("help|h" => \&help, - "w=i" => \$t_warn, - "c=i" => \$t_crit, - "chip=s" => \$chip); - -# Get chip temperature -open (SENSORS, "sensors -u $chip |") or die; -while (<SENSORS>) { - if (/^\s+temp1_input:\s+[\+]*([\-]*\d+\.\d)/) { - $temperature = $1; - last; - } -} -close(SENSORS); - -$temperature eq -9999 and die 'Cannot find temperature'; - -# Print short_text, full_text -print "$temperature°C\n" x2; - -# Print color, if needed -if ($temperature >= $t_crit) { - print "#FF0000\n"; - exit 33; -} elsif ($temperature >= $t_warn) { - print "#FFFC00\n"; -} - -exit 0; diff --git a/.config/i3blocks/scripts/volume b/.config/i3blocks/scripts/volume deleted file mode 100755 index 6e0c4fe..0000000 --- a/.config/i3blocks/scripts/volume +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env 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, eventually 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 -if [[ -z "$MIXER" ]] ; then - MIXER="default" - if command -v pulseaudio >/dev/null 2>&1 && pulseaudio --check ; then - # pulseaudio is running, but not all installations use "pulse" - if amixer -D pulse info >/dev/null 2>&1 ; then - MIXER="pulse" - fi - fi - [ -n "$(lsmod | grep jack)" ] && MIXER="jackplug" - MIXER="${2:-$MIXER}" -fi - -# 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` -if [[ -z "$SCONTROL" ]] ; then - SCONTROL="${BLOCK_INSTANCE:-$(amixer -D $MIXER scontrols | - sed -n "s/Simple mixer control '\([^']*\)',0/\1/p" | - head -n1 - )}" -fi - -# 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) -if [[ -z "$STEP" ]] ; then - STEP="${1:-5%}" -fi - -#------------------------------------------------------------------------ - -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}' - output=$(perl -ne "$perl_filter") - echo "$LABEL$output" -} - -#------------------------------------------------------------------------ - -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 diff --git a/.config/i3blocks/scripts/wifi b/.config/i3blocks/scripts/wifi deleted file mode 100755 index 34b6348..0000000 --- a/.config/i3blocks/scripts/wifi +++ /dev/null @@ -1,53 +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/>. - -#------------------------------------------------------------------------ -if [[ -z "$INTERFACE" ]] ; then - INTERFACE="${BLOCK_INSTANCE:-wlan0}" -fi -#------------------------------------------------------------------------ - -# 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 ]] && exit - -# If the wifi interface exists but no connection is active, "down" shall be displayed. -if [[ "$(cat /sys/class/net/$INTERFACE/operstate)" = 'down' ]]; then - echo "down" - echo "down" - echo "#FF0000" - exit -fi - -#------------------------------------------------------------------------ - -QUALITY=$(grep $INTERFACE /proc/net/wireless | awk '{ print int($3 * 100 / 70) }') - -#------------------------------------------------------------------------ - -echo $QUALITY% # full text -echo $QUALITY% # short text - -# color -if [[ $QUALITY -ge 80 ]]; then - echo "#00FF00" -elif [[ $QUALITY -ge 60 ]]; then - echo "#FFF600" -elif [[ $QUALITY -ge 40 ]]; then - echo "#FFAE00" -else - echo "#FF0000" -fi |
