replace lemonbar with polybar and support two monitors

This commit is contained in:
Łukasz Pankowski 2020-07-14 21:53:01 +02:00
parent 0aaad0a08f
commit 2248367d98
3 changed files with 64 additions and 67 deletions

View File

@ -1,10 +1,23 @@
#! /bin/sh
sxhkd &
~/.config/bspwm/panel &
xdo lower $(xdo id -a panel)
bspc monitor -d 1 2 3 4 5 6 7 8 9 0
i=0
monitors=$(bspc query -M --names)
for monitor in $monitors; do
MONITOR="$monitor" polybar panel &
i=$((i + 1))
done
if [ $i -eq 1 ]; then
bspc monitor -d 1 2 3 4 5 6 7 8 9 0
else
monitor1=$(echo $monitors | cut -d ' ' -f 1)
monitor2=$(echo $monitors | cut -d ' ' -f 2)
bspc monitor "$monitor2" -d 1 2 3 4 5 6 7 8 9
bspc monitor "$monitor1" -d 0
bspc monitor "$monitor1" -s "$monitor2"
bspc monitor "$monitor2" -f
fi
bspc config border_width 2
bspc config window_gap 12
@ -18,4 +31,7 @@ bspc config single_monocle true
bspc config borderless_monocle true
bspc config gapless_monocle true
bspc config pointer_follows_focus true
bspc config pointer_follows_monitor true
bspc rule -a Gimp desktop='^8' state=floating follow=on

View File

@ -1,64 +0,0 @@
#!/bin/sh
BAR_BG='#1a343a'
BAR_FG='#f2f6e1'
ACTIVE_BG='#3585ce'
URGENT_BG='#9b0640'
FREE_FG='#808080'
PANEL_FIFO=~/.panel-fifo
[ -e "$PANEL_FIFO" ] && rm -f "$PANEL_FIFO"
mkfifo -m 600 "$PANEL_FIFO"
bspc subscribe > "$PANEL_FIFO" &
xtitle -sf 'T%s\n' > "$PANEL_FIFO" &
while true; do
echo "C$(date '+%H:%M')"
sleep 1
done > "$PANEL_FIFO" &
while read -r line ; do
case "$line" in
C*)
clock="${line#?}"
;;
T*)
title="${line#?}"
;;
W*)
wm=
IFS=':' set -- ${line#?}
while [ $# -gt 0 ]; do
item="$1"
name="${item#?}"
case "$item" in
[fFOoUu]*)
case "$item" in
[OF]*)
BG="${ACTIVE_BG}"
FG="-"
;;
o*)
BG="-"
FG="-"
;;
f*)
BG="-"
FG="${FREE_FG}"
;;
[uU]*)
BG="${URGENT_BG}"
FG="-"
;;
esac
wm="${wm}%{B${BG}}%{F${FG}}%{A:bspc desktop -f ${name}:} ${name} %{A}%{B-}%{F-}"
esac
shift
done
;;
esac
printf "%s\n" " ${wm} ${title}%{r}${clock} "
done < "$PANEL_FIFO" | lemonbar -B "${BAR_BG}" -F "${BAR_FG}" -n panel -f Iosevka:pixelsize=30:antialias=true:autohint=true | sh

45
.config/polybar/config Normal file
View File

@ -0,0 +1,45 @@
[colors]
background = #1a343a
foreground = #f2f6e1
underline = #1a343a
active = #3585ce
urgent = #9b0640
empty = #808080
[bar/panel]
monitor = ${env:MONITOR:}
modules-left = bspwm xwindow
modules-right = date
font-0 = Iosevka:pixelsize=23:antialias=true:autohint=true
height = 45
background = ${colors.background}
foreground = ${colors.foreground}
padding-left = 2
padding-right = 2
module-margin-left = 1
module-margin-right = 1
line-size = 5
[module/bspwm]
type = internal/bspwm
label-focused = %name%
label-occupied = %name%
label-urgent = %name%
label-empty = %name%
label-focused-padding = 1
label-occupied-padding = 1
label-urgent-padding = 1
label-empty-padding = 1
label-focused-background = ${colors.active}
label-focused-underline = ${colors.underline}
label-urgent-background = ${colors.urgent}
label-empty-foreground = ${colors.empty}
[module/xwindow]
type = internal/xwindow
label = %title%
[module/date]
type = internal/date
time = %H:%M
label = %time%