1
0
Fork 0
mirror of https://github.com/Horhik/dotfiles.git synced 2024-11-26 18:11:33 +00:00
Dotfiles/home/xmonad/.config/xmobar/bin/xmobarstatus

108 lines
2.5 KiB
Plaintext
Raw Normal View History

2021-02-26 00:08:07 +00:00
#!/bin/bash
module GruvboxColors where
backgroundColor="#282828"
currentLineColor="#fabd2f"
selectionColor="#665c54"
foregroundColor="#ebdbb2"
foregroundSecondColor="#fbf1c1"
commentColor="#458588"
cyanColor="#83a598"
greenColor="#8ec07c"
greenDarkerColor="#689d6a"
orangeColor="#fe8019"
pinkColor="#d3869b"
purpleColor="#b16286"
redColor="#cc241d"
yellowColor="#fabd2f"
battery ()
{
val=$(acpi | grep -oh "[[:digit:]]*%" | grep -oh "[0-9]*")
case $val in
[1-9][0-9][0-9])
2021-03-08 08:41:46 +00:00
echo "<fc=$greenColor>—{ </fc>$val<fc=$greenColor>%}</fc>"
2021-02-26 00:08:07 +00:00
;;
[5-9][0-9])
2021-03-08 08:41:46 +00:00
echo "<fc=$greenColor>—{ </fc>$val<fc=$greenColor>%}</fc>"
2021-02-26 00:08:07 +00:00
;;
[1-4][0-9])
2021-03-08 08:41:46 +00:00
echo "<fc=$yellowColor>—{ </fc>$val<fc=$yellowColor>%}</fc>"
2021-02-26 00:08:07 +00:00
;;
[1-9])
2021-03-08 08:41:46 +00:00
echo "<fc=$orangeColor>—{ </fc>$val<fc=$orangeColor>%}</fc>"
2021-02-26 00:08:07 +00:00
;;
0)
echo "<fc=$redColor> </fc>"
;;
*)
2021-03-08 08:41:46 +00:00
echo "<fc=$greenColor>—{ </fc>$val<fc=$greenColor>%}</fc>"
2021-02-26 00:08:07 +00:00
;;
esac
}
volume ()
{
#maybe change to Right, Left, Mono
val=$(amixer sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }'| grep -oh "[0-9]*")
case $val in
100)
2021-03-08 08:41:46 +00:00
echo "<fc=$redColor>—{ $val%}</fc>"
2021-02-26 00:08:07 +00:00
;;
[5-9][0-9])
2021-03-08 08:41:46 +00:00
echo "<fc=$orangeColor>—{ $val%}</fc>"
2021-02-26 00:08:07 +00:00
;;
[1-4][0-9])
2021-03-08 08:41:46 +00:00
echo "<fc=$yellowColor>—{ $val%}</fc>"
2021-02-26 00:08:07 +00:00
;;
[1-9])
2021-03-08 08:41:46 +00:00
echo "<fc=$greenDarkerColor>—{ $val%}</fc>"
2021-02-26 00:08:07 +00:00
;;
0)
2021-03-08 08:41:46 +00:00
echo "<fc=$currentLineColor>—{}</fc>"
2021-02-26 00:08:07 +00:00
;;
*)
2021-03-08 08:41:46 +00:00
echo "<fc=$redColor>—{ $val%}</fc>"
2021-02-26 00:08:07 +00:00
esac
}
diskspace ()
{
#might be another /dev/sda...
2021-03-08 08:41:46 +00:00
echo "<fc=$pinkColor>—{ </fc>"$(df -h | grep sda2 | grep -oh "[0-9]*%")"<fc=$pinkColor>}</fc>"
2021-02-26 00:08:07 +00:00
}
2021-03-08 08:41:46 +00:00
2021-02-26 00:08:07 +00:00
wifi ()
{
name=$(connmanctl services | grep "*A" | grep -oh "^*A. [A-Za-z]*" | grep -oh "[[:space:]][A-Za-x]*" | head -n 1)
if [ $name != " " ];
then
2021-03-08 08:41:46 +00:00
echo "<fc=$cyanColor>—{ </fc>$name<fc=$cyanColor>}</fc>"
2021-02-26 00:08:07 +00:00
else
echo 睊 off
fi
}
layout ()
{
2021-03-08 08:41:46 +00:00
echo "<fc=$orangeColor>—{ </fc>"$(xkblayout-state print %s)"<fc=$orangeColor>}</fc>"
2021-02-26 00:08:07 +00:00
}
timeanddate ()
{
2021-03-08 08:41:46 +00:00
echo "<fc=$yellowColor>—{</fc>" "<fc=$yellowColor>$(date +'%T')}</fc>"
2021-02-26 00:08:07 +00:00
}
calendar ()
{
echo "<fc=$greenDarkerColor> </fc>"$(date +'%d/%m/%Y')
}
2021-03-08 08:41:46 +00:00
echo "$(wifi)$(battery)$(volume)$(layout)$(diskspace)$(timeanddate)<fc=$greenDarkerColor>—{</fc>$(calendar)<fc=$greenDarkerColor>}—-</fc>"
2021-02-26 00:08:07 +00:00
#echo "                                          "