Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/sh
- #
- # simplepanel.sh
- #
- SP_WIDTH=
- SP_HEIGHT=28
- SP_POSITION=
- SP_FONT="xos4Terminus:size=12"
- SP_OFFSET=0
- SP_BG_COLOR="#FFEFF0F1"
- SP_BG_COLOR_1="#FF3DAEE9"
- SP_FG_COLOR="#FF101010"
- SP_FG_COLOR_1="grey"
- SP_INIT_DELAY=0.02
- # lemonbar format codes
- BC="%{B-}"
- BC1="%{B$SP_BG_COLOR_1}"
- FC="%{F-}"
- FC1="%{F$SP_FG_COLOR_1}"
- SEPARATOR=" $FC1│$FC "
- CENTER="%{c}"
- RIGHT="%{r}"
- # panel structure
- sp_modules=(
- sp_spacer
- sp_main_menu
- sp_separator
- sp_bspwm_status
- sp_separator
- sp_center
- sp_window_title
- sp_right
- sp_separator
- sp_conky_info
- sp_separator
- sp_clock
- sp_separator
- sp_button_hello
- sp_spacer
- )
- # number of modules
- sp_mod_count=${#sp_modules[@]}
- # module definitions
- sp_spacer()
- {
- echo " "
- }
- sp_main_menu()
- {
- echo "%{A:morc_menu:} Menu %{A}"
- }
- sp_separator()
- {
- echo "$SEPARATOR"
- }
- sp_center()
- {
- echo "$CENTER"
- }
- sp_right()
- {
- echo "$RIGHT"
- }
- sp_bspwm_status()
- {
- IFS=':'
- bspc subscribe \
- | while read line; do
- set -- $line
- while [ $# -gt 0 ] ; do
- case $1 in
- O*|F*|U*) printf "%s %s %s" $BC1 ${1#?} $BC ;;
- o*|u*) printf " %s " ${1#?} ;;
- *) ;;
- esac
- shift
- done
- printf "\n";
- done
- }
- sp_window_title()
- {
- xtitle -s -t -40
- }
- sp_conky_info()
- {
- echo '
- conky.config = {
- out_to_x = false,
- out_to_console = true,
- use_spacer = "no",
- default_graph_width = 8,
- console_graph_ticks = " ,_,▁,▂,▃,▄,▅,▆,▇,█",
- out_to_stderr = false,
- cpu_avg_samples = 2,
- no_buffers = true,
- update_interval = 1
- };
- conky.text =
- [[
- CPU: \
- ${cpu}%\
- '$SEPARATOR'\
- ${wireless_essid wlp2s0} \
- ${wireless_link_qual_perc wlp2s0}%
- ]]
- ' | conky -q -c -
- }
- sp_clock()
- {
- while true; do
- date +%T
- sleep 1;
- done
- }
- sp_button_hello()
- {
- echo "%{A:notify-send Hello!:} Click me! %{A}"
- }
- # initialize panel
- sp_panel_init()
- {
- for (( i=0; i<$sp_mod_count; i++ )); do
- ${sp_modules[$i]} \
- | while read; do
- printf "%s/%s\n" "$i" "$REPLY"
- sleep $SP_INIT_DELAY;
- done &
- sleep $SP_INIT_DELAY;
- done
- }
- # update panel
- sp_panel_update()
- {
- while read; do
- sp_value[${REPLY%%/*}]=${REPLY#*/}
- for (( i=0; i<$sp_mod_count; i++ )); do
- printf "%s" "${sp_value[$i]}";
- done
- printf "\n"
- done
- }
- # main
- sp_panel_init \
- | sp_panel_update \
- | lemonbar \
- -g ${SP_WIDTH}x${SP_HEIGHT}${SP_POSITION} \
- -f $SP_FONT \
- -o $SP_OFFSET \
- -B $SP_BG_COLOR \
- -F $SP_FG_COLOR \
- | while read; do eval "$REPLY"; done;
- wait
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement