aboutsummaryrefslogtreecommitdiff
path: root/config/i3blocks
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2024-04-15 23:34:35 +0200
committerKarel Kočí <cynerd@email.cz>2024-04-15 23:35:42 +0200
commit4a25d79feef0dd6e462abfb48173da7e470127a5 (patch)
treef669e473abd24a84b2d9e167ec3f61463fb2b3a7 /config/i3blocks
parentdef6ee65cecb646c4cf0e02e9cfd17dd21611f9c (diff)
downloadmyconfigs-4a25d79feef0dd6e462abfb48173da7e470127a5.tar.gz
myconfigs-4a25d79feef0dd6e462abfb48173da7e470127a5.tar.bz2
myconfigs-4a25d79feef0dd6e462abfb48173da7e470127a5.zip
Replace i3blocks with swaybar
Diffstat (limited to 'config/i3blocks')
-rw-r--r--config/i3blocks/config69
-rwxr-xr-xconfig/i3blocks/scripts/allsync9
-rwxr-xr-xconfig/i3blocks/scripts/bandwidth116
-rwxr-xr-xconfig/i3blocks/scripts/battery2106
-rwxr-xr-xconfig/i3blocks/scripts/cpu_usage66
-rwxr-xr-xconfig/i3blocks/scripts/disk48
-rwxr-xr-xconfig/i3blocks/scripts/email19
-rwxr-xr-xconfig/i3blocks/scripts/gpu2
-rwxr-xr-xconfig/i3blocks/scripts/iface105
-rwxr-xr-xconfig/i3blocks/scripts/memory73
-rwxr-xr-xconfig/i3blocks/scripts/mpd37
-rwxr-xr-xconfig/i3blocks/scripts/ssid39
-rwxr-xr-xconfig/i3blocks/scripts/temperature70
-rwxr-xr-xconfig/i3blocks/scripts/time101
-rwxr-xr-xconfig/i3blocks/scripts/volume-pipewire172
-rwxr-xr-xconfig/i3blocks/scripts/wifi59
16 files changed, 0 insertions, 1091 deletions
diff --git a/config/i3blocks/config b/config/i3blocks/config
deleted file mode 100644
index d60834a..0000000
--- a/config/i3blocks/config
+++ /dev/null
@@ -1,69 +0,0 @@
-# i3blocks config file
-command=~/.config/i3blocks/scripts/$BLOCK_NAME
-separator_block_width=10
-markup=none
-
-[mpd]
-interval=5
-signal=12
-
-[volume-pipewire]
-label=♪
-interval=once
-signal=10
-
-[cpu_usage]
-label=cpu:
-interval=1
-
-[memory]
-interval=10
-
-[gpu]
-label=gpu:
-interval=1
-
-[disk]
-label=/
-instance=/
-interval=30
-separator=false
-[disk]
-label=/home2
-instance=/home2
-interval=30
-
-[iface]
-interval=2
-separator=false
-
-[bandwidth]
-interval=2
-
-[ssid]
-instance=wlp2s0
-interval=2
-separator=false
-
-[wifi]
-instance=wlp2s0
-interval=2
-
-[temperature]
-interval=10
-
-[battery2]
-markup=pango
-interval=30
-
-[allsync]
-interval=120
-signal=13
-
-[email]
-interval=30
-signal=13
-
-[time]
-command=date '+%Y-%m-%d %H:%M:%S'
-interval=1
diff --git a/config/i3blocks/scripts/allsync b/config/i3blocks/scripts/allsync
deleted file mode 100755
index 472954f..0000000
--- a/config/i3blocks/scripts/allsync
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/env bash
-if allsync enabled 2>/dev/null; then
- echo "sync"
-else
- echo
-fi
-
-echo
-echo "#ffff00"
diff --git a/config/i3blocks/scripts/bandwidth b/config/i3blocks/scripts/bandwidth
deleted file mode 100755
index d45f127..0000000
--- a/config/i3blocks/scripts/bandwidth
+++ /dev/null
@@ -1,116 +0,0 @@
-#!/usr/bin/env 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
- for version in 4 6; do
- INTERFACE=$(ip -$version r | sed -n 's/^default.*dev \([^ ]*\).*/\1/p' | head -1)
- [ -z "$INTERFACE" ] || break
- done
-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="/tmp/$(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/battery2 b/config/i3blocks/scripts/battery2
deleted file mode 100755
index 4898d3c..0000000
--- a/config/i3blocks/scripts/battery2
+++ /dev/null
@@ -1,106 +0,0 @@
-#!/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 = "<span color='{}'><span font='FontAwesome'>\uf00d \uf240</span></span>".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 = "<span color='{}'><span font='FontAwesome'>\uf0e7</span></span>".format(color)
-
- # stands for plugged in
- FA_PLUG = "<span font='FontAwesome'>\uf1e6</span>"
-
- # stands for using battery
- FA_BATTERY = "<span font='FontAwesome'>\uf240</span>"
-
- # stands for unknown status of battery
- FA_QUESTION = "<span font='FontAwesome'>\uf128</span>"
-
-
- 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 = '<span color="{}">{}%</span>'
- fulltext += form.format(color(percentleft), percentleft)
- fulltext += timeleft
-
-print(fulltext)
-print(fulltext)
-if percentleft < 10:
- exit(33)
diff --git a/config/i3blocks/scripts/cpu_usage b/config/i3blocks/scripts/cpu_usage
deleted file mode 100755
index b298a97..0000000
--- a/config/i3blocks/scripts/cpu_usage
+++ /dev/null
@@ -1,66 +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>
-#
-# 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 <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 "${color_crit}\n";
-} elsif ($cpu_usage >= $t_warn) {
- print "${color_warn}\n";
-} else {
- print "${color_normal}\n";
-}
-
-exit 0;
diff --git a/config/i3blocks/scripts/disk b/config/i3blocks/scripts/disk
deleted file mode 100755
index 9d64cc1..0000000
--- a/config/i3blocks/scripts/disk
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env 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/email b/config/i3blocks/scripts/email
deleted file mode 100755
index 142f422..0000000
--- a/config/i3blocks/scripts/email
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/usr/bin/env bash
-filter=("tag:unread" "and" "not" "tag:killed")
-
-part=()
-all=0
-for mail in email gmail elektroline fel; do
- counts="$(notmuch count -- "${filter[@]}" and "tag:$mail")"
- [ "$counts" = "0" ] || \
- part+=("$mail:$counts")
- ((all = all + counts))
-done
-
-echo "${part[@]}"
-if [ "$all" = "0" ]; then
- echo
-else
- echo "mails:$all"
-fi
-echo "#ffff00"
diff --git a/config/i3blocks/scripts/gpu b/config/i3blocks/scripts/gpu
deleted file mode 100755
index cc257c1..0000000
--- a/config/i3blocks/scripts/gpu
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/env bash
-echo "$(cat /sys/class/drm/card0/device/gpu_busy_percent)%"
diff --git a/config/i3blocks/scripts/iface b/config/i3blocks/scripts/iface
deleted file mode 100755
index 5daffa6..0000000
--- a/config/i3blocks/scripts/iface
+++ /dev/null
@@ -1,105 +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/>.
-
-#------------------------------------------------------------------------
-
-# Use the provided interface, otherwise the device used for the default route.
-IF="${IFACE:-$BLOCK_INSTANCE}"
-for version in 4 6; do
- IF="${IF:-$(ip -$version route | sed -n 's/^default.*dev \([^ ]*\).*/\1/p' | head -1)}"
-done
-
-# 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
-
-# Use the first global scope address that matches limitation and preffer not local one)
-while read -r ipaddr; do
- case "$ipaddr" in
- ""|169\.*|f*)
- IPADDR="${IPADDR:-$ipaddr}"
- continue # try another one
- esac
- IPADDR="$ipaddr"
- break
-done <<<"$(ip addr show "$IF" | sed -n 's/.*inet6\? \([^/]\+\).* scope global.*/\1/p')"
-
-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 cynerd.cz >/dev/null 2>&1; then
- echo \#00FF00 # color
-else
- # Ping nic.cz by ip
- if ping $PINGV 77.93.223.198 >/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/memory b/config/i3blocks/scripts/memory
deleted file mode 100755
index fd814e0..0000000
--- a/config/i3blocks/scripts/memory
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/env 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}"
-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/config/i3blocks/scripts/mpd b/config/i3blocks/scripts/mpd
deleted file mode 100755
index d179511..0000000
--- a/config/i3blocks/scripts/mpd
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env bash
-
-status="$(mpc -f "♫ %artist%, %album%, %title%" status)"
-
-case "$BLOCK_BUTTON" in
- 1)
- mpc toggle >/dev/null
- ;;
- 2)
- mpc stop >/dev/null
- ;;
- 3)
- nohup urxvt -title "Music player daemon client" -e ncmpcpp 2>&1 >/dev/null &
- ;;
- 4)
- mpc prev >/dev/null
- ;;
- 5)
- mpc next >/dev/null
- ;;
-esac
-
-if [ "$(echo "$status" | wc -l)" -gt 1 ] && \
- [[ "$status" == **(playing|paused)* ]]; then
- echo "$status" | head -1
- echo
- case "$status" in
- *playing*)
- echo "#00ff00"
- ;;
- *paused*)
- echo "#ffff00"
- ;;
- esac
-else
- echo "♫"
-fi
diff --git a/config/i3blocks/scripts/ssid b/config/i3blocks/scripts/ssid
deleted file mode 100755
index be92883..0000000
--- a/config/i3blocks/scripts/ssid
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env bash
-# Copyright (C) 2020 hseg <gesh@gesh.uni.cx>
-# 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.
-# Similarly, if the wifi interface exists but no connection is active, show
-# nothing
-[[ ! -d /sys/class/net/"${INTERFACE}"/wireless || \
- "$(cat /sys/class/net/"$INTERFACE"/operstate)" = 'down' ]] && exit
-
-#------------------------------------------------------------------------
-
-SSID=$(iw "$INTERFACE" info | awk '/ssid/ {$1=""; print $0}')
-
-#------------------------------------------------------------------------
-
-echo "$SSID" # full text
-echo "$SSID" # short text
-echo "#00FF00" # color
diff --git a/config/i3blocks/scripts/temperature b/config/i3blocks/scripts/temperature
deleted file mode 100755
index 97579fb..0000000
--- a/config/i3blocks/scripts/temperature
+++ /dev/null
@@ -1,70 +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 2>/dev/null |") 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/time b/config/i3blocks/scripts/time
deleted file mode 100755
index e552a92..0000000
--- a/config/i3blocks/scripts/time
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/usr/bin/env perl
-
-use strict;
-use warnings;
-use POSIX qw/strftime/;
-
-my $click = $ENV{BLOCK_BUTTON} || 0;
-my $format = $ENV{BLOCK_INSTANCE} || $ENV{STRFTIME_FORMAT} || "%H:%M";
-my $tz_file = shift || $ENV{TZ_FILE} || "$ENV{HOME}/.tz";
-$tz_file = glob($tz_file);
-my $default_tz = get_default_tz();
-
-my $tzones = $ENV{TZONES} || '$DEFAULT_TZ';
-$tzones =~ s/\$DEFAULT_TZ/$default_tz/g;
-my @tz_list = split(/,/, $tzones);
-my @tz_labels = split(/,/, $ENV{TZ_LABELS} || "");
-if (scalar(@tz_list) != scalar(@tz_labels)) {
- @tz_labels = @tz_list;
-}
-
-my $current_tz;
-if ($click == 1) {
- $current_tz = get_tz();
-
- my %tzmap;
- $tzmap{""} = $tz_list[0];
- my $prev = $tz_list[0];
- foreach my $tz (@tz_list) {
- $tzmap{$prev} = $tz;
- $prev = $tz;
- }
- $tzmap{$prev} = $tz_list[0];
-
- if (exists $tzmap{$current_tz}) {
- set_tz($tzmap{$current_tz});
- $current_tz = $tzmap{$current_tz};
- }
-}
-
-# How each timezone will be displayed in the bar.
-my %display_map;
-for (my $i=0; $i < scalar(@tz_list); $i++) {
- $display_map{$tz_list[$i]} = $tz_labels[$i];
-}
-
-if (!defined $current_tz) {
- $current_tz = get_tz();
- set_tz($current_tz);
-}
-$ENV{TZ} = $current_tz;
-my $tz_display = "";
-if (!exists $display_map{$ENV{TZ}}) {
- $ENV{TZ} = $tz_list[0];
- set_tz($tz_list[0]);
-}
-$tz_display = $display_map{$ENV{TZ}};
-
-binmode(STDOUT, ":utf8");
-my $time = strftime($format, localtime());
-if ($tz_display eq "") {
- print "$time\n";
-} else {
- print "$time ($tz_display)\n";
-}
-
-sub get_tz {
- my $current_tz;
-
- if (-f $tz_file) {
- open my $fh, '<', $tz_file || die "Couldn't open file: $tz_file";
- $current_tz = <$fh>;
- chomp $current_tz;
- close $fh;
- }
-
- return $current_tz || get_default_tz();
-}
-
-sub set_tz {
- my $tz = shift;
-
- open my $fh, '>', $tz_file || die "Couldn't open file: $tz_file";
- print $fh $tz;
- close $fh;
-}
-
-sub get_default_tz {
- my $tz = "Europe/London";
-
- if (-f "/etc/timezone") {
- open my $fh, '<', "/etc/timezone" || die "Couldn't open file: /etc/timezone";
- $tz = <$fh>;
- chomp $tz;
- close $fh;
- } elsif (-l "/etc/localtime") {
- $tz = readlink "/etc/localtime";
- $tz = (split /zoneinfo\//, $tz)[-1];
- }
-
- return $tz;
-}
diff --git a/config/i3blocks/scripts/volume-pipewire b/config/i3blocks/scripts/volume-pipewire
deleted file mode 100755
index bc7da69..0000000
--- a/config/i3blocks/scripts/volume-pipewire
+++ /dev/null
@@ -1,172 +0,0 @@
-#!/bin/bash
-# Displays the default device, volume, and mute status for i3blocks
-
-set -a
-
-AUDIO_HIGH_SYMBOL=${AUDIO_HIGH_SYMBOL:-' '}
-
-AUDIO_MED_THRESH=${AUDIO_MED_THRESH:-50}
-AUDIO_MED_SYMBOL=${AUDIO_MED_SYMBOL:-' '}
-
-AUDIO_LOW_THRESH=${AUDIO_LOW_THRESH:-0}
-AUDIO_LOW_SYMBOL=${AUDIO_LOW_SYMBOL:-' '}
-
-AUDIO_MUTED_SYMBOL=${AUDIO_MUTED_SYMBOL:-' '}
-
-AUDIO_DELTA=${AUDIO_DELTA:-5}
-
-DEFAULT_COLOR=${DEFAULT_COLOR:-"#ffffff"}
-MUTED_COLOR=${MUTED_COLOR:-"#a0a0a0"}
-
-LONG_FORMAT=${LONG_FORMAT:-'${SYMB} ${VOL}% [${INDEX}:${NAME}]'}
-SHORT_FORMAT=${SHORT_FORMAT:-'${SYMB} ${VOL}% [${INDEX}]'}
-USE_ALSA_NAME=${USE_ALSA_NAME:-0}
-USE_DESCRIPTION=${USE_DESCRIPTION:-0}
-
-SUBSCRIBE=${SUBSCRIBE:-0}
-
-MIXER=${MIXER:-""}
-SCONTROL=${SCONTROL:-""}
-
-while getopts F:Sf:adH:M:L:X:T:t:C:c:i:m:s:h opt; do
- case "$opt" in
- S) SUBSCRIBE=1 ;;
- F) LONG_FORMAT="$OPTARG" ;;
- f) SHORT_FORMAT="$OPTARG" ;;
- a) USE_ALSA_NAME=1 ;;
- d) USE_DESCRIPTION=1 ;;
- H) AUDIO_HIGH_SYMBOL="$OPTARG" ;;
- M) AUDIO_MED_SYMBOL="$OPTARG" ;;
- L) AUDIO_LOW_SYMBOL="$OPTARG" ;;
- X) AUDIO_MUTED_SYMBOL="$OPTARG" ;;
- T) AUDIO_MED_THRESH="$OPTARG" ;;
- t) AUDIO_LOW_THRESH="$OPTARG" ;;
- C) DEFAULT_COLOR="$OPTARG" ;;
- c) MUTED_COLOR="$OPTARG" ;;
- i) AUDIO_INTERVAL="$OPTARG" ;;
- m) MIXER="$OPTARG" ;;
- s) SCONTROL="$OPTARG" ;;
- h) printf \
-"Usage: volume-pulseaudio [-S] [-F format] [-f format] [-p] [-a|-d] [-H symb] [-M symb]
- [-L symb] [-X symb] [-T thresh] [-t thresh] [-C color] [-c color] [-i inter]
- [-m mixer] [-s scontrol] [-h]
-Options:
--F, -f\tOutput format (-F long format, -f short format) to use, with exposed variables:
-\${SYMB}, \${VOL}, \${INDEX}, \${NAME}
--S\tSubscribe to volume events (requires persistent block, always uses long format)
--a\tUse ALSA name if possible
--d\tUse device description instead of name if possible
--H\tSymbol to use when audio level is high. Default: '$AUDIO_HIGH_SYMBOL'
--M\tSymbol to use when audio level is medium. Default: '$AUDIO_MED_SYMBOL'
--L\tSymbol to use when audio level is low. Default: '$AUDIO_LOW_SYMBOL'
--X\tSymbol to use when audio is muted. Default: '$AUDIO_MUTED_SYMBOL'
--T\tThreshold for medium audio level. Default: $AUDIO_MED_THRESH
--t\tThreshold for low audio level. Default: $AUDIO_LOW_THRESH
--C\tColor for non-muted audio. Default: $DEFAULT_COLOR
--c\tColor for muted audio. Default: $MUTED_COLOR
--i\tInterval size of volume increase/decrease. Default: $AUDIO_DELTA
--m\tUse the given mixer.
--s\tUse the given scontrol.
--h\tShow this help text
-" && exit 0;;
- esac
-done
-
-if [[ -z "$MIXER" ]] ; then
- MIXER="default"
- if amixer -D pulse info >/dev/null 2>&1 ; then
- MIXER="pulse"
- fi
-fi
-
-if [[ -z "$SCONTROL" ]] ; then
- SCONTROL=$(amixer -D "$MIXER" scontrols | sed -n "s/Simple mixer control '\([^']*\)',0/\1/p" | head -n1)
-fi
-
-CAPABILITY=$(amixer -D $MIXER get $SCONTROL | sed -n "s/ Capabilities:.*cvolume.*/Capture/p")
-
-
-function move_sinks_to_new_default {
- DEFAULT_SINK=$1
- pactl list sink-inputs | grep 'Sink Input #' | grep -o '[0-9]\+' | while read SINK
- do
- pactl move-sink-input $SINK $DEFAULT_SINK
- done
-}
-
-function set_default_playback_device_next {
- inc=${1:-1}
- num_devices=$(pactl list sinks | grep -c Name:)
- sink_arr=($(pactl list sinks | grep Name: | sed -r 's/\s+Name: (.+)/\1/'))
- default_sink=$(pactl get-default-sink)
- default_sink_index=$(for i in "${!sink_arr[@]}"; do if [[ "$default_sink" = "${sink_arr[$i]}" ]]; then echo "$i"; fi done)
- default_sink_index=$(( ($default_sink_index + $num_devices + $inc) % $num_devices ))
- default_sink=${sink_arr[$default_sink_index]}
- pactl set-default-sink $default_sink
- move_sinks_to_new_default $default_sink
-}
-
-case "$BLOCK_BUTTON" in
- 1) set_default_playback_device_next ;;
- 2) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY toggle ;;
- 3) set_default_playback_device_next -1 ;;
- 4) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY $AUDIO_DELTA%+ ;;
- 5) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY $AUDIO_DELTA%- ;;
-esac
-
-function print_format {
- echo "$1" | envsubst '${SYMB}${VOL}${INDEX}${NAME}'
-}
-
-function print_block {
- ACTIVE=$(pactl list sinks | grep "State\: RUNNING" -B4 -A55 | grep "Name:\|Volume: \(front-left\|mono\)\|Mute:\|api.alsa.pcm.card = \|node.nick = ")
- for Name in NAME MUTED VOL INDEX NICK; do
- read $Name
- done < <(echo "$ACTIVE")
- INDEX=$(echo "$INDEX" | grep -o '".*"' | sed 's/"//g')
- VOL=$(echo "$VOL" | grep -o "[0-9]*%" | head -1 )
- VOL="${VOL%?}"
- NAME=$(echo "$NICK" | grep -o '".*"' | sed 's/"//g')
-
- if [[ $USE_ALSA_NAME == 1 ]] ; then
- ALSA_NAME=$(pactl list sinks |\
-awk '/^\s*\*/{f=1}/^\s*index:/{f=0}f' |\
-grep "alsa.name\|alsa.mixer_name" |\
-head -n1 |\
-sed 's/.*= "\(.*\)".*/\1/')
- NAME=${ALSA_NAME:-$NAME}
- elif [[ $USE_DESCRIPTION == 1 ]] ; then
- DESCRIPTION=$(pactl list sinks | grep "State\: RUNNING" -B4 -A55 | grep 'Description: ' | sed 's/^.*: //')
- NAME=${DESCRIPTION:-$NAME}
- fi
-
- if [[ $MUTED =~ "no" ]] ; then
- SYMB=$AUDIO_HIGH_SYMBOL
- [[ $VOL -le $AUDIO_MED_THRESH ]] && SYMB=$AUDIO_MED_SYMBOL
- [[ $VOL -le $AUDIO_LOW_THRESH ]] && SYMB=$AUDIO_LOW_SYMBOL
- COLOR=$DEFAULT_COLOR
- else
- SYMB=$AUDIO_MUTED_SYMBOL
- COLOR=$MUTED_COLOR
- fi
-
- if [[ $ACTIVE = "" ]] ; then
- echo "Sound inactive"
- COLOR='#222225'
- fi
-
- if [[ $SUBSCRIBE == 1 ]] ; then
- print_format "$LONG_FORMAT"
- else
- print_format "$LONG_FORMAT"
- print_format "$SHORT_FORMAT"
- echo "$COLOR"
- fi
-}
-
-print_block
-if [[ $SUBSCRIBE == 1 ]] ; then
- while read -r EVENT; do
- print_block
- done < <(pactl subscribe | stdbuf -oL grep change)
-fi
diff --git a/config/i3blocks/scripts/wifi b/config/i3blocks/scripts/wifi
deleted file mode 100755
index 258ac8c..0000000
--- a/config/i3blocks/scripts/wifi
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/env 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
-#------------------------------------------------------------------------
-
-COLOR_GE80=${COLOR_GE80:-#00FF00}
-COLOR_GE60=${COLOR_GE60:-#FFF600}
-COLOR_GE40=${COLOR_GE40:-#FFAE00}
-COLOR_LOWR=${COLOR_LOWR:-#FF0000}
-COLOR_DOWN=${COLOR_DOWN:-#FF0000}
-
-# 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 $COLOR_DOWN
- exit
-fi
-
-#------------------------------------------------------------------------
-
-QUALITY=$(iw dev ${INTERFACE} link | grep 'dBm$' | grep -Eoe '-[0-9]{2}' | awk '{print ($1 > -50 ? 100 :($1 < -100 ? 0 : ($1+100)*2))}')
-
-#------------------------------------------------------------------------
-
-echo $QUALITY% # full text
-echo $QUALITY% # short text
-
-# color
-if [[ $QUALITY -ge 80 ]]; then
- echo $COLOR_GE80
-elif [[ $QUALITY -ge 60 ]]; then
- echo $COLOR_GE60
-elif [[ $QUALITY -ge 40 ]]; then
- echo $COLOR_GE40
-else
- echo $COLOR_LOWR
-fi