You are not logged in.

#1 2015-08-27 09:53:27

pataracts
Member
From: Canada
Registered: 2015-08-27
Posts: 9

[SOLVED] Configuring a specific panel for bspwm.

Hey all,

I've been trying unsuccessfully to replicate a bspwm configuration found here: [Link] [Screenshot] [Dotfiles]

I have bspwm and sxhkd up and running, and a panel does show at the top of my screen, but it is all one colour (grey) with no output. I have read the archwiki pages on bspwm and lemonbar and have bar installed. I decided to try and make a more simplified version of the layout above, so I attempted to omit all but the time/date, desktop selectors (in the middle), and xtitle.

Here are (I think) the relevant files:

~/bin/panel/panel

#! /bin/sh

if [ $(pgrep -cx panel) -gt 1 ] ; then
        printf "%s\n" "The panel is already running." >&2
        exit 1
fi

trap 'trap - TERM; kill 0' INT TERM QUIT EXIT

[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO"
mkfifo "$PANEL_FIFO"

PANEL_HEIGHT=16

bspc config top_padding $PANEL_HEIGHT

bspc control --subscribe > "$PANEL_FIFO" &
xtitle -sf 'T%s' > "$PANEL_FIFO" &
clock -sf 'S%a %H:%M' > "$PANEL_FIFO" &

. panel_colors

cat "$PANEL_FIFO" | panel_bar | lemonbar -g x$PANEL_HEIGHT -F "$COLOR_FOREGROUND" -B "$COLOR_BACKGROUND" &

wait
~/bin/panel/panel_bar

#! /bin/sh
#
# Example panel for LemonBoy's bar

font_family='DejaVu Sans'
font_size=12

. panel_colors

screen_width=$(sres -W)
NORMIFS=$IFS
FIELDIFS=':'
PADDING='  '

while read -r line ; do
        case $line in
                S*)
                        # clock output
                        sys_infos="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${line#?} %{B-}%{F-}"
                        ;;
                T*)
                        # xtitle output
                        title="%{F$COLOR_TITLE_FG}%{B$COLOR_TITLE_BG} ${line#?} %{B-}%{F-}"
                        ;;
                W*)
                        # bspwm internal state
                        wm_infos="^bg($COLOR_B)^fg($COLOR_BACKGROUND)^bg($COLOR_B)$PADDING"
                        IFS=$FIELDIFS
                        set -- ${line#?}
                        while [ $# -gt 0 ] ; do
                                item=$1
                                                        U*)
                                                                # focused urgent desktop
                                                                # FG=$COLOR_FOCUSED_URGENT_FG
                                                                BG=$COLOR_STATUS_FG
                                                                ICO="○"
                                                                ;;
                                                        o*)
                                                                # occupied desktop
                                                                FG=$COLOR_D
                                                                BG=$COLOR_OCCUPIED_BG
                                                                ICO="●"
                                                                ;;
                                                        f*)
                                                                # free desktop
                                                                FG=$COLOR_D
                                                                BG=$COLOR_FREE_BG
                                                                ICO="○"
                                                                ;;
                                                        u*)
                                                                # urgent desktop
                                                                FG=$COLOR_D
                                                                BG=$COLOR_URGENT_BG
                                                                ICO="○"
                                                                ;;
                                                esac
                                                wm_infos="${wm_infos}^fg(${FG})^ca(1, bspc desktop -f ${name})^ca(2, bspc window -d ${name}) ${ICO} ^ca()^ca()"
                                                ;;
                                        L*)
                                                # layout
                                                layout=$(printf "%s" "${item#?}" | sed 's/^\(.\).*/\U\1/')
                                                # ^ca(1, bspc desktop -l next)${PADDING}$layout${PADDING}^ca()
                                                wm_infos="${wm_infos}${PADDING}^fg($COLOR_BACKGROUND)^fg()^bg()${PADDING}${PADDING}^fg($COLOR_LAYOUT_FG)^bg($COLOR_LAYOUT_BG)"
                                                ;;
                                esac
                                shift
                        done
                        IFS=$NORMIFS
                        ;;
        esac
        lt="${title}"
        set -- $(printf '%s\0%s\0%s' "$lt" "$wm_infos" "$sys_infos" | sed 's/\^[a-z]\+([^)]*)//g' | xargs -0 txtw -f "$font_family" -s "$font_size")
        left_width=$1
        center_width=$2
        right_width=$3
        left_indent=0
        right_indent=$((screen_width - right_width - 34))
        available_center=$((screen_width - (left_width + right_width)))
        if [[ $available_center -lt $center_width ]] ; then
                center_indent=$left_width
        else
                max_left_right_width=$left_width
                [[ $left_width -lt $right_width ]] && max_left_right_width=$right_width
                if [[ $((2 * max_left_right_width + center_width)) -gt $screen_width ]] ; then
                        center_indent=$((left_width + (available_center - center_width) / 2))
                else
                        center_indent=$(((screen_width - center_width) / 2 + 10))
                        #center_indent=$(((screen_width - left_width - right_width - center_width ) / 2 + left_width))
                fi
        fi
        printf "%s\n" "^pa($center_indent)$wm_infos^pa($left_indent)^fg($COLOR_DECOR)^fg($COLOR_TITLE_FG)$lt^pa($right_indent)$sys_infos"
done
~/.config/bspwm/bspwmrc

#! /bin/sh

bspc config split_ratio         0.52
bspc config borderless_monocle  true
bspc config gapless_monocle     true
bspc config focus_by_distance   true

bspc monitor -d 0 1 2 3 4 5 6 7 8 9

panel &

I suppose that this is a fairly ambitious project for a first-time linux user, first-time arch user, and first-time bspwm user, but any advice you could give to point me in the right direction would be greatly appreciated. Also, I apologize if I've used this forum incorrectly. This is my first post. smile

Last edited by pataracts (2016-04-11 00:17:48)

Offline

#2 2016-04-07 12:20:27

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,533
Website

Re: [SOLVED] Configuring a specific panel for bspwm.

pataracts wrote:

I suppose that this is a fairly ambitious project for a first-time linux user, first-time arch user, and first-time bspwm user, but any advice you could give to point me in the right direction would be greatly appreciated. Also, I apologize if I've used this forum incorrectly. This is my first post. smile

Welcome to the forums.  Unfortunately I have never used bspwm, so I can't be of much help here, but I'd say this was a very well presented post which makes it more than welcome here.

My only actual advice is to continue further simplifying: try the most ridiculously simple bar, maybe even just static text of one color (a bar "hello world" if you will).  In seeing others on the forums, it seems bspwm bar scripts are often fairly elaborate, and yours can grow back to that, but start with the hello world type just to identify if the script is even running and printing to the bar properly: is the problem somewhere in your script, or is it elsewhere (e.g., bar freezing up, fifos not being read or written, etc).


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2016-04-07 13:52:20

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,475

Re: [SOLVED] Configuring a specific panel for bspwm.

@OP; simple check, have you made your scripts executable?

Offline

#4 2016-04-07 18:53:22

raddecen
Member
Registered: 2015-12-19
Posts: 26

Re: [SOLVED] Configuring a specific panel for bspwm.

I use bspwm and lemonbar and all I can say is that don't try to replicate someone else's setup. Think about what you want in your panel. For example, do you really need weather reports in your panel?

I read your configuration file and you've written

bspc control --subscribe > "$PANEL_FIFO" &

If you're using the latest version of bspwm, i.e, 0.9.1-2, that syntax has been deprecated.

pataracts wrote:

first-time linux user, first-time arch user, and first-time bspwm user

smile You're gonna have to read man pages. Read the man page of bspwm, sxhkd and lemonbar. After you've done that, try creating a minimal setup. If you want, I can show you my config but I doubt that would help unless you understand the code.

Offline

#5 2016-04-11 00:17:29

pataracts
Member
From: Canada
Registered: 2015-08-27
Posts: 9

Re: [SOLVED] Configuring a specific panel for bspwm.

First off, thanks for the replies! I have been reading up on the Archwiki as well as the man pages for the programs. Trilby, I think you are right in that I should attempt to make my own configuration files first, so I understand what is going on. I have since moved on from this particular endeavour, but if I remember correctly, raddecen was correct in that the config file I was running was outdated. Although Docbroke's suggestion was a common mistake I personally had previously made earlier on in the process.

Offline

Board footer

Powered by FluxBB