diff options
author | Biswakalyan Bhuyan <biswa@surgot.in> | 2022-10-03 21:42:20 +0530 |
---|---|---|
committer | Biswakalyan Bhuyan <biswa@surgot.in> | 2022-10-03 21:42:20 +0530 |
commit | af120ab348f2e1a5a39dec035ed9dcf84189a64e (patch) | |
tree | 2a3aadd7ce1b7b771dfe3fe7c983569726c8d7ed /eww/scripts | |
download | dotfiles-af120ab348f2e1a5a39dec035ed9dcf84189a64e.tar.gz dotfiles-af120ab348f2e1a5a39dec035ed9dcf84189a64e.tar.bz2 dotfiles-af120ab348f2e1a5a39dec035ed9dcf84189a64e.zip |
dotfiles
Diffstat (limited to 'eww/scripts')
-rwxr-xr-x | eww/scripts/audio | 15 | ||||
-rwxr-xr-x | eww/scripts/backlight | 2 | ||||
-rwxr-xr-x | eww/scripts/fetch | 34 | ||||
-rwxr-xr-x | eww/scripts/system | 44 | ||||
-rwxr-xr-x | eww/scripts/wifi | 4 |
5 files changed, 99 insertions, 0 deletions
diff --git a/eww/scripts/audio b/eww/scripts/audio new file mode 100755 index 0000000..570d80e --- /dev/null +++ b/eww/scripts/audio @@ -0,0 +1,15 @@ +#!/bin/sh + +headvol() { + amixer sget Headphone | grep 'Left:' | cut -d\ -f7 | tr -d '[%]' +} + +mastervol() { + amixer get Master | awk '$0~/%/{print $4}' | tr -d '[%]' +} + +micvol() { + amixer sget Mic | grep 'Left:' | cut -d\ -f7 | tr -d '[%]' +} + +"$@" diff --git a/eww/scripts/backlight b/eww/scripts/backlight new file mode 100755 index 0000000..4f03d54 --- /dev/null +++ b/eww/scripts/backlight @@ -0,0 +1,2 @@ +#!/bin/sh +printf "%.0f\n" $(xbacklight -get) diff --git a/eww/scripts/fetch b/eww/scripts/fetch new file mode 100755 index 0000000..931bf30 --- /dev/null +++ b/eww/scripts/fetch @@ -0,0 +1,34 @@ +#!/bin/bash + +os() { + source /etc/os-release + echo $PRETTY_NAME | awk '{print $1;}' + +} + +wm() { + wm=$XDG_CURRENT_DESKTOP + [ "$wm" ] || wm=$DESKTOP_SESSION + + ## WM/DE + [ ! "$wm" ] && + # loop over all processes and check the binary name + for i in /proc/*/comm; do + read -r c <"$i" + case $c in + *bar*) ;; + awesome | xmonad* | qtile | sway | i3 | [bfo]*box | *wm*) + wm=${c%%-*} + break + ;; + esac + done + + echo $wm +} + +shell() { + basename $SHELL +} + +"$@" diff --git a/eww/scripts/system b/eww/scripts/system new file mode 100755 index 0000000..d1cba41 --- /dev/null +++ b/eww/scripts/system @@ -0,0 +1,44 @@ +#!/bin/sh + +pkgCount() { + xbps-query -l | wc -l +} + +pkgUpdates() { + updates=$(xbps-install -S -un | cut -d' ' -f2 | sort | uniq -c | xargs) + + if [ -z "$updates" ]; then + echo "Fully Updated" + else + echo " $updates""s" + fi +} + +battery() { + cat /sys/class/power_supply/BAT1/capacity +} + +cpu() { + grep -o "^[^ ]*" /proc/loadavg +} + +disk() { + df -hl | awk '/^\/dev\/sd[ab]/ { sum+=$5 } END { print sum }' +} + +ram() { + printf "%.0f\n" $(free -m | grep Mem | awk '{print ($3/$2)*100}') +} + +backlight() { + printf "%.0f\n" $(xbacklight -get) +} + +wifi() { + case "$(cat /sys/class/net/wl*/operstate 2>/dev/null)" in + up) printf "" ;; + down) printf "" ;; + esac +} + +"$@" diff --git a/eww/scripts/wifi b/eww/scripts/wifi new file mode 100755 index 0000000..ae6fe2f --- /dev/null +++ b/eww/scripts/wifi @@ -0,0 +1,4 @@ + case "$(cat /sys/class/net/wl*/operstate 2>/dev/null)" in + up) printf "" ;; + down) printf "" ;; + esac |