commit c41231c3e6579c095c920b96a449494a2be78b92
parent c4d84e819a867cfeff2de3bba22381d5f13fd1a4
Author: jacobsGit <JacobDoesLinux@protonmail.com>
Date: Mon, 9 Dec 2019 02:13:07 -0800
xmobar scripts
Diffstat:
5 files changed, 102 insertions(+), 0 deletions(-)
diff --git a/xmobar/.xmobar/xmb-backup-timer b/xmobar/.xmobar/xmb-backup-timer
@@ -0,0 +1,24 @@
+#!/bin/sh
+MB=$(calc $(date +'%s') - $(cat ~/.dates/ssh-backup) / 60 | cut -d '.' -f 1)
+
+
+if [[ "$MB" -ge "60" ]]; then
+ HB=$(expr "$MB" / 60)
+ MB=$(expr "$MB" % 60)
+
+if [[ "$MB" -lt "10" ]]; then
+ MB=0$MB
+ fi
+
+ printf "$HB":"$MB"
+
+else
+if [[ "$MB" -lt "10" ]]; then
+ MB=0$MB
+ fi
+
+printf 0:$MB
+fi
+
+
+
diff --git a/xmobar/.xmobar/xmb-battery b/xmobar/.xmobar/xmb-battery
@@ -0,0 +1,41 @@
+#!/bin/sh
+# 2019 - Jacob Edwards
+#
+#Made for xmobar because
+#batteryP -O option would not work
+
+suspendAt=10 # percent
+suspendDelay=30 # in seconds
+batteryMsg=''
+poweredMsg='AC'
+
+
+status="$(acpi -a | awk '{print $3}')"
+percentage="$(acpi -b | cut -d '%' -f 1 | rev | awk '{print $1}' | rev )"
+
+
+if [[ "$status" = 'on-line' ]]; then
+ statusMsg="$poweredMsg"
+ color='<fc=#8fff8f>'
+elif [[ "$status" = 'off-line' ]]; then
+ statusMsg="$batteryMsg"
+ color='<fc=#ff8f8f>'
+fi
+
+
+
+if [[ "$percentage" -le "$suspendAt" ]] && [[ "$status" = 'off-line' ]]; then
+ notify-send " suspending in $suspendDelay seconds due to low battery "
+ sleep "$suspendDelay"
+
+ status="$(acpi -a | awk '{print $3}')"
+
+ if [[ "$percentage" -le "$suspendAt" ]] && [[ "$status" = 'off-line' ]]; then
+ systemctl suspend
+ fi
+fi
+
+
+
+
+printf "<fc=#5f5f5f>$statusMsg</fc> $color$percentage</fc>%%"
diff --git a/xmobar/.xmobar/xmb-music b/xmobar/.xmobar/xmb-music
@@ -0,0 +1,12 @@
+#!/bin/sh
+string="$(playerctl metadata | grep title | tail -c +35)"
+
+if [[ "$string" == "" ]]; then
+ string="$(mpc current | cut -d '-' -f 2 | cut -d '(' -f 1)"
+ fi
+
+if [[ "$string" == "" ]]; then
+ string=OFF
+fi
+
+printf "$string"
diff --git a/xmobar/.xmobar/xmb-packages b/xmobar/.xmobar/xmb-packages
@@ -0,0 +1,2 @@
+#!/bin/sh
+printf "$(pacman -Q | wc -l)"
diff --git a/xmobar/.xmobar/xmb-update-timer b/xmobar/.xmobar/xmb-update-timer
@@ -0,0 +1,23 @@
+#!/bin/sh
+MB=$(calc $(date +'%s') - $(cat ~/.dates/system-update) / 60 | cut -d '.' -f 1)
+
+if [[ "$MB" -gt "59" ]]; then
+ HB=$(expr "$MB" / 60)
+ MB=$(expr "$MB" % 60)
+
+if [[ "$MB" -lt "10" ]]; then
+ MB=0$MB
+ fi
+
+ printf "$HB":"$MB"
+
+else
+if [[ "$MB" -lt "10" ]]; then
+ MB=0$MB
+ fi
+
+printf 0:$MB
+fi
+
+
+