Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2014
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.13 KB | None | 0 0
  1. #! /bin/sh
  2. #
  3. # Example panel for LemonBoy's bar
  4.  
  5. . panel_colors
  6.  
  7. num_mon=$(bspc query -M | wc -l)
  8.  
  9. while read -r line ; do
  10.     case $line in
  11.         S*)
  12.             # clock output
  13.            
  14. sys_infos="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${line#?}
  15. %{B-}%{F-}"
  16.             ;;
  17.         T*)
  18.             # xtitle output
  19.             title="%{F$COLOR_TITLE_FG}%{B$COLOR_TITLE_BG}
  20. ${line#?} %{B-}%{F-}"
  21.             ;;
  22.         W*)
  23.             # bspwm internal state
  24.             wm_infos=""
  25.             IFS=':'
  26.             set -- ${line#?}
  27.             while [ $# -gt 0 ] ; do
  28.                 item=$1
  29.                 name=${item#?}
  30.                 case $item in
  31.                     M*)
  32.                         # active monitor
  33.                         if [ $num_mon -gt 1 ] ;
  34. then
  35.                            
  36. wm_infos="$wm_infos
  37. %{F$COLOR_ACTIVE_MONITOR_FG}%{B$COLOR_ACTIVE_MONITOR_BG} ${name}
  38. %{B-}%{F-}  "
  39.                         fi
  40.                         ;;
  41.                     m*)
  42.                         # inactive monitor
  43.                         if [ $num_mon -gt 1 ] ;
  44. then
  45.                            
  46. wm_infos="$wm_infos
  47. %{F$COLOR_INACTIVE_MONITOR_FG}%{B$COLOR_INACTIVE_MONITOR_BG} ${name}
  48. %{B-}%{F-}  "
  49.                         fi
  50.                         ;;
  51.                     O*)
  52.                         # focused occupied
  53. desktop
  54.                        
  55. wm_infos="${wm_infos}%{F$COLOR_FOCUSED_OCCUPIED_FG}%{B$COLOR_FOCUSED_OCCUPIED_BG}%{U$COLOR_FOREGROUND}%{+u}
  56. ${name} %{-u}%{B-}%{F-}"
  57.                         ;;
  58.                     F*)
  59.                         # focused free desktop
  60.                        
  61. wm_infos="${wm_infos}%{F$COLOR_FOCUSED_FREE_FG}%{B$COLOR_FOCUSED_FREE_BG}%{U$COLOR_FOREGROUND}%{+u}
  62. ${name} %{-u}%{B-}%{F-}"
  63.                         ;;
  64.                     U*)
  65.                         # focused urgent
  66. desktop
  67.                        
  68. wm_infos="${wm_infos}%{F$COLOR_FOCUSED_URGENT_FG}%{B$COLOR_FOCUSED_URGENT_BG}%{U$COLOR_FOREGROUND}%{+u}
  69. ${name} %{-u}%{B-}%{F-}"
  70.                         ;;
  71.                     o*)
  72.                         # occupied desktop
  73.                        
  74. wm_infos="${wm_infos}%{F$COLOR_OCCUPIED_FG}%{B$COLOR_OCCUPIED_BG}
  75. ${name} %{B-}%{F-}"
  76.                         ;;
  77.                     f*)
  78.                         # free desktop
  79.                        
  80. wm_infos="${wm_infos}%{F$COLOR_FREE_FG}%{B$COLOR_FREE_BG} ${name}
  81. %{B-}%{F-}"
  82.                         ;;
  83.                     u*)
  84.                         # urgent desktop
  85.                        
  86. wm_infos="${wm_infos}%{F$COLOR_URGENT_FG}%{B$COLOR_URGENT_BG} ${name}
  87. %{B-}%{F-}"
  88.                         ;;
  89.                     L*)
  90.                         # layout
  91.                         wm_infos="$wm_infos  
  92. %{F$COLOR_LAYOUT_FG}%{B$COLOR_LAYOUT_BG} ${name} %{B-}%{F-}"
  93.                         ;;
  94.                 esac
  95.                 shift
  96.             done
  97.             ;;
  98.     esac
  99.     printf "%s\n" "%{l}${wm_infos}%{c}${title}%{r}${sys_infos}"
  100. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement