aboutsummaryrefslogtreecommitdiff
path: root/scripts/.local/bin/personal/bar
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/.local/bin/personal/bar')
-rwxr-xr-xscripts/.local/bin/personal/bar/brightness8
-rwxr-xr-xscripts/.local/bin/personal/bar/ischarging15
-rwxr-xr-xscripts/.local/bin/personal/bar/smallstatus21
-rwxr-xr-xscripts/.local/bin/personal/bar/status19
4 files changed, 57 insertions, 6 deletions
diff --git a/scripts/.local/bin/personal/bar/brightness b/scripts/.local/bin/personal/bar/brightness
index b54de59..da28db3 100755
--- a/scripts/.local/bin/personal/bar/brightness
+++ b/scripts/.local/bin/personal/bar/brightness
@@ -5,10 +5,10 @@
# By David Penkowoj, 2021/06/24
# MTR_DEVICE="$MTR_DEVICE"
-MTR_DEVICE="acpi_video0"
+MTR_DEVICE="intel_backlight"
KBD_DEVICE="smc::kbd_backlight"
-MTR_VALUE=99
-KBD_VALUE=0
+MTR_VALUE=49
+KBD_VALUE=
SWITCH="$1"
@@ -31,7 +31,7 @@ case $SWITCH in
"save")
M="$(brightnessctl --device="$MTR_DEVICE" | grep -Eo "[0-9]+" | head -n 2 | tail -n 1)"
K="$(brightnessctl --device="$KBD_DEVICE" | grep -Eo "[0-9]+" | head -n 2 | tail -n 1)"
- sed -i "s/MTR_VALUE=$MTR_VALUE/MTR_VALUE=$M/g" "$0"
+ sed -i "s/MTR_VALUE=49$MTR_VALUE/MTR_VALUE=49$M/g" "$0"
sed -i "s/KBD_VALUE=$KBD_VALUE/KBD_VALUE=$K/g" "$0"
;;
"smalldown")
diff --git a/scripts/.local/bin/personal/bar/ischarging b/scripts/.local/bin/personal/bar/ischarging
new file mode 100755
index 0000000..29d736b
--- /dev/null
+++ b/scripts/.local/bin/personal/bar/ischarging
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+acpireport="$(acpi | grep -v unavailable | head -n 1)"
+
+state="$(echo $acpireport | awk '{print $3}')"
+percent="$(echo $acpireport | sed -n 's/.* \([0-9]\+\)%.*/\1/p')"
+
+if [[ "${state::-1}" != "Charging" ]]; then
+ if ((${percent} <= 75)); then
+ echo "PLUG IN CHARGER"
+ exit 1
+ fi
+fi
+
+exit 0
diff --git a/scripts/.local/bin/personal/bar/smallstatus b/scripts/.local/bin/personal/bar/smallstatus
new file mode 100755
index 0000000..09ddd9f
--- /dev/null
+++ b/scripts/.local/bin/personal/bar/smallstatus
@@ -0,0 +1,21 @@
+#!/bin/dash
+
+flash() {
+ second="$(date +'%s')"
+
+ if [ $((second % 2)) = 1 ]; then
+ echo $1
+ else
+ echo $2
+ fi
+}
+
+sep="|"
+
+message="$(volume) $sep $(network) $sep $(temp) $sep $(datetime)"
+
+if [ ischarging ]; then
+ echo "$message"
+else
+ flash "NOT CHARGING" "$message"
+fi
diff --git a/scripts/.local/bin/personal/bar/status b/scripts/.local/bin/personal/bar/status
index da46bf0..661b60f 100755
--- a/scripts/.local/bin/personal/bar/status
+++ b/scripts/.local/bin/personal/bar/status
@@ -12,12 +12,26 @@ use() {
printf "%s^c%s^^b%s^ %s ^b%s^ %s ^b%s^" "$SEPARATOR" "$background" "$primary" "$1" "$accent" "$2" "$background"
}
+flash() {
+ second="$(date +'%s')"
+
+ if [ "$3" = "1" ]; then
+ if [ $((second % 2)) = 1 ]; then
+ printf "%s^c%s^^b%s^ %s ^c%s^^b%s^ %s ^b%s^" "$SEPARATOR" "$color1" "$background" "$1" "$color1" "$background" "$2" "$background"
+ else
+ printf "%s^c%s^^b%s^ %s ^c%s^^b%s^ %s ^b%s^" "$SEPARATOR" "$background" "$color1" "$1" "$background" "$color1" "$2" "$background"
+ fi
+ else
+ echo ""
+ fi
+}
+
# show in specified color if specified condition is true
usecolorif() {
if [ "$3" = "1" ]; then
printf "%s^c%s^^b%s^ %s ^c%s^^b%s^ %s ^b%s^" "$SEPARATOR" "$primary" "$background" "$1" "$accent" "$background" "$2" "$background"
else
- use "$1" "$2"
+ echo ""
fi
}
@@ -35,6 +49,7 @@ $(useif "󰍬" "$(mute shortstatus)")\
$(useif "󰕾" "$(volume)")\
$(useif "󰒢" "$(network)")\
$(use "󰘚" "$(load) | $(temp)")\
-$(use "󱐋" "$(battery)")\
+$(flash "󱐋" "$(ischarging)" "$(ischarging > /dev/null; echo $?)")\
$(use "󰃭" "$(datetime)")\
"
+# $(use "󱐋" "$(battery)")\