summaryrefslogtreecommitdiff
path: root/.local/bin/statusbar
diff options
context:
space:
mode:
authorAndrew Guschin <saintruler@gmail.com>2021-11-15 15:31:17 +0400
committerAndrew Guschin <saintruler@gmail.com>2021-11-15 15:31:17 +0400
commitb815b8dc30a9632e159bf4347d615b067503215f (patch)
treeb6ea0d48d364ccd7c7341576711112fa156c9f84 /.local/bin/statusbar
parent54d45cc3ddc50fb0db021aca14ea9284c7937984 (diff)
Removed unneeded scripts
Diffstat (limited to '.local/bin/statusbar')
-rwxr-xr-x.local/bin/statusbar/battery42
-rwxr-xr-x.local/bin/statusbar/clock4
-rwxr-xr-x.local/bin/statusbar/disk12
-rwxr-xr-x.local/bin/statusbar/pacpackages10
-rwxr-xr-x.local/bin/statusbar/popupgrade14
-rwxr-xr-x.local/bin/statusbar/volume91
6 files changed, 0 insertions, 173 deletions
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 <Enter> 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)
-