hideIt.sh
hideIt.sh copied to clipboard
bspwm and polybar
Hi, first thank's for your work, second I have a problem with polybar that is placed under every windows, then I tryed with
xdo raise -N Polybar
from terminal and it's worked, but if I put inside polybar launcher, never works. That are my relevant config:
- bspwmrc
pgrep -x sxhkd > /dev/null || sxhkd &
setxkbmap -layout it &
numlockx &
xsetroot -cursor_name left_ptr &
wal -i ~/.wallpapers/ -o ~/.config/dunst/dunst-color.sh &
xset s 60 120
xss-lock -n "notify-send -u critical -t 5000 -- 'Locking in 1 min'" -- slock &
picom &
./.config/low-battery.sh &
./.config/polybar/launch.sh &
- launch.sh
killall -q polybar
source ~/.cache/wal/colors.sh
export color0_alpha="#22${color1/'#'}"
polybar bar1 2>&1 | tee -a /tmp/polybar1.log &
xdo raise -N Polybar
~/.config/polybar/hide -d top -N 'polybar' --region 560x10+900+-100 -w &
- polybar config
[global/wm] margin-top = 0 margin-bottom = 0
[bar/bar1] width = 50% height = 30 offset-x = 25% offset-y = 1% fixed-center = true
tray-position = right tray-detached = true tray-offset-x = 60
border-bottom-size = 0
background = ${colors.background} foreground = ${colors.foreground}
padding-left = 5 padding-right = 5 spacing = 0 module-margin = 2
font-0 = SF Pro Display:size=13;3
modules-left = apps date bspwm modules-center = modules-right = battery backlight pulseaudio temperature wlan eth powermenu
wm-restack = bspwm override-redirect = true
polybar should not end up underneath any window in any case but maybe this is a bspwm thing.
Anyways, xdo raise
does most likely not work because you call it basically at the same time as you start polybar due to the &
.
Try adding a sleep between like I did below. This might give polybar enough time to start.
killall -q polybar
source ~/.cache/wal/colors.sh
export color0_alpha="#22${color1/'#'}"
polybar bar1 2>&1 | tee -a /tmp/polybar1.log &
sleep 1
xdo raise -N Polybar
~/.config/polybar/hide -d top -N 'polybar' --region 560x10+900+-100 -w &
thanks for your fast reply I've tryed but doesn't work, neither xdo nor hide...
- and I have another question, how can I prevent do have multiple process of your script running at the same time? Because after I restart (not logout or reboot) bspwm it create an another process of hideit and both of them not work
i'm pretty sure if you remove wm-restack = bspwm
that should solve your initial problem.
Nah It doesn't work :( But in other wm work's perfectly 👍🏻 For my second question you maybe know a solution?
in my bspwmrc i have the following:
pkill -f 'hideIt.sh'
pkill -f 'polybar'
echo "-----------" | tee -a /tmp/polybar_*.log
function start_bar {
polybar "$1_display" 2>&1 | tee -a "/tmp/polybar_$1.log" & disown
sleep 0.5
hideIt.sh -w --name "^polybar-$1" -d top -H -p 3 & disown
}
and i use start_bar
like so
hdmi_a_0=$(cat /sys/class/drm/card0-HDMI-A-1/status)
if [[ $hdmi_a_0 = *disconnected* ]]; then
bspc monitor 'eDP' -d 1 2 3 4 5 6 7 8 9 0
start_bar "internal"
else
bspc monitor 'HDMI-A-0' -d 1 2 3 4 5
bspc monitor 'eDP' -d 6 7 8 9 0
start_bar "internal"
start_bar "external"
fi
and it seems to work alright. the sleep duration was what worked fine for me but you might have to adjust it.
regarding your first question, i can confirm that the same thing happens to me when my bar started immediately after boot, but when if i restart it, it seems to work just fine. i'm not sure if it's hideIt.sh's fault though.