My personal dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bar.sh 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #!/bin/bash
  2. HIGHLIGHT="#D8DEE9"
  3. clock() {
  4. TIME=$(date "+%H:%M")
  5. DATE=$(date "+%a %d/%m/%y")
  6. echo -n "%{F$HIGHLIGHT}$(printf '%b' "\uf017")%{F-} $TIME %{F$HIGHLIGHT}$(printf '%b' "\uf073")%{F-} $DATE"
  7. }
  8. volume() {
  9. VOL=$(amixer get Master | grep % | sed -n 1p | awk -F '[' '{print $2}' | awk -F ']' '{print $1}')
  10. if [ $VOL = '0%' ]; then
  11. echo -n "%{F$HIGHLIGHT}$(printf '%b' "\uf026")%{F-} Mute"
  12. else
  13. echo -n "%{F$HIGHLIGHT}$(printf '%b' "\uf028")%{F-} $VOL"
  14. fi
  15. }
  16. wifi() {
  17. echo -e "%{F$HIGHLIGHT} \uf1eb %{F-}$(iw wlp2s0 link | grep 'SSID' | cut -c 8-)"
  18. }
  19. music() {
  20. SONG=$(mpc current)
  21. if [ -n $SONG ]; then
  22. echo -n ""
  23. else
  24. echo -n " %{F$HIGHLIGHT}$(printf '%b' "\uf01d")%{F-} $SONG "
  25. fi
  26. }
  27. #Copied from /u/Dylan112
  28. workspace() {
  29. workspacenext="A4:i3-msg workspace next_on_output:"
  30. workspaceprevious="A5:i3-msg workspace prev_on_output:"
  31. wslist=$(\
  32. wmctrl -d \
  33. | awk '/ / {print $2 $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20}' ORS=''\
  34. | sed -e 's/\s* //g' \
  35. -e 's/\*[ 0-9A-Za-z]*[^ -~]*/ & /g' \
  36. -e 's/\-[ 0-9A-Za-z]*[^ -~]*/%{F#525252}%{A:i3-msg workspace &:} & %{A}%{F#A0A0A0}/g' \
  37. -e 's/\*//g' \
  38. -e 's/ -/ /g' \
  39. )
  40. echo -n "%{$workspacenext}%{$workspaceprevious}$wslist%{A}%{A}"
  41. }
  42. windowtitle(){
  43. # Grabs focused window's title
  44. # The echo "" at the end displays when no windows are focused.
  45. TITLE=$(xdotool getactivewindow getwindowname 2>/dev/null | sed -n 1p || echo "")
  46. TITLECUT=$(xdotool getactivewindow getwindowname 2>/dev/null | sed -n 1p | sed 's/\///g;s/-//g;s/ /\\/g' | cut -c 1-6 || echo "")
  47. if [ "$TITLECUT" = "glenn@" ]; then
  48. echo "$(printf '%b' "\ue1d9") $(echo "$TITLE" | cut -c 15-50)"
  49. else
  50. echo "$TITLE" | cut -c 1-50
  51. fi
  52. }
  53. bat() {
  54. status=$(cat /sys/class/power_supply/BAT0/status)
  55. capacity=$(cat /sys/class/power_supply/BAT0/capacity)
  56. if [ "$status" == "Charging" ]; then
  57. echo -e "%{F$HIGHLIGHT} \uf240 %{F-}$capacity%"
  58. elif (($capacity == 100)); then
  59. echo -e "%{F$HIGHLIGHT} \uf240 %{F-}$capacity%"
  60. elif (($capacity > 82)); then
  61. echo -e "%{F$HIGHLIGHT} \uf241 %{F-}$capacity%"
  62. elif (($capacity > 62)); then
  63. echo -e "%{F$HIGHLIGHT} \uf241 %{F-}$capacity%"
  64. elif (($capacity > 32)); then
  65. echo -e "%{F$HIGHLIGHT} \uf242 %{F-}$capacity%"
  66. elif (($capacity > 0)); then
  67. echo -e "%{F$HIGHLIGHT} \uf243 %{F-}$capacity%"
  68. else
  69. echo -e "%{F$HIGHLIGHT} \uf240 %{F-}$capacity%"
  70. fi
  71. }
  72. while true; do
  73. echo "%{B#2E3440} $(clock) $(volume) $(bat) $(wifi) %{B-}%{c} $(workspace) %{r}%{B-} %{B#3B4252}%{B#2E3440} $(windowtitle) %{B-}"
  74. #echo "%{B#c0303048} $(clock) $(volume) $(mail) $(bat) $(wifi) %{B-}%{c} $(workspace) %{r}%{B-} %{B#3b3b4b}$(music)%{B#c0303048} $(windowtitle) %{B-}"
  75. #echo "%{B#c0303048} $(clock) $(volume) $(mail) $(bat) $(wifi) %{B-}%{c} $(workspace) %{r}%{B-} %{B#5d6383}$(music)%{B#c0303048} $(windowtitle) %{B-}"
  76. sleep 1;
  77. done |
  78. # -f '-xos4-terminus-medium-r-normal--12-120-72-72-c-60-iso10646-1'\
  79. #old one was '-g 1280x20+45'
  80. #lemonbar -p -d -B#c0262626 -F#A0A0A0 -g 1834x20+45+0\
  81. # -f '-xos4-terminus-medium-r-normal--12-120-72-72-c-60-iso10646-1'\
  82. # -f '-wuncon-siji-medium-r-normal--10-100-75-75-c-80-iso10646-1'\
  83. # eDP-1\
  84. # | zsh
  85. lemonbar -p -d -B#2E3440 -F#A0A0A0 -g 1834x25+45+0\
  86. -f FiraMono:size=11\
  87. -f FontAwesome:size=13\
  88. eDP-1\
  89. | zsh