[MAJOR] updated xmobar scripts (battery and updates)

This commit is contained in:
Afonso Franco 2023-10-13 10:27:49 +01:00
parent 7ee6ae2359
commit 8e5166a3f8
Signed by: afonso
SSH key fingerprint: SHA256:JiuxZNdA5bRWXPMUJChI0AQ75yC+cXY4xM0IaVwEVys
3 changed files with 28 additions and 14 deletions

View file

@ -1,8 +1,19 @@
#!/bin/bash
if [ "$(acpi)" == "No support for device type: power_supply" ]
#Check if its laptop of pc with hostnamectl
pctype=$(hostnamectl | grep -Po '(Chassis: )(\w+)' | sed 's/Chassis: //')
if [ "$pctype" == "desktop" ];
then
echo ""
#Check if any connected device has a battery with upower
xm3bat=$(upower -i /org/freedesktop/UPower/devices/headset_dev_94_DB_56_AB_B5_D4 | grep -Po '(percentage: *)(\d+)' | sed 's/\s*percentage: //' | xargs)
if [ "$xm3bat" == 0 ];
then
echo ""
exit 0
fi
echo "<fn=3>󰋋</fn><fc=#AAC0F0> $xm3bat%</fc>"
exit 0
fi
batLevel=$(acpi --battery | grep -Po '(\d+)\%' | sed 's/%//')

View file

@ -0,0 +1,4 @@
#!/bin/bash
update_number=$(checkupdates | wc -l)
echo "<fn=6>󰣇 </fn> <fc=#AAC0F0>$update_number</fc>"

View file

@ -22,18 +22,16 @@ Config {font = "Ubuntu bold 10"
, persistent = False
, iconRoot = "/home/afonso/.config/xmobar/xpm/" -- default: "."
, commands = [
Run XMonadLog
Run XMonadLog
, Run Date "%a, %d %b <fn=1></fn> %H:%M" "date" 10
, Run Mpris2 "playerctld" ["-t", "<fc=#AAC0F0><artist> - <title></fc>"] 10
, Run Memory ["-t","<fn=6></fn> <fc=#AAC0F0><usedratio></fc>%"] 10
, Run Com "/home/afonso/.config/xmobar/scripts/disk.sh" [] "disk" 10
, Run Com "/home/afonso/.config/xmobar/scripts/cpu_temp.sh" [] "cpu" 10
, Run Com "/home/afonso/.config/xmobar/scripts/volume.sh" [] "volume" 10
, Run Com "/home/afonso/.config/xmobar/scripts/bluetooth.sh" [] "bluetooth" 10
, Run Com "/home/afonso/.config/xmobar/scripts/network.sh" [] "network" 10
, Run Com "/home/afonso/.config/xmobar/scripts/battery.sh" [] "battery" 20
, Run Com "/home/afonso/.config/xmobar/scripts/trayer-padding-icon.sh" [] "trayerpad" 20
]
, Run Memory ["-t","<fn=6></fn> <fc=#AAC0F0><usedratio></fc>%"] 50
, Run Com "/home/afonso/.config/xmobar/scripts/disk.sh" [] "disk" 100
, Run Com "/home/afonso/.config/xmobar/scripts/cpu_temp.sh" [] "cpu" 50
, Run Com "/home/afonso/.config/xmobar/scripts/battery.sh" [] "battery" 50
, Run Com "/home/afonso/.config/xmobar/scripts/updates.sh" [] "updates" 6000
, Run Com "/home/afonso/.config/xmobar/scripts/trayer-padding-icon.sh" [] "trayerpad" 20
]
, sepChar = "%"
, alignSep = "}{"
, template = " <icon=logo.xpm/> \
@ -47,6 +45,9 @@ Config {font = "Ubuntu bold 10"
\ \
\|\
\ \
\%updates%\
\ \
\ \
\%memory%\
\ \
\ \
@ -57,8 +58,6 @@ Config {font = "Ubuntu bold 10"
\ \
\ \
\%battery%\
\ \
\ \
\|\
\%trayerpad%"
}