#! /bin/dash #panel script for bspwm using i3 style workspace indicator #set height and font if unset if ! [ -f "$HOME/.limepanelrc" ]; then cat > "$HOME"/.limepanelrc </dev/null 2>&1 } sigStrength() { if ip link show | grep -q 'state UP'; then if ! is_wifi; then echo %{F$COLOR_FOCUSED_DESKTOP_FG}$wired_icon else signalStrength=$(awk 'NR==3 {print $3}' /proc/net/wireless) case "$signalStrength" in 100|[6-9]*) echo %{F$COLOR_FOCUSED_DESKTOP_FG}"▁▃▅▇" ;; [4-5]*) echo %{F$COLOR_FOCUSED_DESKTOP_FG}"▁▃▅""$DARKGREY""▇"%{F$COLOR_FOCUSED_DESKTOP_FG} ;; [1-3]*) echo %{F$COLOR_FOCUSED_DESKTOP_FG}"▁▃""$DARKGREY""▅▇"%{F$COLOR_FOCUSED_DESKTOP_FG} ;; *) echo "$DARKGREY""▁▃▅▇ "%{F$COLOR_FOCUSED_DESKTOP_FG} ;; esac fi else echo "$DARKGREY$disconnected_icon"%{F$COLOR_FOCUSED_DESKTOP_FG} fi } battery() { BATC=$(cat /sys/class/power_supply/BAT*/capacity) BATS=$(cat /sys/class/power_supply/BAT*/status) if [ "$BATS" = "Charging" ]; then echo "$charging_icon $BATC%" else case "$BATC" in 1??|9*) echo "$battery_full_icon $BATC%" ;; 100|[7-8]*) echo "$battery_draining_icon $BATC%" ;; [4-6]*) echo "$battery_half_icon $BATC%" ;; *) echo "$RED$battery_low_icon $BATC%%{F$COLOR_FOCUSED_DESKTOP_FG}" ;; esac fi } clock() { date '+%I:%M%P ' } status() { if [ -e /sys/class/power_supply/BAT*/ ]; then if [ "$wifi_indicator" = true ]; then while :; do echo "C%{A:"$networkmenu":}$(sigStrength)%{A} %{A:dbright:}$(battery)%{A} $time_icon $(clock)" sleep "$update_interval" done else while :; do echo "C%{A:dbright:}$(battery)%{A} $time_icon $(clock)" sleep "$update_interval" done fi else if [ "$wifi_indicator" = true ]; then while :; do echo "C%{A:"$networkmenu":}$(sigStrength)%{A} $time_icon $(clock)" sleep "$update_interval" done else while :; do echo "C$time_icon $(clock)" sleep "$update_interval" done fi fi } lime() { while read -r line ; do case "$line" in S*) switcher="%{A:MonocleSwitcher:}${line#?}%{A}" ;; T*) title="%{F$COLOR_TITLE}%{B$COLOR_DESKTOP_BG}${line#?}%{B-}%{F-}" ;; C*) conky_infos="%{F$COLOR_FOCUSED_DESKTOP_FG}${line#?}" ;; V*) volume_infos="${RA}%{F$COLOR_FOCUSED_DESKTOP_FG} ${line#?} " ;; W*) # bspwm internal state desktops="" IFS=':' set -- ${line#?} while [ $# -gt 0 ] ; do item=$1 name=${item#?} case $item in # always show focused desktops O*|F*|U*) desktops="${desktops}%{F$COLOR_FOCUSED_DESKTOP_FG}%{B$COLOR_FOCUSED_DESKTOP_BG}%{U"$COLOR_FOCUSED_DESKTOP_FG"}%{+u}${name}%{-u}$SP%{B-}%{F-}" ;; # show used unfocused (hide free unused) o*|u*)#f* desktops="${desktops}%{F$COLOR_DESKTOP_FG}%{B$COLOR_DESKTOP_BG}%{A:bspc desktop -f ${name}:}${name}%{A}%{B-}$SP%{F-}" ;; L*) # layout case "${name}" in T) layout_ind=" $tiling_icon" ;; M) layout_ind=" $monocle_icon" ;; *) layout_ind=" ${name}" ;; esac layout="%{F$COLOR_DESKTOP_FG}%{B$COLOR_DESKTOP_BG}%{A:bspc desktop -l next:}${layout_ind}%{B-}%{F-}%{A}" ;; esac shift done ;; esac printf "%s\n" "%{l}${logo}${desktops}${layout}${switcher}%{F$COLOR_DESKTOP_FG}%{c}${title}%{r}%{F$COLOR_FOCUSED_DESKTOP_FG}${window_button}$volume_infos${conky_infos}" done } i=1 # Remove old fifos and create new ones [ -e "$PANEL_FIFO$i" ] && rm "$PANEL_FIFO$i" mkfifo "$PANEL_FIFO$i" # Wm infos of specific monitor bspc subscribe > "$PANEL_FIFO$i" & # Title xtitle -sf 'T%s\n' -t $title_length > "$PANEL_FIFO$i" & # system tray if [ "$systemtray" -eq 1 ]; then # If there is no configuration, add one [ -e ~/.stalonetrayrc ] || cp /usr/share/limepanel/stalonetrayrc ~/.stalonetrayrc # Set height to match the panel sed -i "s/^icon_size .*/icon_size $PANEL_HEIGHT/" ~/.stalonetrayrc sed -i "s/^max_geometry.*/max_geometry 0x$PANEL_HEIGHT/" ~/.stalonetrayrc # Try to set position based on the resolution if [ -z $tray_pos ]; then monitor_width=$(wattr w $(lsw -r)) tray_pos=$((1600 + $monitor_width - 1920 )) echo 'tray_pos=1600' >> ~/.limepanelrc sed -i "s/^geometry .*/geometry 1x1+$tray_pos+0/" ~/.stalonetrayrc else sed -i "s/^geometry .*/geometry 1x1+$tray_pos+0/" ~/.stalonetrayrc fi sleep 0.2 && stalonetray & sleep 0.3 && bspc config top_padding $((panel_height-gap)) & fi # status status > /tmp/panel-fifo$i & # Volume-infos autoalsaconf volume_status.sh & # Pipe all the info to lemonbar cat $PANEL_FIFO$i \ | lime \ | lemonbar \ -d \ -g x$panel_height \ -f "$mainfont" -o 0\ -f "$iconfont" -o 0\ -f "$thirdfont" -o 0\ -F $COLOR_FOCUSED_DESKTOP_FG \ -B $COLOR_DESKTOP_BG \ -U $COLOR_TITLE \ -a 30 \ | while read line; do eval "$line"; done & #done wait