From f837a322099e7fe5dce6760d760152b10313411f Mon Sep 17 00:00:00 2001 From: ObeseTermite Date: Mon, 5 May 2025 19:00:21 -0700 Subject: [PATCH] Added i3blocks, and a bunch of scripts for modules --- bin/battery | 106 ++++ bin/cpu_usage | 66 +++ bin/memory | 73 +++ bin/wifi | 1178 +++++++++++++++++++++++++++++++++++++++++++ i3blocks | 31 ++ i3config | 2 +- install | 3 + installpackages.txt | 4 + tags | 54 ++ 9 files changed, 1516 insertions(+), 1 deletion(-) create mode 100755 bin/battery create mode 100755 bin/cpu_usage create mode 100755 bin/memory create mode 100755 bin/wifi create mode 100644 i3blocks diff --git a/bin/battery b/bin/battery new file mode 100755 index 0000000..4898d3c --- /dev/null +++ b/bin/battery @@ -0,0 +1,106 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2016 James Murphy +# Licensed under the GPL version 2 only +# +# A battery indicator blocklet script for i3blocks + +from subprocess import check_output +import os +import re + +config = dict(os.environ) +status = check_output(['acpi'], universal_newlines=True) + +if not status: + # stands for no battery found + color = config.get("color_10", "red") + fulltext = "\uf00d \uf240".format(color) + percentleft = 100 +else: + # if there is more than one battery in one laptop, the percentage left is + # available for each battery separately, although state and remaining + # time for overall block is shown in the status of the first battery + batteries = status.split("\n") + state_batteries=[] + commasplitstatus_batteries=[] + percentleft_batteries=[] + time = "" + for battery in batteries: + if battery!='': + state_batteries.append(battery.split(": ")[1].split(", ")[0]) + commasplitstatus = battery.split(", ") + if not time: + time = commasplitstatus[-1].strip() + # check if it matches a time + time = re.match(r"(\d+):(\d+)", time) + if time: + time = ":".join(time.groups()) + timeleft = " ({})".format(time) + else: + timeleft = "" + + p = int(commasplitstatus[1].rstrip("%\n")) + if p>0: + percentleft_batteries.append(p) + commasplitstatus_batteries.append(commasplitstatus) + state = state_batteries[0] + commasplitstatus = commasplitstatus_batteries[0] + if percentleft_batteries: + percentleft = int(sum(percentleft_batteries)/len(percentleft_batteries)) + else: + percentleft = 0 + + # stands for charging + color = config.get("color_charging", "yellow") + FA_LIGHTNING = "\uf0e7".format(color) + + # stands for plugged in + FA_PLUG = "\uf1e6" + + # stands for using battery + FA_BATTERY = "\uf240" + + # stands for unknown status of battery + FA_QUESTION = "\uf128" + + + if state == "Discharging": + fulltext = FA_BATTERY + " " + elif state == "Full": + fulltext = FA_PLUG + " " + timeleft = "" + elif state == "Unknown": + fulltext = FA_QUESTION + " " + FA_BATTERY + " " + timeleft = "" + else: + fulltext = FA_LIGHTNING + " " + FA_PLUG + " " + + def color(percent): + if percent < 10: + # exit code 33 will turn background red + return config.get("color_10", "#FFFFFF") + if percent < 20: + return config.get("color_20", "#FF3300") + if percent < 30: + return config.get("color_30", "#FF6600") + if percent < 40: + return config.get("color_40", "#FF9900") + if percent < 50: + return config.get("color_50", "#FFCC00") + if percent < 60: + return config.get("color_60", "#FFFF00") + if percent < 70: + return config.get("color_70", "#FFFF33") + if percent < 80: + return config.get("color_80", "#FFFF66") + return config.get("color_full", "#FFFFFF") + + form = '{}%' + fulltext += form.format(color(percentleft), percentleft) + fulltext += timeleft + +print(fulltext) +print(fulltext) +if percentleft < 10: + exit(33) diff --git a/bin/cpu_usage b/bin/cpu_usage new file mode 100755 index 0000000..b298a97 --- /dev/null +++ b/bin/cpu_usage @@ -0,0 +1,66 @@ +#!/usr/bin/env perl +# +# Copyright 2014 Pierre Mavro +# Copyright 2014 Vivien Didelot +# Copyright 2014 Andreas Guldstrand +# +# 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} // ""; +my $color_normal = $ENV{COLOR_NORMAL} // "#EBDBB2"; +my $color_warn = $ENV{COLOR_WARN} // "#FFFC00"; +my $color_crit = $ENV{COLOR_CRIT} // "#FF0000"; + +sub help { + print "Usage: cpu_usage [-w ] [-c ] [-d ]\n"; + print "-w : warning threshold to become yellow\n"; + print "-c : critical threshold to become red\n"; + print "-d : Use 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 () { + 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 "${color_crit}\n"; +} elsif ($cpu_usage >= $t_warn) { + print "${color_warn}\n"; +} else { + print "${color_normal}\n"; +} + +exit 0; diff --git a/bin/memory b/bin/memory new file mode 100755 index 0000000..fd814e0 --- /dev/null +++ b/bin/memory @@ -0,0 +1,73 @@ +#!/usr/bin/env sh +# Copyright (C) 2014 Julien Bonjean + +# 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 . + +TYPE="${BLOCK_INSTANCE:-mem}" +PERCENT="${PERCENT:-true}" + +awk -v type=$TYPE -v percent=$PERCENT ' +/^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 + if (percent == "true" ) { + printf("%.1fG/%.1fG (%.f%%)\n", used, total, pct) + } else { + printf("%.1fG/%.1fG\n", used, total) + } + # 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/bin/wifi b/bin/wifi new file mode 100755 index 0000000..1a7a191 --- /dev/null +++ b/bin/wifi @@ -0,0 +1,1178 @@ +#!/usr/bin/env bash + +PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:${PATH}" + +################################################################################ +# +# CUSTOM PLUGIN SECTION +# +################################################################################ + +############################################################ +# Variables +############################################################ + +### +### Custom Defines +### +appname="wifi" + +if [ -n "${BLOCK_INSTANCE:-}" ]; then + iface="${BLOCK_INSTANCE}" +else + iface="$( tail -1 /proc/net/wireless | awk '{print $1}' | sed 's/://g' )" +fi + +format=" {status_or_ip} ({ssid} {quality}%)" + + +### +### Thresholds +### + +# Enable +has_threshold=1 + +# Depending on the conditions in your custom_action() +# you can force the output to be critical or warning +# Set these vars to 1 (in custom_action) +force_crit=0 +force_warn=0 +force_good=0 + + +### +### Additional arguments +### +arg_params=( + "-i" +) +arg_vars=( + "iface" +) +arg_desc_val=( + "" +) +arg_desc_long=( + "Specify the network interface" +) + + +### +### Format placeholders +### + +# bash variable names +format_vars=( + "ip" + "ip_nm" + "ip6" + "ip6_nm" + "mac" + "mtu" + "iface" + "status" + "status_or_ip" + "status_or_ip6" + "ssid" + "freq" + "freq_unit" + "tx_power" + "tx_power_unit" + "quality" + "signal" + "signal_unit" + "noise" + "bit_rate" + "bit_rate_unit" +) + +# Format placeholders +format_nodes=( + "{ip}" + "{ip_nm}" + "{ip6}" + "{ip6_nm}" + "{mac}" + "{mtu}" + "{iface}" + "{status}" + "{status_or_ip}" + "{status_or_ip6}" + "{ssid}" + "{freq}" + "{freq_unit}" + "{tx_power}" + "{tx_power_unit}" + "{quality}" + "{signal}" + "{signal_unit}" + "{noise}" + "{bit_rate}" + "{bit_rate_unit}" +) + +# Format description (for help display) +format_descs=( + "IPv4 address" + "IPv4 address including netmask" + "IPv6 address" + "IPv6 address including netmask" + "MAC address" + "MTU value" + "Network interface" + "Status (up, down, unknown, absent)" + "Status text if not up or IPv4 address" + "Status text if not up or IPv6 address" + "Wireless Network SSID name" + "Wireless frequency" + "Wireless requency unit" + "Wireless tx power" + "Wireless tx power unit" + "Wireless quality in percent" + "Wireless signal" + "Wireless signal unit" + "Wireless noise" + "Bit Rate" + "Bit Rate unit" +) + +# Format examples (for help display) +format_examples=( + "-f \" {status}: {ip} {ssid}\"" + "-f \" {iface}: {status_or_ip6} {quality}\"" +) + + +############################################################ +# custom_actio function +############################################################ + +### +### Evaluate disk space +### +custom_action() { + if ! command -v ip > /dev/null 2>&1; then + echo "Error, ip binary not found, but required" + exit 1 + fi + if ! command -v iwconfig > /dev/null 2>&1; then + echo "Error, iwconfig binary not found, but required" + exit 1 + fi + + local _ip + local _iwconfig + + ip= + ip_nm= + ip6= + ip6_nm= + mac= + mtu= + status="unknown" + status_or_ip="${status}" + status_or_ip6="${status}" + + ssid= + freq= + freq_unit= + tx_power= + tx_power_unit= + quality= + signal= + signal_unit= + noise= + bit_rate= + bit_rate_unit= + + if [ ! -d "/sys/class/net/${iface}/" ] || [ ! -f "/sys/class/net/${iface}/operstate" ]; then + + status="absent" + status_or_ip="${status}" + status_or_ip6="${status}" + force_crit=1 + + else + + _ip="$( ip addr show "${iface}" 2>/dev/null )" + + # No WIFI device + if ! _iwconfig="$( iwconfig "${iface}" 2>/dev/null )"; then + status="absent" + status_or_ip="${status}" + status_or_ip6="${status}" + force_crit=1 + + # WIFI device + else + # Has WIFI, but is Not connected + if echo "${_iwconfig}" | grep -iq 'Not-Associated'; then + status="down" + status_or_ip="${status}" + status_or_ip6="${status}" + force_crit=1 + + # Has WIFI and is connected + else + ip="$( echo "${_ip}" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -1 )" + ip_nm="$( echo "${_ip}" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/[0-9]+' | head -1 )" + ip6="$( echo "${_ip}" | grep -oE 'inet6' | grep -oE '[0-9a-fA-F]*::.*/[0-9]+' | sed 's/\/.*//g' )" + ip6_nm="$( echo "${_ip}" | grep -oE 'inet6' | grep -oE '[0-9a-fA-F]*::.*/[0-9]+' || true)" + mac="$( echo "${_ip}" | grep 'link/' | grep -oE '([0-9a-fA-F]{2}:)+[0-9a-fA-F]{2}' | head -1 )" + mtu="$( echo "${_ip}" | grep -oE 'mtu\s*[0-9]+' | sed 's/mtu\s//g' )" + + status="up" + status_or_ip="${ip}" + status_or_ip6="${ip6}" + + ssid="$( echo "${_iwconfig}" | grep -oE 'ESSID:".*"' | sed 's/ESSID://g' | sed 's/"//g' )" + freq="$( echo "${_iwconfig}" | grep -ioE 'Frequency:[.0-9]+' | grep -oE '[.0-9]+' )" + freq_unit="Ghz" + tx_power="$( echo "${_iwconfig}" | grep -oE 'Tx-Power=[0-9]+' | sed 's/.*=//g' )" + tx_power_unit="dBm" + quality="$( awk -v cur="$(echo "${_iwconfig}"|grep -oE 'Link Quality=[/0-9]+'|grep -oE '[0-9]+'|head -1)" -v max="$(echo "${_iwconfig}"|grep -oE 'Link Quality=[/0-9]+'|grep -oE '[0-9]+'|tail -1)" 'BEGIN{printf("%0.f", cur*100/max)}')" + signal="$( echo "${_iwconfig}" | grep -ioE 'Signal level=[-0-9]+' | sed 's/.*=//g' )" + signal_unit="dBm" + noise="$( grep "${iface}" /proc/net/wireless | awk '{print $5}' )" + bit_rate="$( echo "${_iwconfig}" | grep -ioE 'Bit Rate=[0-9\.]+' | sed 's/.*=//g' | awk '{printf "%.0f", $1}' )" + bit_rate_unit="$( echo "${_iwconfig}" | grep -ioE 'Bit Rate=[0-9\.]+ [A-Z/]+' | sed 's/.*=//g' | grep -ioE '[A-Z/]+' )" + + force_good=1 + + fi + fi + fi +} + + + + +### +### +### +### D O N O T E D I T A F T E R H E R E +### +### +### + + + +################################################################################ +# +# BUILT-IN VARIABLES +# +################################################################################ + +### +### General default values +### +color_def="#666666" # gray +color_good="#88b090" # green +color_warn="#ccdc90" # yellow +color_crit="#e89393" # red +color_info="#fce94f" # bright yellow + +### +### Extended format arrays +### +fe_placeholder=() +fe_sign=() +fe_value=() +fe_format=() + + +### +### Threshold arrays +### +tg_placeholder=() +tg_sign=() +tg_value=() + +ti_placeholder=() +ti_sign=() +ti_value=() + +tw_placeholder=() +tw_sign=() +tw_value=() + +tc_placeholder=() +tc_sign=() +tc_value=() + + +### +### Use of pango markup? +### +pango=1 + + +### +### source configuration file if it exists +### +if [ -f "${HOME}/.config/i3blocks-modules/conf" ]; then + # shellcheck disable=SC1090 + . "${HOME}/.config/i3blocks-modules/conf" +fi + + +### +### i3blocks vars info +### https://vivien.github.io/i3blocks/ +### +# name= ${BLOCK_NAME} +# instace= ${BLOCK_INSTANCE} +# button= ${BLOCK_BUTTON} +# x-coor ${BLOCK_X} +# y-coor ${BLOCK_Y} + + +################################################################################ +# +# BUILT-IN FUNCTIONS +# +################################################################################ + +### +### System functions +### +print_usage() { + custom_args="" + + # program specific arguments + for (( i=0; i<${#arg_params[@]}; i++ )); do + custom_args="${custom_args}[${arg_params[$i]} ${arg_desc_val[$i]}] " + done + + # Show/Hide threshold + if [ "${has_threshold}" = "1" ]; then + custom_args="${custom_args}[-tg|-ti|-tw|-tc

] " + fi + + echo "Usage: ${appname} [-f ] [-fe

] ${custom_args}[-np] [-cd|-cg|-cw|-cc|-ci ]" + echo " ${appname} -h" + echo " ${appname} -v" + echo + + if [ "${#custom_args}" -gt "0" ]; then + echo "Optional variables:" + echo "--------------------------------------------------------------------------------" + + for (( i=0; i<${#arg_params[@]}; i++ )); do + printf " %-13s%s\\n" "${arg_params[$i]} ${arg_desc_val[$i]}" "${arg_desc_long[$i]}" + done + echo + fi + + if [ "${has_threshold}" = "1" ]; then + echo "Optional threshold arguments:" + echo "--------------------------------------------------------------------------------" + echo "You can optionally enable threshold checking against any placeholder value." + echo "This enables the colorizing of the final output depending on any met" + echo "conditions specified." + echo "Default is not to use any threshold" + echo "You can use unlimited number of threshold for each type." + echo + + echo " -tg

Enable threshold for 'good status'" + echo " -ti

Enable threshold for 'info status'" + echo " -tw

Enable threshold for 'warn status'" + echo " -tc

Enable threshold for 'crit status'" + echo + echo " Explanation:" + echo "

is the placeholder value you want to check against." + printf " valid placeholders: " + for (( i=0; i<${#format_nodes[@]}; i++ )); do + printf "%s" "${format_nodes[$i]} " + done + printf "\\n" + echo " Note 1: placeholder values will be converted to integers" + echo " Any decimal places will simply be cut off." + echo " Note 2: In equal mode ( '=') is a string regex comparison and" + echo " no placeholder will be converted." + echo " Note 3: In unequal mode ( '!=') is a string comparison and" + echo " no placeholder will be converted." + echo " Note 3: In equal mode ( '=') regex is allowed :-)" + echo " must either be '<', '>', '=' or '!=' depending on what direction" + echo " you want to check the threshold placeholder against." + echo " The integer number you want to check against the placeholder." + echo " The string you want to check against the placeholder." + echo " You can only use a string when in equal mode '='." + echo " You can also use regex here." + echo + echo " Examples:" + echo " 1. Check if value of ${format_nodes[0]} < 50, then format using the good color" + echo " -tg '${format_nodes[0]}' '<' 50" + echo + echo " 2. Check if value of ${format_nodes[0]} > 90, then format using the warn color" + echo " -tw '${format_nodes[0]}' '>' 90" + echo + echo " 3. Check if value of ${format_nodes[0]} equals the string 'foo', then format using the info color" + echo " -ti '${format_nodes[0]}' '=' 'foo'" + echo + echo " 4. Check if value of ${format_nodes[0]} equals the regex '^[0-9]+\$', then format using the info color" + echo " -ti '${format_nodes[0]}' '=' '^[0-9]+\$'" + echo + fi + + echo "Optional markup (pango):" + echo "--------------------------------------------------------------------------------" + echo " -np Disable pango markup" + echo + + echo "Optional color arguments:" + echo "--------------------------------------------------------------------------------" + echo "If not specified, script default colors are used" + echo "If config file with color codes is present in:" + echo "'${HOME}/.config/i3blocks-modules/conf', these colors will be used." + echo + echo " -cd Default color (hexadecimal color code)" + echo " Default value is: ${color_def}" + echo " -cg Good color (hexadecimal color code)" + echo " Default value is: ${color_good}" + echo " -cw Warning color (hexadecimal color code)" + echo " Default value is: ${color_warn}" + echo " -cc Critical color (hexadecimal color code)" + echo " Default value is: ${color_crit}" + echo " -ci Info color (hexadecimal color code)" + echo " Default value is: ${color_info}" + echo + + echo "Optional Format placeholders:" + echo "--------------------------------------------------------------------------------" + echo " Available color placeholders:" + echo " (Use with pango disabled for custom markup) building" + echo " {color} Current active color depending on thresholds" + echo " {color_def} Default color" + echo " {color_good} Good color" + echo " {color_warn} Warning color" + echo " {color_crit} Critical color" + echo " {color_info} Info color" + echo " Format example:" + echo " -np -f \"Colored text\"" + echo + + echo " Available specific placeholders:" + for (( i=0; i<${#format_nodes[@]}; i++ )); do + printf " %-15s%s\\n" "${format_nodes[$i]}" "${format_descs[$i]}" + done + + echo " Format example:" + for (( i=0; i<${#format_examples[@]}; i++ )); do + printf " %s\\n" "${format_examples[$i]}" + done + echo " Default:" + echo " -f \"${format}\"" + echo + + echo "Optional extended Format output:" + echo "--------------------------------------------------------------------------------" + echo "You can conditionally set your output text depending on the value of any placeholder." + echo "For example, If you have a placeholder {status} that either is 'up' or 'down', you" + echo "can specify different outputs for 'up' and for 'down'." + echo "Usage" + echo " -fe

" + echo + echo " Format example:" + echo " -fe '{status}' '=' 'up' 'It works ;-)' -fe '{status}' '!=' 'up' 'status is: {status}'" + echo " Explanation:" + echo "

is the placeholder value you want to check against." + printf " valid placeholders: " + for (( i=0; i<${#format_nodes[@]}; i++ )); do + printf "%s" "${format_nodes[$i]} " + done + printf "\\n" + echo " Note 1: placeholder values will be converted to integers" + echo " Any decimal places will simply be cut off." + echo " Note 2: In equal mode ( '=') is a string regex comparison and" + echo " no placeholder will be converted." + echo " Note 3: In unequal mode ( '!=') is a string comparison and" + echo " no placeholder will be converted." + echo " Note 3: In equal mode ( '=') regex is allowed :-)" + echo " must either be '<', '>', '=' or '!=' depending on what direction" + echo " you want to check the threshold placeholder against." + echo " The integer number you want to check against the placeholder." + echo " The string you want to check against the placeholder." + echo " You can only use a string when in equal mode '='." + echo " You can also use regex here." + echo " Is the format string that should be displayed under the above condition." + echo " Of course you can also use placeholders here ;-)." +} + +print_version() { + echo "${appname} v1.8 by cytopia" + echo "https://github.com/cytopia/i3blocks-modules" +} + +### +### Decide about final output color color +### +get_status_color() { + local _color_def="${1}" + local _color_good="${2}" + local _color_warn="${3}" + local _color_crit="${4}" + local _color_info="${5}" + + # final color + local _color="${_color_def}" + + local pval + + # has custom critical color? + if [ "${force_crit}" = "1" ]; then + _color="${_color_crit}" + echo "${_color}" + return + fi + # has custom warning color? + if [ "${force_warn}" = "1" ]; then + _color="${_color_warn}" + echo "${_color}" + return + fi + + + # has custom good color? + if [ "${force_good}" = "1" ]; then + _color="${_color_good}" + fi + + # has good color? + for (( i=0; i < ${#tg_placeholder[@]}; i++ )); do + + if [ "${tg_sign[$i]}" = "=" ] || [ "${tg_sign[$i]}" = "!=" ]; then + pval="${!tg_placeholder[$i]}" + else + pval="$( echo "${!tg_placeholder[$i]}" | grep -oE '[0-9]*' | head -1 )" + fi + + if [ "${tg_sign[$i]}" = "<" ]; then + if [ "${pval}" -lt "${tg_value[$i]}" ]; then + _color="${_color_good}" + fi + elif [ "${tg_sign[$i]}" = "=" ]; then + if [[ "${pval}" =~ ${tg_value[$i]} ]]; then + _color="${_color_good}" + fi + elif [ "${tg_sign[$i]}" = "!=" ]; then + if [[ "${pval}" != "${tg_value[$i]}" ]]; then + _color="${_color_good}" + fi + elif [ "${tg_sign[$i]}" = ">" ]; then + if [ "${pval}" -gt "${tg_value[$i]}" ]; then + _color="${_color_good}" + fi + fi + done + # has info color? + for (( i=0; i < ${#ti_placeholder[@]}; i++ )); do + + if [ "${ti_sign[$i]}" = "=" ] || [ "${ti_sign[$i]}" = "!=" ]; then + pval="${!ti_placeholder[$i]}" + else + pval="$( echo "${!ti_placeholder[$i]}" | grep -oE '[0-9]*' | head -1 )" + fi + + if [ "${ti_sign[$i]}" = "<" ]; then + if [ "${pval}" -lt "${ti_value[$i]}" ]; then + _color="${_color_info}" + fi + elif [ "${ti_sign[$i]}" = "=" ]; then + if [[ "${pval}" =~ ${ti_value[$i]} ]]; then + _color="${_color_info}" + fi + elif [ "${ti_sign[$i]}" = "!=" ]; then + if [[ "${pval}" != "${ti_value[$i]}" ]]; then + _color="${_color_info}" + fi + elif [ "${ti_sign[$i]}" = ">" ]; then + if [ "${pval}" -gt "${ti_value[$i]}" ]; then + _color="${_color_info}" + fi + fi + done + # has warning color? + for (( i=0; i < ${#tw_placeholder[@]}; i++ )); do + + if [ "${tw_sign[$i]}" = "=" ] || [ "${tw_sign[$i]}" = "!=" ]; then + pval="${!tw_placeholder[$i]}" + else + pval="$( echo "${!tw_placeholder[$i]}" | grep -oE '[0-9]*' | head -1 )" + fi + + if [ "${tw_sign[$i]}" = "<" ]; then + if [ "${pval}" -lt "${tw_value[$i]}" ]; then + _color="${color_warn}" + fi + elif [ "${tw_sign[$i]}" = "=" ]; then + if [[ "${pval}" =~ ${tw_value[$i]} ]]; then + _color="${_color_warn}" + fi + elif [ "${tw_sign[$i]}" = "!=" ]; then + if [[ "${pval}" != "${tw_value[$i]}" ]]; then + _color="${_color_warn}" + fi + elif [ "${tw_sign[$i]}" = ">" ]; then + if [ "${pval}" -gt "${tw_value[$i]}" ]; then + _color="${_color_warn}" + fi + fi + done + + + # has critical color? + for (( i=0; i < ${#tc_placeholder[@]}; i++ )); do + + if [ "${tc_sign[$i]}" = "=" ] || [ "${tc_sign[$i]}" = "!=" ]; then + pval="${!tc_placeholder[$i]}" + else + pval="$( echo "${!tc_placeholder[$i]}" | grep -oE '[0-9]*' | head -1 )" + fi + + if [ "${tc_sign[$i]}" = "<" ]; then + if [ "${pval}" -lt "${tc_value[$i]}" ]; then + _color="${_color_crit}" + fi + elif [ "${tc_sign[$i]}" = "=" ]; then + if [[ "${pval}" =~ ${tc_value[$i]} ]]; then + _color="${_color_crit}" + fi + elif [ "${tc_sign[$i]}" = "!=" ]; then + if [[ "${pval}" != "${tc_value[$i]}" ]]; then + _color="${_color_crit}" + fi + elif [ "${tc_sign[$i]}" = ">" ]; then + if [ "${pval}" -gt "${tc_value[$i]}" ]; then + _color="${_color_crit}" + fi + fi + done + + + echo "${_color}" +} + + +### +### Replace custom stuff in format string +### +replace_placeholders() { + local _format="${1}" + local _search + local _replace + + # Select format based on extended placeholders + for (( i=0; i < ${#fe_placeholder[@]}; i++ )); do + + if [ "${fe_sign[$i]}" = "=" ] || [ "${fe_sign[$i]}" = "!=" ]; then + pval="${!fe_placeholder[$i]}" + else + pval="$( echo "${!fe_placeholder[$i]}" | grep -oE '[0-9]*' | head -1 )" + fi + + if [ "${fe_sign[$i]}" = "<" ]; then + if [ "${pval}" -lt "${fe_value[$i]}" ]; then + _format="${fe_format[$i]}" + fi + elif [ "${fe_sign[$i]}" = "=" ]; then + if [[ "${pval}" =~ ${fe_value[$i]} ]]; then + _format="${fe_format[$i]}" + fi + elif [ "${fe_sign[$i]}" = "!=" ]; then + if [[ "${pval}" != "${fe_value[$i]}" ]]; then + _format="${fe_format[$i]}" + fi + elif [ "${fe_sign[$i]}" = ">" ]; then + if [ "${pval}" -gt "${fe_value[$i]}" ]; then + _format="${fe_format[$i]}" + fi + fi + done + + + + # Replace placeholders in $format + for (( i=0; i < ${#format_nodes[@]}; i++ )); do + _search="${format_nodes[$i]}" + _replace="${!format_vars[$i]}" + _format="${_format/${_search}/${_replace}}" + done + echo "${_format}" +} + + +### +### Replace colors in format string +### +replace_colors() { + local _format="${1}" + local _color="${2}" + local _color_def="${3}" + local _color_good="${4}" + local _color_warn="${5}" + local _color_crit="${6}" + local _color_info="${7}" + + _format="${_format/'{color}'/${_color}}" + _format="${_format/'{color_def}'/${_color_def}}" + _format="${_format/'{color_good}'/${_color_good}}" + _format="${_format/'{color_warn}'/${_color_warn}}" + _format="${_format/'{color_crit}'/${_color_crit}}" + _format="${_format/'{color_info}'/${_color_info}}" + + echo "${_format}" +} + + + +################################################################################ +# +# MAIN ENTRY POINT +# +################################################################################ + +# Enable/Disable threshold argument +if [ "${has_threshold}" = "1" ]; then + th_chk="" +else + th_chk="__THRESHOLD_DISABLED__" +fi + + +while [ $# -gt 0 ]; do + case "$1" in + ### + ### Extended formats + ### + -fe) + # 1/4 Check placeholder + shift + if [ "${1}" = "" ]; then + echo "Error, -fe

- no placeholder specified." + echo "Type ${appname} -h for help" + exit 1 + fi + f=0 + for (( i=0; i < ${#format_nodes[@]}; i++ )); do + if [ "${format_nodes[$i]}" = "${1}" ]; then + f=1 + break + fi + done + if [ "${f}" = "0" ]; then + echo "Error, -fe '${1}' no such placeholder." + echo "Type ${appname} -h for help" + exit 1 + fi + fe_placeholder+=("${format_vars[$i]}") + + # 2/4 Check sign + shift + if [ "${1}" = "" ]; then + echo "Error, -fe '{${fe_placeholder[${#fe_placeholder[@]}-1]}}' '${1}' - sign argyment is empty." + echo "Type ${appname} -h for help" + exit 1 + fi + if [ "${1}" != "<" ] && [ "${1}" != ">" ] && [ "${1}" != "=" ] && [ "${1}" != "!=" ]; then + echo "Error, -fe '{${fe_placeholder[${#fe_placeholder[@]}-1]}}' '${1}' - invalid sign: '${1}'." + echo "Type ${appname} -h for help" + exit 1 + fi + fe_sign+=("${1}") + + # 3/4 Check value + shift + if [ "${1}" = "" ]; then + echo "Error, -fe '{${fe_placeholder[${#fe_placeholder[@]}-1]}}' '${fe_sign[${#fe_sign[@]}-1]}' '${1}' - value argument is empty." + echo "Type ${appname} -h for help" + exit 1 + fi + if [ "${fe_sign[${#fe_sign[@]}-1]}" = ">" ] || [ "${fe_sign[${#fe_sign[@]}-1]}" = "<" ]; then + if ! printf "%d" "${1}" >/dev/null 2>&1; then + echo "Error, -fe '{${fe_placeholder[${#fe_placeholder[@]}-1]}}' '${fe_sign[${#fe_sign[@]}-1]}' '${1}' - value argument is not a number." + echo "Type ${appname} -h for help" + exit 1 + fi + fi + fe_value+=("${1}") + + # 4/4 Check placeholder string + shift + fe_format+=("${1}") + ;; + ### + ### Threshold good + ### + "-tg${th_chk}") + # 1/3 Check placeholder + shift + if [ "${1}" = "" ]; then + echo "Error, -tg

- no placeholder specified." + echo "Type ${appname} -h for help" + exit 1 + fi + f=0 + for (( i=0; i < ${#format_nodes[@]}; i++ )); do + if [ "${format_nodes[$i]}" = "${1}" ]; then + f=1 + break + fi + done + if [ "${f}" = "0" ]; then + echo "Error, -tg '${1}' no such placeholder." + echo "Type ${appname} -h for help" + exit 1 + fi + tg_placeholder+=("${format_vars[$i]}") + + # 2/3 Check sign + shift + if [ "${1}" = "" ]; then + echo "Error, -tg '{${tg_placeholder[${#tg_placeholder[@]}-1]}}' '${1}' - sign argument is empty." + echo "Type ${appname} -h for help" + exit 1 + fi + if [ "${1}" != "<" ] && [ "${1}" != ">" ] && [ "${1}" != "=" ] && [ "${1}" != "!=" ]; then + echo "Error, -tg '{${tg_placeholder[${#tg_placeholder[@]}-1]}}' '${1}' - invalid sign: '${1}'." + echo "Type ${appname} -h for help" + exit 1 + fi + tg_sign+=("${1}") + + # 3/3 Check value + shift + if [ "${1}" = "" ]; then + echo "Error, -tg '{${tg_placeholder[${#tg_placeholder[@]}-1]}}' '${tg_sign[${#tg_sign[@]}-1]}' '${1}' - value argyment is empty." + echo "Type ${appname} -h for help" + exit 1 + fi + if [ "${tg_sign[${#tg_sign[@]}-1]}" = ">" ] || [ "${tg_sign[${#tg_sign[@]}-1]}" = "<" ]; then + if ! printf "%d" "${1}" >/dev/null 2>&1; then + echo "Error, -tg '{${tg_placeholder[${#tg_placeholder[@]}-1]}}' '${tg_sign[${#tg_sign[@]}-1]}' '${1}' - value argument is not a number." + echo "Type ${appname} -h for help" + exit 1 + fi + fi + tg_value+=("${1}") + ;; + ### + ### Threshold info + ### + "-ti${th_chk}") + # 1/3 Check placeholder + shift + if [ "${1}" = "" ]; then + echo "Error, -ti

- no placeholder specified." + echo "Type ${appname} -h for help" + exit 1 + fi + f=0 + for (( i=0; i < ${#format_nodes[@]}; i++ )); do + if [ "${format_nodes[$i]}" = "${1}" ]; then + f=1 + break + fi + done + if [ "${f}" = "0" ]; then + echo "Error, -ti '${1}' no such placeholder." + echo "Type ${appname} -h for help" + exit 1 + fi + ti_placeholder+=("${format_vars[$i]}") + + # 2/3 Check sign + shift + if [ "${1}" = "" ]; then + echo "Error, -ti '{${ti_placeholder[${#ti_placeholder[@]}-1]}}' '${1}' - sign argument is empty." + echo "Type ${appname} -h for help" + exit 1 + fi + if [ "${1}" != "<" ] && [ "${1}" != ">" ] && [ "${1}" != "=" ] && [ "${1}" != "!=" ]; then + echo "Error, -ti '{${ti_placeholder[${#ti_placeholder[@]}-1]}}' '${1}' - invalid sign: '${1}'." + echo "Type ${appname} -h for help" + exit 1 + fi + ti_sign+=("${1}") + + # 3/3 Check value + shift + if [ "${1}" = "" ]; then + echo "Error, -ti '{${ti_placeholder[${#ti_placeholder[@]}-1]}}' '${ti_sign[${#ti_sign[@]}-1]}' '${1}' - value argyment is empty." + echo "Type ${appname} -h for help" + exit 1 + fi + if [ "${ti_sign[${#ti_sign[@]}-1]}" = ">" ] || [ "${ti_sign[${#ti_sign[@]}-1]}" = "<" ]; then + if ! printf "%d" "${1}" >/dev/null 2>&1; then + echo "Error, -ti '{${ti_placeholder[${#ti_placeholder[@]}-1]}}' '${ti_sign[${#ti_sign[@]}-1]}' '${1}' - value argument is not a number." + echo "Type ${appname} -h for help" + exit 1 + fi + fi + ti_value+=("${1}") + ;; + ### + ### Threshold warning + ### + "-tw${th_chk}") + # 1/3 Check placeholder + shift + if [ "${1}" = "" ]; then + echo "Error, -tw

- no placeholder specified." + echo "Type ${appname} -h for help" + exit 1 + fi + f=0 + for (( i=0; i < ${#format_nodes[@]}; i++ )); do + if [ "${format_nodes[$i]}" = "${1}" ]; then + f=1 + break + fi + done + if [ "${f}" = "0" ]; then + echo "Error, -tw '${1}' no such placeholder." + echo "Type ${appname} -h for help" + exit 1 + fi + tw_placeholder+=("${format_vars[$i]}") + + # 2/3 Check sign + shift + if [ "${1}" = "" ]; then + echo "Error, -tw '{${tw_placeholder[${#tw_placeholder[@]}-1]}}' '${1}' - sign argument is empty." + echo "Type ${appname} -h for help" + exit 1 + fi + if [ "${1}" != "<" ] && [ "${1}" != ">" ] && [ "${1}" != "=" ] && [ "${1}" != "!=" ]; then + echo "Error, -tw '{${tw_placeholder[${#tw_placeholder[@]}-1]}}' '${1}' - invalid sign: '${1}'." + echo "Type ${appname} -h for help" + exit 1 + fi + tw_sign+=("${1}") + + # 3/3 Check value + shift + if [ "${1}" = "" ]; then + echo "Error, -tw '{${tw_placeholder[${#tw_placeholder[@]}-1]}}' '${tw_sign[${#tw_sign[@]}-1]}' '${1}' - value argyment is empty." + echo "Type ${appname} -h for help" + exit 1 + fi + if [ "${tw_sign[${#tw_sign[@]}-1]}" = ">" ] || [ "${tw_sign[${#tw_sign[@]}-1]}" = "<" ]; then + if ! printf "%d" "${1}" >/dev/null 2>&1; then + echo "Error, -tw '{${tw_placeholder[${#tw_placeholder[@]}-1]}}' '${tw_sign[${#tw_sign[@]}-1]}' '${1}' - value argument is not a number." + echo "Type ${appname} -h for help" + exit 1 + fi + fi + tw_value+=("${1}") + ;; + ### + ### Threshold critical + ### + "-tc${th_chk}") + # 1/3 Check placeholder + shift + if [ "${1}" = "" ]; then + echo "Error, -tc

- no placeholder specified." + echo "Type ${appname} -h for help" + exit 1 + fi + f=0 + for (( i=0; i < ${#format_nodes[@]}; i++ )); do + if [ "${format_nodes[$i]}" = "${1}" ]; then + f=1 + break + fi + done + if [ "${f}" = "0" ]; then + echo "Error, -tc '${1}' no such placeholder." + echo "Type ${appname} -h for help" + exit 1 + fi + tc_placeholder+=("${format_vars[$i]}") + + # 2/3 Check sign + shift + if [ "${1}" = "" ]; then + echo "Error, -tc '{${tc_placeholder[${#tc_placeholder[@]}-1]}}' '${1}' - sign argument is empty." + echo "Type ${appname} -h for help" + exit 1 + fi + if [ "${1}" != "<" ] && [ "${1}" != ">" ] && [ "${1}" != "=" ] && [ "${1}" != "!=" ]; then + echo "Error, -tc '{${tc_placeholder[${#tc_placeholder[@]}-1]}}' '${1}' - invalid sign: '${1}'." + echo "Type ${appname} -h for help" + exit 1 + fi + tc_sign+=("${1}") + + # 3/3 Check value + shift + if [ "${1}" = "" ]; then + echo "Error, -tc '{${tc_placeholder[${#tc_placeholder[@]}-1]}}' '${tc_sign[${#tc_sign[@]}-1]}' '${1}' - value argyment is empty." + echo "Type ${appname} -h for help" + exit 1 + fi + if [ "${tc_sign[${#tc_sign[@]}-1]}" = ">" ] || [ "${tc_sign[${#tc_sign[@]}-1]}" = "<" ]; then + if ! printf "%d" "${1}" >/dev/null 2>&1; then + echo "Error, -tc '{${tc_placeholder[${#tc_placeholder[@]}-1]}}' '${tc_sign[${#tc_sign[@]}-1]}' '${1}' - value argument is not a number." + echo "Type ${appname} -h for help" + exit 1 + fi + fi + tc_value+=("${1}") + ;; + ### + ### Format overwrite + ### + -f) + shift + if [ "${1}" = "" ]; then + echo "Error, -f requires a string" + echo "Type ${appname} -h for help" + exit 1 + fi + format="${1}" + ;; + ### + ### Disable pango markup output + ### + -np) + pango=0 + ;; + ### + ### Color overwrites + ### + -cd) + # default color + shift + if ! echo "${1}" | grep -qE '#[0-9a-fA-F]{6}' >/dev/null 2>&1; then + echo "Error, invalid color string: ${1}" + echo "Type ${appname} -h for help" + exit 1 + fi + color_def="${1}" + ;; + -cg) + # good color + shift + if ! echo "${1}" | grep -qE '#[0-9a-fA-F]{6}' >/dev/null 2>&1; then + echo "Error, invalid color string: ${1}" + echo "Type ${appname} -h for help" + exit 1 + fi + color_good="${1}" + ;; + -cw) + # warning color + shift + if ! echo "${1}" | grep -qE '#[0-9a-fA-F]{6}' >/dev/null 2>&1; then + echo "Error, invalid color string: ${1}" + echo "Type ${appname} -h for help" + exit 1 + fi + color_warn="${1}" + ;; + -cc) + # critical color + shift + if ! echo "${1}" | grep -qE '#[0-9a-fA-F]{6}' >/dev/null 2>&1; then + echo "Error, invalid color string: ${1}" + echo "Type ${appname} -h for help" + exit 1 + fi + color_crit="${1}" + ;; + -ci) + # info color + shift + if ! echo "${1}" | grep -qE '#[0-9a-fA-F]{6}' >/dev/null 2>&1; then + echo "Error, invalid color string: ${1}" + echo "Type ${appname} -h for help" + exit 1 + fi + color_info="${1}" + ;; + ### + ### System options + ### + -h) + print_usage + exit 0 + ;; + -v) + print_version + exit 0 + ;; + ### + ### Unknown/Custom option + ### + *) + + ### + ### Evaluate user-specified arguments + ### + found=0 + if [ "${#arg_params}" -gt "0" ]; then + for (( i=0; i<${#arg_params[@]}; i++ )); do + if [ "${arg_params[$i]}" = "${1}" ]; then + shift + var_name="${arg_vars[$i]}" + eval "${var_name}=\"${1}\"" + found=1 + break; + fi + done + fi + + ### + ### Unknown option + ### + if [ "${found}" = "0" ]; then + echo "Invalid argument: '${1}'" + echo "Type ${appname} -h for help" + exit 1 + fi + ;; + esac + shift +done + + + + +### +### Call custom function +### +custom_action + +### +### Get final output color (based on custom specs) +### +color="$( get_status_color "${color_def}" "${color_good}" "${color_warn}" "${color_crit}" "${color_info}" )" + +### +### Format (colors) +### +format="$( replace_colors "${format}" "${color}" "${color_def}" "${color_good}" "${color_warn}" "${color_crit}" "${color_info}" )" + +### +### Format (custom) +### +format="$( replace_placeholders "${format}" )" + + +### +### Output pango or plain style? +### +if [ "${pango}" = "1" ]; then + if [ "${format}" != "" ]; then + echo "${format}" + fi +else + echo "${format}" # Long output + echo "${format}" # short output + echo "\\${color}" # color code '\#RRGGBB' +fi + +exit 0 diff --git a/i3blocks b/i3blocks new file mode 100644 index 0000000..10c7de0 --- /dev/null +++ b/i3blocks @@ -0,0 +1,31 @@ +[wifi] +command=~/.dotfiles/bin/wifi -np -fe '{status}' '=' 'up' ' {ssid} ({quality}%)' -fe '{status}' '!=' 'up' ' down' +instance=wlan0 +interval=5 + +[battery] +command=~/.dotfiles/bin/battery +markup=pango +interval=30 + +[cpu_usage] +command=~/.dotfiles/bin/cpu_usage +interval=10 +LABEL= +#min_width=CPU: 100.00% +#T_WARN=50 +#T_CRIT=80 +DECIMALS=1 +#COLOR_NORMAL=#EBDBB2 +#COLOR_WARN=#FFFC00 +#COLOR_CRIT=#FF0000 + +[memory] +command=~/.dotfiles/bin/memory +label= +interval=30 + +[time] +command=date "+%Y-%m-%d %R:%S" +label= +interval=5 diff --git a/i3config b/i3config index 9fb4d8e..c7cceb2 100644 --- a/i3config +++ b/i3config @@ -203,7 +203,7 @@ bindsym $mod+r mode "resize" # finds out, if available) bar { - status_command i3status + status_command i3blocks bindsym button1 nop bindsym button4 nop bindsym button5 nop diff --git a/install b/install index 9513d98..2519068 100755 --- a/install +++ b/install @@ -17,6 +17,9 @@ ln -sf ~/.dotfiles/dunstrc ~/.config/dunst/dunstrc mkdir -p ~/.config/alacritty ln -sf ~/.dotfiles/alacritty ~/.config/alacritty/alacritty.toml +mkdir -p ~/.config/i3blocks +ln -sf ~/.dotfiles/i3blocks ~/.config/i3blocks/config + ln -sf ~/.dotfiles/bashrc ~/.bashrc ln -sf ~/.dotfiles/bash_profile ~/.bash_profile ln -sf ~/.dotfiles/xinitrc ~/.xinitrc diff --git a/installpackages.txt b/installpackages.txt index 79db264..bf27f1c 100644 --- a/installpackages.txt +++ b/installpackages.txt @@ -11,3 +11,7 @@ xclip cowsay fortune-mod mpc +i3blocks +acpi +python3 +sysstat diff --git a/tags b/tags index 3226f4e..f7047b0 100644 --- a/tags +++ b/tags @@ -8,10 +8,23 @@ !_TAG_FIELD_DESCRIPTION name /tag name/ !_TAG_FIELD_DESCRIPTION pattern /pattern/ !_TAG_FIELD_DESCRIPTION typeref /Type and name of a variable or typedef/ +!_TAG_FIELD_DESCRIPTION!Python nameref /the original name for the tag/ !_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ !_TAG_KIND_DESCRIPTION!Iniconf k,key /keys/ !_TAG_KIND_DESCRIPTION!Iniconf s,section /sections/ +!_TAG_KIND_DESCRIPTION!Perl c,constant /constants/ +!_TAG_KIND_DESCRIPTION!Perl f,format /formats/ +!_TAG_KIND_DESCRIPTION!Perl l,label /labels/ +!_TAG_KIND_DESCRIPTION!Perl p,package /packages/ +!_TAG_KIND_DESCRIPTION!Perl s,subroutine /subroutines/ +!_TAG_KIND_DESCRIPTION!Python I,namespace /name referring a module defined in other file/ +!_TAG_KIND_DESCRIPTION!Python Y,unknown /name referring a class\/variable\/function\/module defined in other module/ +!_TAG_KIND_DESCRIPTION!Python c,class /classes/ +!_TAG_KIND_DESCRIPTION!Python f,function /functions/ +!_TAG_KIND_DESCRIPTION!Python i,module /modules/ +!_TAG_KIND_DESCRIPTION!Python m,member /class members/ +!_TAG_KIND_DESCRIPTION!Python v,variable /variables/ !_TAG_KIND_DESCRIPTION!Sh a,alias /aliases/ !_TAG_KIND_DESCRIPTION!Sh f,function /functions/ !_TAG_KIND_DESCRIPTION!Sh h,heredoc /label for here document/ @@ -28,6 +41,8 @@ !_TAG_OUTPUT_MODE u-ctags /u-ctags or e-ctags/ !_TAG_OUTPUT_VERSION 0.0 /current.age/ !_TAG_PARSER_VERSION!Iniconf 0.0 /current.age/ +!_TAG_PARSER_VERSION!Perl 0.0 /current.age/ +!_TAG_PARSER_VERSION!Python 0.0 /current.age/ !_TAG_PARSER_VERSION!Sh 0.0 /current.age/ !_TAG_PARSER_VERSION!Vim 0.0 /current.age/ !_TAG_PATTERN_LENGTH_LIMIT 96 /0 for no limit/ @@ -36,12 +51,35 @@ !_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/ !_TAG_PROGRAM_URL https://ctags.io/ /official site/ !_TAG_PROGRAM_VERSION 6.1.0 /v6.1.0/ +!_TAG_ROLE_DESCRIPTION!Python!module imported /imported modules/ +!_TAG_ROLE_DESCRIPTION!Python!module indirectlyImported /module imported in alternative name/ +!_TAG_ROLE_DESCRIPTION!Python!module namespace /namespace from where classes\/variables\/functions are imported/ +!_TAG_ROLE_DESCRIPTION!Python!unknown imported /imported from the other module/ +!_TAG_ROLE_DESCRIPTION!Python!unknown indirectlyImported /classes\/variables\/functions\/modules imported in alternative name/ !_TAG_ROLE_DESCRIPTION!Sh!heredoc endmarker /end marker/ !_TAG_ROLE_DESCRIPTION!Sh!script loaded /loaded/ md vimrc /^nnoremap md :Termdebug$/;" m mm vimrc /^nnoremap mm make$/;" m +FA_BATTERY bin/battery /^ FA_BATTERY = "\\uf240<\/span>"$/;" v +FA_LIGHTNING bin/battery /^ FA_LIGHTNING = "\\uf0e7<\/span><\/span>".format(co/;" v +FA_PLUG bin/battery /^ FA_PLUG = "\\uf1e6<\/span>"$/;" v +FA_QUESTION bin/battery /^ FA_QUESTION = "\\uf128<\/span>"$/;" v W vimrc /^command! W execute 'w !sudo tee % > \/dev\/null' edit!$/;" c +batteries bin/battery /^ batteries = status.split("\\n")$/;" v +color bin/battery /^ color = config.get("color_10", "red")$/;" v +color bin/battery /^ color = config.get("color_charging", "yellow")$/;" v +color bin/battery /^ def color(percent):$/;" f +commasplitstatus bin/battery /^ commasplitstatus = battery.split(", ")$/;" v +commasplitstatus bin/battery /^ commasplitstatus = commasplitstatus_batteries[0]$/;" v +commasplitstatus_batteries bin/battery /^ commasplitstatus_batteries=[]$/;" v +config bin/battery /^config = dict(os.environ)$/;" v data_dir vimrc /^let data_dir = has('nvim') ? stdpath('data') . '\/site' : '~\/.vim'$/;" v +form bin/battery /^ form = '{}%<\/span>'$/;" v +fulltext bin/battery /^ fulltext = FA_BATTERY + " "$/;" v +fulltext bin/battery /^ fulltext = FA_LIGHTNING + " " + FA_PLUG + " "$/;" v +fulltext bin/battery /^ fulltext = FA_PLUG + " "$/;" v +fulltext bin/battery /^ fulltext = FA_QUESTION + " " + FA_BATTERY + " "$/;" v +fulltext bin/battery /^ fulltext = "\\uf00d \\uf240<\/span><\/span>".forma/;" v g:ycm_always_populate_location_list vimrc /^let g:ycm_always_populate_location_list = 1$/;" v get_album_art bin/volbright /^function get_album_art {$/;" f get_brightness bin/volbright /^function get_brightness {$/;" f @@ -49,6 +87,22 @@ get_brightness_icon bin/volbright /^function get_brightness_icon {$/;" f get_mute bin/volbright /^function get_mute {$/;" f get_volume bin/volbright /^function get_volume {$/;" f get_volume_icon bin/volbright /^function get_volume_icon {$/;" f +help bin/cpu_usage /^sub help {$/;" s +p bin/battery /^ p = int(commasplitstatus[1].rstrip("%\\n"))$/;" v +percentleft bin/battery /^ percentleft = 0$/;" v +percentleft bin/battery /^ percentleft = int(sum(percentleft_batteries)\/len(percentleft_batteries))$/;" v +percentleft bin/battery /^ percentleft = 100$/;" v +percentleft_batteries bin/battery /^ percentleft_batteries=[]$/;" v show_brightness_notif bin/volbright /^function show_brightness_notif {$/;" f show_music_notif bin/volbright /^function show_music_notif {$/;" f show_volume_notif bin/volbright /^function show_volume_notif {$/;" f +state bin/battery /^ state = state_batteries[0]$/;" v +state_batteries bin/battery /^ state_batteries=[]$/;" v +status bin/battery /^status = check_output(['acpi'], universal_newlines=True)$/;" v +time bin/battery /^ time = ":".join(time.groups())$/;" v +time bin/battery /^ time = commasplitstatus[-1].strip()$/;" v +time bin/battery /^ time = re.match(r"(\\d+):(\\d+)", time)$/;" v +time bin/battery /^ time = ""$/;" v +timeleft bin/battery /^ timeleft = " ({})".format(time)$/;" v +timeleft bin/battery /^ timeleft = ""$/;" v +timeleft bin/battery /^ timeleft = ""$/;" v