Bar at the bottom bc why the hell not
This commit is contained in:
@@ -1,21 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
# Get battery status
|
BATTERY=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -E "state|to full|percentage" | awk -F': +' '
|
||||||
STATUS=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -E "state|to full|percentage" | awk -F': +' '
|
|
||||||
/state:/{s=$2}
|
/state:/{s=$2}
|
||||||
/time to full:/{split($2,a,",");h=int(a[1])}
|
/time to full:/{split($2,a,",");h=int(a[1])}
|
||||||
/percentage:/{gsub(",",".",$2);p=$2}
|
/percentage:/{gsub(",",".",$2);p=$2}
|
||||||
END{if(s=="charging") printf("%dh - %.2f%%\n",h,p)}
|
END{if(s=="charging") printf("%dh - %.2f%%\n",h,p)}
|
||||||
')
|
')
|
||||||
|
|
||||||
# Get current date and time
|
|
||||||
DATE=$(date +'%Y-%m-%d %X')
|
DATE=$(date +'%Y-%m-%d %X')
|
||||||
|
|
||||||
# Get volume of the default sink
|
|
||||||
VOLUME=$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}')
|
VOLUME=$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}')
|
||||||
|
echo "$VOLUME | $BATTERY | $DATE"
|
||||||
# Combine the output
|
|
||||||
echo "$STATUS | Volume: $VOLUME | $DATE"
|
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|||||||
2
config
2
config
@@ -223,7 +223,7 @@ bindsym $mod+r mode "resize"
|
|||||||
#
|
#
|
||||||
# Read `man 5 sway-bar` for more information about this section.
|
# Read `man 5 sway-bar` for more information about this section.
|
||||||
bar {
|
bar {
|
||||||
position top
|
position bottom
|
||||||
|
|
||||||
# When the status_command prints a new line to stdout, swaybar updates.
|
# When the status_command prints a new line to stdout, swaybar updates.
|
||||||
# The default just shows the current date and time.
|
# The default just shows the current date and time.
|
||||||
|
|||||||
Reference in New Issue
Block a user