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.

panel_bar 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #! /bin/sh
  2. #
  3. # Example panel for lemonbar
  4. . panel_colors
  5. num_mon=$(bspc query -M | wc -l)
  6. while read -r line ; do
  7. case $line in
  8. S*)
  9. # clock output
  10. sys="%{F$COLOR_SYS_FG}%{B$COLOR_SYS_BG} ${line#?} %{B-}%{F-}"
  11. ;;
  12. Z*)
  13. # battery output
  14. bat="%{F$COLOR_SYS_FG}%{B$COLOR_SYS_BG} ${line#?} %{B-}%{F-}"
  15. ;;
  16. X*)
  17. # sound output
  18. sound="%{F$COLOR_SYS_FG}%{B$COLOR_SYS_BG} ${line#?} %{B-}%{F-}"
  19. ;;
  20. V*)
  21. # brightness output
  22. bright="%{F$COLOR_SYS_FG}%{B$COLOR_SYS_BG} ${line#?} %{B-}%{F-}"
  23. ;;
  24. T*)
  25. # xtitle output
  26. title="%{F$COLOR_TITLE_FG}%{B$COLOR_TITLE_BG} ${line#?} %{B-}%{F-}"
  27. ;;
  28. W*)
  29. # bspwm's state
  30. wm=""
  31. IFS=':'
  32. set -- ${line#?}
  33. while [ $# -gt 0 ] ; do
  34. item=$1
  35. name=${item#?}
  36. case $item in
  37. [mM]*)
  38. [ $num_mon -lt 2 ] && shift && continue
  39. case $item in
  40. m*)
  41. # monitor
  42. FG=$COLOR_MONITOR_FG
  43. BG=$COLOR_MONITOR_BG
  44. ;;
  45. M*)
  46. # focused monitor
  47. FG=$COLOR_FOCUSED_MONITOR_FG
  48. BG=$COLOR_FOCUSED_MONITOR_BG
  49. ;;
  50. esac
  51. wm="${wm}%{F${FG}}%{B${BG}}%{A:bspc monitor -f ${name}:} ${name} %{A}%{B-}%{F-}"
  52. ;;
  53. [fFoOuU]*)
  54. case $item in
  55. f*)
  56. # free desktop
  57. FG=$COLOR_FREE_FG
  58. BG=$COLOR_FREE_BG
  59. ;;
  60. F*)
  61. # focused free desktop
  62. FG=$COLOR_FOCUSED_FREE_FG
  63. BG=$COLOR_FOCUSED_FREE_BG
  64. ;;
  65. o*)
  66. # occupied desktop
  67. FG=$COLOR_OCCUPIED_FG
  68. BG=$COLOR_OCCUPIED_BG
  69. ;;
  70. O*)
  71. # focused occupied desktop
  72. FG=$COLOR_FOCUSED_OCCUPIED_FG
  73. BG=$COLOR_FOCUSED_OCCUPIED_BG
  74. ;;
  75. u*)
  76. # urgent desktop
  77. FG=$COLOR_URGENT_FG
  78. BG=$COLOR_URGENT_BG
  79. ;;
  80. U*)
  81. # focused urgent desktop
  82. FG=$COLOR_FOCUSED_URGENT_FG
  83. BG=$COLOR_FOCUSED_URGENT_BG
  84. ;;
  85. esac
  86. wm="${wm}%{F${FG}}%{B${BG}}%{A:bspc desktop -f ${name}:} ${name} %{A}%{B-}%{F-}"
  87. ;;
  88. [LTG]*)
  89. # layout, state and flags
  90. wm="${wm}%{F$COLOR_STATE_FG}%{B$COLOR_STATE_BG} ${name} %{B-}%{F-}"
  91. ;;
  92. esac
  93. shift
  94. done
  95. ;;
  96. esac
  97. printf "%s\n" "%{l}${wm}%{c}${title}%{r}${bright}${sound}${bat}${sys}"
  98. done