LemonBoy / bar

A featherweight, lemon-scented, bar based on xcb
MIT License
1.62k stars 194 forks source link

workspaces don't show when bar is started until I focus on an app #180

Closed gavsiu closed 8 years ago

gavsiu commented 8 years ago

Workspaces show and work when clicked, but it doesn't show up right after I start my panel. The area is blank until I change my focus. When after logging in, it doesn't show until I open an app.


source $(dirname $0)/panel_colors
source $(dirname $0)/panel_config

num_mon=$(bspc query -M | wc -l)
PAD="  "
SEP="$PAD"

while read -r line ; do
    case $line in
        TITLE*)
            # Xtitle output
            if [[ ${line#?????} ]]; then
                title="$ICON_TITLE ${line#?????}"
            else
                title=""
            fi
            ;;
        TIME*)
            # Clock output
            clock="${SEP}${line#????}"
            ;;
        DATE*)
            # Date output
            date="${SEP}${line#????}"
            ;;
        BAT*)
            # Battery output
            battery="${SEP}${line#???}"
            ;;
        VOL*)
            # Volume output
            volume="${SEP}${line#???}"
            ;;
        DISPLAY*)
            # Display brightness output
            display="${SEP}${line#???????}"
            ;;
        LINK*)
            # Link output
            link="${SEP}${line#????}"
            ;;
        W*)
            # Bspwm's state
            wm=""
            IFS=':'
            set -- ${line#?}
            while [ $# -gt 0 ] ; do
                item=$1
                name=${item#?}
                case $item in
                    [mM]*)
                        [ $num_mon -lt 2 ] && shift && continue
                        case $item in
                            m*)
                                # Monitor
                                FG=$COLOR_MONITOR_FG
                                BG=$COLOR_MONITOR_BG
                                ;;
                            M*)
                                # Focused monitor
                                FG=$COLOR_FOCUSED_MONITOR_FG
                                BG=$COLOR_FOCUSED_MONITOR_BG
                                ;;
                        esac
                        icon="${name/eDP1/$ICON_LAPTOP}"
                        wm="${wm}%{F${FG}}%{B${BG}}%{A:bspc monitor -f ${name}:} ${icon} %{A}%{B-}%{F-}"
                        ;;
                    [fFoOuU]*)
                        case $item in
                            f*)
                                # Free desktop
                                FG=$COLOR_FREE_FG
                                BG=$COLOR_FREE_BG
                                ;;
                            F*)
                                # Focused free desktop
                                FG=$COLOR_FOCUSED_FREE_FG
                                BG=$COLOR_FOCUSED_FREE_BG
                                ;;
                            o*)
                                # Occupied desktop
                                FG=$COLOR_OCCUPIED_FG
                                BG=$COLOR_OCCUPIED_BG
                                ;;
                            O*)
                                # Focused occupied desktop
                                FG=$COLOR_FOCUSED_OCCUPIED_FG
                                BG=$COLOR_FOCUSED_OCCUPIED_BG
                                ;;
                            u*)
                                # Urgent desktop
                                FG=$COLOR_URGENT_FG
                                BG=$COLOR_URGENT_BG
                                ;;
                            U*)
                                # Focused urgent desktop
                                FG=$COLOR_FOCUSED_URGENT_FG
                                BG=$COLOR_FOCUSED_URGENT_BG
                                ;;
                        esac
                        wm="${wm}%{F${FG}}%{B${BG}}%{A:bspc desktop -f ${name}:} ${name} %{A}%{B-}%{F-}"
                        ;;
                    G*) # Default [LTG]*
                        # Layout, state and flags
                        if [[ $name ]] ; then
                            wm="${wm}${SEP}$ICON_FLAG ${name}"
                        fi
                        ;;
                esac
                shift
            done
            ;;
    esac
    printf "%s\n" "%{l}${PAD}${wm}${SEP}${title}%{r}${link}${display}${volume}${battery}${date}${clock}${PAD}"
done
LemonBoy commented 8 years ago

Until the first read call completes and a whole line is read you're not piping anything at all into the bar.

gavsiu commented 8 years ago

But everything else displays?

LemonBoy commented 8 years ago

Oh I see, anyway the problem lies in the script and not in bar, double-check the script and re-open this in the unlikely case there's a rendering problem in bar.