From b815b8dc30a9632e159bf4347d615b067503215f Mon Sep 17 00:00:00 2001 From: Andrew Guschin Date: Mon, 15 Nov 2021 15:31:17 +0400 Subject: Removed unneeded scripts --- .local/bin/statusbar/battery | 42 ------------------- .local/bin/statusbar/clock | 4 -- .local/bin/statusbar/disk | 12 ------ .local/bin/statusbar/pacpackages | 10 ----- .local/bin/statusbar/popupgrade | 14 ------- .local/bin/statusbar/volume | 91 ---------------------------------------- 6 files changed, 173 deletions(-) delete mode 100755 .local/bin/statusbar/battery delete mode 100755 .local/bin/statusbar/clock delete mode 100755 .local/bin/statusbar/disk delete mode 100755 .local/bin/statusbar/pacpackages delete mode 100755 .local/bin/statusbar/popupgrade delete mode 100755 .local/bin/statusbar/volume (limited to '.local/bin/statusbar') diff --git a/.local/bin/statusbar/battery b/.local/bin/statusbar/battery deleted file mode 100755 index dfdc39c..0000000 --- a/.local/bin/statusbar/battery +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh -for battery in /sys/class/power_supply/BAT? -do - # Get its remaining capacity and charge status. - capacity=$(cat "$battery"/capacity) || break - status=$(sed "s/[Dd]ischarging/discharging/;s/[Nn]ot charging/not_charging/;s/[Cc]harging/charging/;s/[Uu]nknown/unknown/;s/[Ff]ull/full/" "$battery"/status) - - if [ "$status" = "charging" ]; then - if [ "$capacity" -le 20 ]; then - icon="" - elif [ "$capacity" -le 40 ]; then - icon="" - elif [ "$capacity" -le 60 ]; then - icon="" - elif [ "$capacity" -le 80 ]; then - icon="" - elif [ "$capacity" -lt 95 ]; then - icon="" - elif [ "$capacity" -le 100 ]; then - icon="" - fi - elif [ "$status" = "discharging" ]; then - if [ "$capacity" -le 20 ]; then - icon="" - elif [ "$capacity" -le 40 ]; then - icon="" - elif [ "$capacity" -le 60 ]; then - icon="" - elif [ "$capacity" -le 80 ]; then - icon="" - elif [ "$capacity" -lt 95 ]; then - icon="" - elif [ "$capacity" -le 100 ]; then - icon="" - fi - elif [ "$status" = "full" ]; then - icon="" - fi - - # printf "%s %s%% " "$icon" "$capacity" - printf "Battery: %s%%" "$capacity" -done | sed 's/ *$//' diff --git a/.local/bin/statusbar/clock b/.local/bin/statusbar/clock deleted file mode 100755 index d5e3685..0000000 --- a/.local/bin/statusbar/clock +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -d=$(date "+%d %b (%a) %k:%M") -printf " ${d}" diff --git a/.local/bin/statusbar/disk b/.local/bin/statusbar/disk deleted file mode 100755 index 73bc07c..0000000 --- a/.local/bin/statusbar/disk +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -getDiskSpace () { - echo $(df -h | grep "$1$" | awk '{ print $3 "/" $2 }') -} - -case $BLOCK_BUTTON in - 1) setsid -f "$TERMINAL" -e ncdu "/home/$USER" ;; -esac - -host=$(hostname -s) -echo " /home: $(getDiskSpace "/home")" diff --git a/.local/bin/statusbar/pacpackages b/.local/bin/statusbar/pacpackages deleted file mode 100755 index 618ec2a..0000000 --- a/.local/bin/statusbar/pacpackages +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -case $BLOCK_BUTTON in - 1) setsid -f "$TERMINAL" -e popupgrade ;; -esac - -pacmancnt=$(pacman -Qu | grep -Fcv "[ignored]") -aurcnt=$(yay -Qau | grep -Fcv "[ignored]") -echo "$pacmancnt+$aurcnt" | sed "s/^/Packages: /" - diff --git a/.local/bin/statusbar/popupgrade b/.local/bin/statusbar/popupgrade deleted file mode 100755 index 9d62b31..0000000 --- a/.local/bin/statusbar/popupgrade +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -printf "Packages to upgrade:\\n" -pacman -Qu -sudo pacman -Syu -pkill -RTMIN+3 "${STATUSBAR:-dwmblocks}" - -printf "\\nAUR packages to upgrade:\\n" -yay -Qau -shellprompt "Upgrade AUR packages?" && yay -Sau -pkill -RTMIN+3 "${STATUSBAR:-dwmblocks}" - -printf "\\nUpgrade complete.\\nPress to exit window.\\n\\n" -read -r diff --git a/.local/bin/statusbar/volume b/.local/bin/statusbar/volume deleted file mode 100755 index f60684e..0000000 --- a/.local/bin/statusbar/volume +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/python3 -import subprocess -import re -import os -import sys - - -block = os.getenv("BLOCK_BUTTON") -if block is not None: - if block == '1': - subprocess.call(["pamixer", "-t", ";", "pkill", "-RTMIN+9", "dwmblocks"]) - elif block == '3': - subprocess.Popen([os.getenv("TERMINAL"), "-e", "pulsemixer"]) - - quit(0) - - -a = subprocess.check_output(["pactl", "list", "sinks"]).decode() - -SINK, PARAMS, PARAM = 0, 1, 2 -parsing = SINK - -re_param_str = re.compile("(.+?): (.*)") -re_param_list = re.compile("(.+?):") - -current_sink = None -current_param = None - -sinks = {} -for line in a.split("\n"): - indent = line.count("\t") - line = line.strip() - - if parsing == SINK: - if line.startswith("Sink"): - n = line.split()[1] - sinks[n] = {} - current_sink = sinks[n] - - parsing = PARAMS - - elif parsing == PARAMS: - if line == '': - parsing = SINK - continue - - match = re_param_str.match(line) - if indent == 1 and match is not None: - name, value = match.groups() - current_param = name - current_sink[name] = value - continue - - match = re_param_list.match(line) - if indent == 1 and match is not None: - name = match.group(1) - current_param = name - current_sink[name] = [] - continue - - value = current_sink[name] - if isinstance(value, str): - current_sink[name] = [value] - - current_sink[name].append(line) - -percent = re.compile("(\d+)%") -vol = None -mute = False -for sink in sinks.values(): - if 'JBL' in sink['Description']: # Headphones - vol = int(percent.findall(sink['Volume'][0])[0]) - mute = sink["Mute"] == "yes" - break - # desktop and laptop sinks respectively - elif 'Built-in' in sink['Description'] or 'Family 17h' in sink['Description'] and vol is None: - vol = int(percent.findall(sink['Volume'][0])[0]) - mute = sink["Mute"] == "yes" - - -format_string = "%i" -if len(sys.argv) > 1: - format_string = sys.argv[1] - -if vol is None or mute: - vol = "Muted" -else: - v = vol // 10 - -print(format_string % vol) - -- cgit v1.2.3